cpw.malu.xmpp.idle: a7ec91e9: Only update the idle time on a buddy whe...

malu at pidgin.im malu at pidgin.im
Thu Dec 25 05:55:35 EST 2008


-----------------------------------------------------------------
Revision: a7ec91e9a7e4f8692b23cf175956183f84f0d198
Ancestor: eac2525c5135b2dfd1dc39ebc1ab31a4abd164a1
Author: malu at pidgin.im
Date: 2008-12-25T10:48:49
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/a7ec91e9a7e4f8692b23cf175956183f84f0d198

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

ChangeLog: 

Only update the idle time on a buddy when getting info if the buddy already has
an idle time set. This will avoid setting idle time on a resource that won't
send an updated idle (going unidle) in a <presence/> later on (thus getting
"stuck" idle).

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c	2d82a16003d9b665e5b8300ebf1ffa5b395b7484
+++ libpurple/protocols/jabber/buddy.c	4c60928410c25cfe853635bb38f740e8afb5e5d6
@@ -1646,15 +1646,26 @@ static void jabber_last_parse(JabberStre
                     if (jb) {
                         resource = jabber_get_resource(from);
                         buddy_name = jabber_get_bare_jid(from);
+                        /* if the resource already has an idle time set, we
+                         must have gotten it originally from a presence. In
+                         this case we update it. Otherwise don't update it, to
+                         avoid setting an idle and not getting informed about
+                         the resource getting unidle */
                         if (resource && buddy_name) {
                             jbr = jabber_buddy_find_resource(jb, resource);
-                            jbr->idle = time(NULL) - sec;
                             
-                            if (jbr == 
-                                jabber_buddy_find_resource(jb, NULL) &&
-                                jbr->idle) {
-                                purple_prpl_got_user_idle(js->gc->account, 
-                                    buddy_name, jbr->idle, jbr->idle);
+                            if (jbr->idle) {
+                                if (sec) {
+                                    jbr->idle = time(NULL) - sec;
+                                } else {
+                                    jbr->idle = 0;
+                                }
+                            
+                                if (jbr == 
+                                    jabber_buddy_find_resource(jb, NULL)) {
+                                    purple_prpl_got_user_idle(js->gc->account, 
+                                        buddy_name, jbr->idle, jbr->idle);
+                                }
                             }
                         }
                         g_free(resource);


More information about the Commits mailing list