changeset 14391:6e89bfd2b33f

[gaim-migrate @ 17098] 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. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 31 Aug 2006 09:02:10 +0000
parents d4a26ada1971
children 92eb7a040663
files libgaim/protocols/jabber/iq.c libgaim/protocols/jabber/jabber.c libgaim/protocols/jabber/jabber.h libgaim/protocols/msn/state.c libgaim/protocols/yahoo/yahoo.c libgaim/status.c
diffstat 6 files changed, 13 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/jabber/iq.c	Thu Aug 31 06:39:20 2006 +0000
+++ b/libgaim/protocols/jabber/iq.c	Thu Aug 31 09:02:10 2006 +0000
@@ -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,18 +158,9 @@
 
 		query = xmlnode_get_child(iq->node, "query");
 
-		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");
-		}
+		idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0);
+		xmlnode_set_attrib(query, "seconds", idle_time);
+		g_free(idle_time);
 
 		jabber_iq_send(iq);
 	}
--- a/libgaim/protocols/jabber/jabber.c	Thu Aug 31 06:39:20 2006 +0000
+++ b/libgaim/protocols/jabber/jabber.c	Thu Aug 31 09:02:10 2006 +0000
@@ -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 */
--- a/libgaim/protocols/jabber/jabber.h	Thu Aug 31 06:39:20 2006 +0000
+++ b/libgaim/protocols/jabber/jabber.h	Thu Aug 31 09:02:10 2006 +0000
@@ -111,6 +111,8 @@
 	GList *oob_file_transfers;
 	GList *file_transfers;
 
+	time_t idle;
+
 	JabberID *user;
 	GaimConnection *gc;
 	GaimSslConnection *gsc;
--- a/libgaim/protocols/msn/state.c	Thu Aug 31 06:39:20 2006 +0000
+++ b/libgaim/protocols/msn/state.c	Thu Aug 31 09:02:10 2006 +0000
@@ -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));
--- a/libgaim/protocols/yahoo/yahoo.c	Thu Aug 31 06:39:20 2006 +0000
+++ b/libgaim/protocols/yahoo/yahoo.c	Thu Aug 31 09:02:10 2006 +0000
@@ -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) {
--- a/libgaim/status.c	Thu Aug 31 06:39:20 2006 +0000
+++ b/libgaim/status.c	Thu Aug 31 09:02:10 2006 +0000
@@ -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));
 	}
 }