# HG changeset patch # User Paul Aurich # Date 1248636347 0 # Node ID 735040819c160f6d6ba449220ba44359e8a0c89a # Parent 042786b478c1d73b887092cd4449708c3f8b26f0 jabber: Properly track own idle time in fake_to_self. diff -r 042786b478c1 -r 735040819c16 libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Sun Jul 26 17:43:00 2009 +0000 +++ b/libpurple/protocols/jabber/presence.c Sun Jul 26 19:25:47 2009 +0000 @@ -62,14 +62,16 @@ 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 @@ 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); }