From: <fac...@us...> - 2006-08-23 16:37:17
|
Revision: 17005 Author: faceprint Date: 2006-08-23 09:36:58 -0700 (Wed, 23 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17005&view=rev Log Message: ----------- a prpl's set_idle function can be called before the login function this is because the signing-on signal is emitted, and there's a callback to check idle and update all the prpls attached to that signal this meant that if you were idle, and got disconnected from jabber, upon attempting to reconnect, you'd segfault I've changed how jabber handles idle updates to work around this. someone may want to audit the other prpls, to make sure their set_idle callbacks (if any) don't assume the connection is up Modified Paths: -------------- trunk/libgaim/protocols/jabber/iq.c trunk/libgaim/protocols/jabber/jabber.c trunk/libgaim/protocols/jabber/jabber.h Modified: trunk/libgaim/protocols/jabber/iq.c =================================================================== --- trunk/libgaim/protocols/jabber/iq.c 2006-08-23 16:25:54 UTC (rev 17004) +++ trunk/libgaim/protocols/jabber/iq.c 2006-08-23 16:36:58 UTC (rev 17005) @@ -145,7 +145,7 @@ const char *from; const char *id; xmlnode *query; - char *idle_time; + GaimPresence *gpresence; type = xmlnode_get_attrib(packet, "type"); from = xmlnode_get_attrib(packet, "from"); @@ -158,10 +158,19 @@ query = xmlnode_get_child(iq->node, "query"); - idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); - xmlnode_set_attrib(query, "seconds", idle_time); - g_free(idle_time); + gpresence = gaim_account_get_presence(js->gc->account); + if(gaim_presence_is_idle(gpresence)) { + time_t idle_time = gaim_presence_get_idle_time(gpresence); + char *idle_str; + + idle_str = g_strdup_printf("%ld", time(NULL) - idle_time); + xmlnode_set_attrib(query, "seconds", idle_str); + g_free(idle_str); + } else { + xmlnode_set_attrib(query, "seconds", "0"); + } + jabber_iq_send(iq); } } Modified: trunk/libgaim/protocols/jabber/jabber.c =================================================================== --- trunk/libgaim/protocols/jabber/jabber.c 2006-08-23 16:25:54 UTC (rev 17004) +++ trunk/libgaim/protocols/jabber/jabber.c 2006-08-23 16:36:58 UTC (rev 17005) @@ -1040,13 +1040,14 @@ return g_strdup_printf("gaim%x", js->next_id++); } - +/* static void jabber_idle_set(GaimConnection *gc, int idle) { JabberStream *js = gc->proto_data; js->idle = idle ? time(NULL) - idle : idle; } +*/ static const char *jabber_list_icon(GaimAccount *a, GaimBuddy *b) { @@ -1847,7 +1848,7 @@ jabber_send_typing, /* send_typing */ jabber_buddy_get_info, /* get_info */ jabber_presence_send, /* set_away */ - jabber_idle_set, /* set_idle */ + NULL, /* set_idle */ NULL, /* change_passwd */ jabber_roster_add_buddy, /* add_buddy */ NULL, /* add_buddies */ Modified: trunk/libgaim/protocols/jabber/jabber.h =================================================================== --- trunk/libgaim/protocols/jabber/jabber.h 2006-08-23 16:25:54 UTC (rev 17004) +++ trunk/libgaim/protocols/jabber/jabber.h 2006-08-23 16:36:58 UTC (rev 17005) @@ -111,8 +111,6 @@ GList *oob_file_transfers; GList *file_transfers; - time_t idle; - JabberID *user; GaimConnection *gc; GaimSslConnection *gsc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |