From: <the...@us...> - 2006-08-31 09:02:29
|
Revision: 17098 http://svn.sourceforge.net/gaim/?rev=17098&view=rev Author: thekingant Date: 2006-08-31 02:02:10 -0700 (Thu, 31 Aug 2006) Log Message: ----------- I don't think PRPLs should need to make sure that proto_data is valid in the set_idle() callback. Some of my idle changes on the 23rd added that requirement. This removes the requirement to make things the way they were before. I'm also reverting SVN revision 17005 from faceprint and 17009 from marv_sf. Those revisions fixed the PRPLs so they wouldn't crash if set_idle() was called before the acocunt was fully connected. But that shouldn't be needed any more. Revision Links: -------------- http://svn.sourceforge.net/gaim/?rev=17005&view=rev Modified Paths: -------------- trunk/libgaim/protocols/jabber/iq.c trunk/libgaim/protocols/jabber/jabber.c trunk/libgaim/protocols/jabber/jabber.h trunk/libgaim/protocols/msn/state.c trunk/libgaim/protocols/yahoo/yahoo.c trunk/libgaim/status.c Modified: trunk/libgaim/protocols/jabber/iq.c =================================================================== --- trunk/libgaim/protocols/jabber/iq.c 2006-08-31 08:58:36 UTC (rev 17097) +++ trunk/libgaim/protocols/jabber/iq.c 2006-08-31 09:02:10 UTC (rev 17098) @@ -145,7 +145,7 @@ const char *from; const char *id; xmlnode *query; - GaimPresence *gpresence; + char *idle_time; type = xmlnode_get_attrib(packet, "type"); from = xmlnode_get_attrib(packet, "from"); @@ -158,19 +158,10 @@ query = xmlnode_get_child(iq->node, "query"); - gpresence = gaim_account_get_presence(js->gc->account); + idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); + xmlnode_set_attrib(query, "seconds", idle_time); + g_free(idle_time); - 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-31 08:58:36 UTC (rev 17097) +++ trunk/libgaim/protocols/jabber/jabber.c 2006-08-31 09:02:10 UTC (rev 17098) @@ -1040,14 +1040,13 @@ 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) { @@ -1848,7 +1847,7 @@ jabber_send_typing, /* send_typing */ jabber_buddy_get_info, /* get_info */ jabber_presence_send, /* set_away */ - NULL, /* set_idle */ + jabber_idle_set, /* 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-31 08:58:36 UTC (rev 17097) +++ trunk/libgaim/protocols/jabber/jabber.h 2006-08-31 09:02:10 UTC (rev 17098) @@ -111,6 +111,8 @@ GList *oob_file_transfers; GList *file_transfers; + time_t idle; + JabberID *user; GaimConnection *gc; GaimSslConnection *gsc; Modified: trunk/libgaim/protocols/msn/state.c =================================================================== --- trunk/libgaim/protocols/msn/state.c 2006-08-31 08:58:36 UTC (rev 17097) +++ trunk/libgaim/protocols/msn/state.c 2006-08-31 09:02:10 UTC (rev 17098) @@ -41,7 +41,7 @@ void msn_change_status(MsnSession *session) { - GaimAccount *account = session->account; + GaimAccount *account; MsnCmdProc *cmdproc; MsnUser *user; MsnObject *msnobj; @@ -50,6 +50,7 @@ g_return_if_fail(session != NULL); g_return_if_fail(session->notification != NULL); + account = session->account; cmdproc = session->notification->cmdproc; user = session->user; state_text = msn_state_get_text(msn_state_from_account(account)); Modified: trunk/libgaim/protocols/yahoo/yahoo.c =================================================================== --- trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-31 08:58:36 UTC (rev 17097) +++ trunk/libgaim/protocols/yahoo/yahoo.c 2006-08-31 09:02:10 UTC (rev 17098) @@ -3363,9 +3363,6 @@ char *msg = NULL, *msg2 = NULL; GaimStatus *status = NULL; - if (!yd) - return; - if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) yd->current_status = YAHOO_STATUS_IDLE; else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { Modified: trunk/libgaim/status.c =================================================================== --- trunk/libgaim/status.c 2006-08-31 08:58:36 UTC (rev 17097) +++ trunk/libgaim/status.c 2006-08-31 09:02:10 UTC (rev 17098) @@ -1388,11 +1388,11 @@ gc = gaim_account_get_connection(account); - if (gc != NULL && gc->prpl != NULL) + if (gc != NULL && GAIM_CONNECTION_IS_CONNECTED(gc) && + gc->prpl != NULL) prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (prpl_info && g_list_find(gaim_connections_get_all(), gc) && - prpl_info->set_idle) + if (prpl_info && prpl_info->set_idle) prpl_info->set_idle(gc, (idle ? (time(NULL) - idle_time) : 0)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |