pidgin: 5d4aedc3: jabber: Properly track own idle time in ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jul 26 23:35:44 EDT 2009


-----------------------------------------------------------------
Revision: 5d4aedc31a80c619b98a662c4bb3df9f2bd17246
Ancestor: 4c0f666db56b090ce18cd514088313be1529e6f0
Author: darkrain42 at pidgin.im
Date: 2009-07-26T19:25:47
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/5d4aedc31a80c619b98a662c4bb3df9f2bd17246

Modified files:
        libpurple/protocols/jabber/presence.c

ChangeLog: 

jabber: Properly track own idle time in fake_to_self.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	79aaf8ece71251cf456d4f549313dc5b809b75c3
+++ libpurple/protocols/jabber/presence.c	fa816cb3fa1b956a4e1490e3112f53390492e118
@@ -62,14 +62,16 @@ void jabber_presence_fake_to_self(Jabber
 void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status)
 {
 	PurpleAccount *account;
+	PurplePresence *presence;
 	const char *username;
 
 	g_return_if_fail(js->user != NULL);
 
 	account = purple_connection_get_account(js->gc);
 	username = purple_connection_get_display_name(js->gc);
+	presence = purple_account_get_presence(account);
 	if (status == NULL)
-		status = purple_account_get_active_status(account);
+		status = purple_presence_get_active_status(presence);
 
 	if (purple_find_buddy(account, username)) {
 		JabberBuddy *jb = jabber_buddy_find(js, username, TRUE);
@@ -86,14 +88,23 @@ void jabber_presence_fake_to_self(Jabber
 				state == JABBER_BUDDY_STATE_UNKNOWN) {
 			jabber_buddy_remove_resource(jb, js->user->resource);
 		} else {
-			jabber_buddy_track_resource(jb, js->user->resource, priority,
-			                            state, msg);
+			jbr = jabber_buddy_track_resource(jb, js->user->resource, priority,
+					state, msg);
+			jbr->idle = purple_presence_is_idle(presence) ?
+					purple_presence_get_idle_time(presence) : 0;
 		}
 
 		if ((jbr = jabber_buddy_find_resource(jb, NULL))) {
-			purple_prpl_got_user_status(account, username, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
+			purple_prpl_got_user_status(account, username,
+					jabber_buddy_state_get_status_id(jbr->state),
+					"priority", jbr->priority,
+					jbr->status ? "message" : NULL, jbr->status,
+					NULL);
+			purple_prpl_got_user_idle(account, username, jbr->idle, jbr->idle);
 		} else {
-			purple_prpl_got_user_status(account, username, "offline", msg ? "message" : NULL, msg, NULL);
+			purple_prpl_got_user_status(account, username, "offline",
+					msg ? "message" : NULL, msg,
+					NULL);
 		}
 		g_free(msg);
 	}


More information about the Commits mailing list