cpw.malu.xmpp.idle: 244094a7: Set idle time on JabberStream when loggi...

malu at pidgin.im malu at pidgin.im
Thu Jan 29 14:55:22 EST 2009


-----------------------------------------------------------------
Revision: 244094a7e3119698662ac93e055e40035e08612c
Ancestor: c800b24d26350beba2f7f3faad6328e0c968c76c
Author: malu at pidgin.im
Date: 2009-01-29T19:54:26
Branch: im.pidgin.cpw.malu.xmpp.idle
URL: http://d.pidgin.im/viewmtn/revision/info/244094a7e3119698662ac93e055e40035e08612c

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

ChangeLog: 

Set idle time on JabberStream when logging in
This way we will report idle time if we get disconnected while being idle

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	fc9735c79c1673213f0dfe8da99a47038b6bab47
+++ libpurple/protocols/jabber/jabber.c	6642bc9909fab071fa9ca3981057b5a878e9544b
@@ -28,6 +28,7 @@
 #include "conversation.h"
 #include "debug.h"
 #include "dnssrv.h"
+#include "idle.h"
 #include "message.h"
 #include "notify.h"
 #include "pluginpref.h"
@@ -702,7 +703,8 @@ jabber_login(PurpleAccount *account)
 			"connect_server", "");
 	JabberStream *js;
 	JabberBuddy *my_jb = NULL;
-
+	PurpleIdleUiOps *idle_ops = NULL;
+	
 	gc->flags |= PURPLE_CONNECTION_HTML |
 		PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
 	js = gc->proto_data = g_new0(JabberStream, 1);
@@ -723,6 +725,14 @@ jabber_login(PurpleAccount *account)
 	js->keepalive_timeout = -1;
 	js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user ? js->user->domain : NULL);
 
+	/* if we are idle, set idle-ness on the stream (this could happen if we get
+		disconnected and the reconnects while being idle. I don't think it makes
+		sense to do this when registering a new account... */
+	idle_ops = purple_idle_get_ui_ops();
+	if (idle_ops && idle_ops->get_time_idle) {
+		js->idle = (idle_ops->get_time_idle)();
+	}
+		
 	if(!js->user) {
 		purple_connection_error_reason (gc,
 			PURPLE_CONNECTION_ERROR_INVALID_SETTINGS,


More information about the Commits mailing list