cpw.malu.xmpp.idle: eac2525c: When getting info from a buddy, update t...
malu at pidgin.im
malu at pidgin.im
Wed Dec 24 17:56:05 EST 2008
-----------------------------------------------------------------
Revision: eac2525c5135b2dfd1dc39ebc1ab31a4abd164a1
Ancestor: d997bb64d86eafc69762eb4592fcf53302681eaf
Author: malu at pidgin.im
Date: 2008-12-24T22:51:16
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/eac2525c5135b2dfd1dc39ebc1ab31a4abd164a1
Modified files:
libpurple/protocols/jabber/buddy.c
ChangeLog:
When getting info from a buddy, update the idle status to the libpurple core
if we get last activity (ie. idle) time
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c 07015d8dbda2e85a55b6cfc874ec33533b4d060d
+++ libpurple/protocols/jabber/buddy.c 2d82a16003d9b665e5b8300ebf1ffa5b395b7484
@@ -1627,12 +1627,39 @@ static void jabber_last_parse(JabberStre
if(seconds) {
char *end = NULL;
long sec = strtol(seconds, &end, 10);
- if(end != seconds) {
+ JabberBuddy *jb = NULL;
+ char *resource = NULL;
+ char *buddy_name = NULL;
+ JabberBuddyResource *jbr = NULL;
+
+ if(end != seconds) {
JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name);
if(jbir) {
jbir->idle_seconds = sec;
}
}
+ /* if this idle time different from the one stored
+ in the JabberBuddyResource (as obtained via
+ <presence/>) update it. This is to correct the value
+ when a server doesn't mark delayed presence */
+ jb = jabber_buddy_find(js, from, FALSE);
+ if (jb) {
+ resource = jabber_get_resource(from);
+ buddy_name = jabber_get_bare_jid(from);
+ 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);
+ }
+ }
+ g_free(resource);
+ g_free(buddy_name);
+ }
}
}
}
More information about the Commits
mailing list