pidgin: 4dcf57d4: Send XMPP keepalive pings to our server,...

paul at darkrain42.org paul at darkrain42.org
Tue Apr 14 21:45:41 EDT 2009


-----------------------------------------------------------------
Revision: 4dcf57d47a73223c7c72ea9404107b71d7daac4f
Ancestor: 580055bb22fea0076d3a90d9df9346abd1789bab
Author: paul at darkrain42.org
Date: 2009-04-15T01:44:17
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4dcf57d47a73223c7c72ea9404107b71d7daac4f

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

ChangeLog: 

Send XMPP keepalive pings to our server, not our bare JID.

jabberd doesn't seem to follow the same semantics for a non-existent 'to'
on a stanza; the response comes from our own full JID. Addressing the pings
to the server's JID should sidestep that problem.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	2f1344c43177016f76dbc456fe22e20a087d4ebe
+++ libpurple/protocols/jabber/jabber.c	8a2ea03b1b52a051312222af7691be2e0ab5acb1
@@ -463,7 +463,7 @@ void jabber_keepalive(PurpleConnection *
 	JabberStream *js = gc->proto_data;
 
 	if (js->keepalive_timeout == -1) {
-		jabber_ping_jid(js, NULL);
+		jabber_ping_jid(js, js->user->domain);
 		js->keepalive_timeout = purple_timeout_add_seconds(120,
 				(GSourceFunc)(jabber_keepalive_timeout), gc);
 	}
============================================================
--- libpurple/protocols/jabber/ping.c	7ed02e1242210454344eba065576ffaf7343a060
+++ libpurple/protocols/jabber/ping.c	2a7be5eb1b9ad47afcb4f47fb782176bf6b9bfd2
@@ -55,15 +55,10 @@ static void jabber_ping_result_cb(Jabber
                                   JabberIqType type, const char *id,
                                   xmlnode *packet, gpointer data)
 {
-	char *own_bare_jid = g_strdup_printf("%s@%s", js->user->node,
-	                                     js->user->domain);
-
-	if (!from || !strcmp(from, own_bare_jid)) {
-		/* If the pong is from our bare JID, treat it as a return from the
+	if (purple_strequal(from, js->user->domain))
+		/* If the pong is from the server, assume it's a result of the
 		 * keepalive functions */
 		jabber_keepalive_pong_cb(js);
-	}
-	g_free(own_bare_jid);
 
 	if (type == JABBER_IQ_RESULT) {
 		purple_debug_info("jabber", "PONG!\n");


More information about the Commits mailing list