/** * Handles an event where a friend changes their status. * * @param p Event representing change. */ private void processFriendChangeStatus(FriendChangeStatusPacket p) { Log.debug("QQ: Processing friend status change event"); try { if (getSession().getBuddyManager().isActivated()) { try { QQBuddy qqBuddy = getSession() .getBuddyManager() .getBuddy(getSession().getTransport().convertIDToJID(String.valueOf(p.friendQQ))); qqBuddy.setPresenceAndStatus( ((QQTransport) getSession().getTransport()).convertQQStatusToXMPP(p.status), null); } catch (NotFoundException ee) { // Not in our list. Log.debug( "QQ: Received presense notification for contact we don't care about: " + String.valueOf(p.friendQQ)); } } else { getSession() .getBuddyManager() .storePendingStatus( getSession().getTransport().convertIDToJID(String.valueOf(p.friendQQ)), ((QQTransport) getSession().getTransport()).convertQQStatusToXMPP(p.status), null); } } catch (Exception ex) { Log.error("Failed to handle friend status change event: ", ex); } }
/** * Handles an event when a friend has come online. * * @param p Event to be handled. */ private void processFriendOnline(_08GetOnlineOpReplyPacket p) { Log.debug("QQ: Processing friend online notification"); try { for (FriendOnlineEntry f : p.onlineFriends) { Log.debug("QQ: Got an online friend"); if (getSession().getBuddyManager().isActivated()) { try { QQBuddy qqBuddy = getSession() .getBuddyManager() .getBuddy( getSession().getTransport().convertIDToJID(String.valueOf(f.status.qqNum))); qqBuddy.setPresenceAndStatus( ((QQTransport) getSession().getTransport()).convertQQStatusToXMPP(f.status.status), null); } catch (NotFoundException ee) { // Not in our list. Log.debug( "QQ: Received presense notification for contact we don't care about: " + String.valueOf(f.status.qqNum)); } } else { getSession() .getBuddyManager() .storePendingStatus( getSession().getTransport().convertIDToJID(String.valueOf(f.status.qqNum)), ((QQTransport) getSession().getTransport()) .convertQQStatusToXMPP(f.status.status), null); } } // if (!p.finished) { // qqclient.getUser().user_GetOnline(p.position); // } } catch (Exception ex) { Log.error("Failed to handle friend online event: ", ex); } }