changeset 26567:d00a8111e479

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.
author Paul Aurich <paul@darkrain42.org>
date Wed, 15 Apr 2009 01:44:17 +0000
parents 8c3b1a059ecc
children 3712d32363dd
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/ping.c
diffstat 2 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Apr 12 23:57:27 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed Apr 15 01:44:17 2009 +0000
@@ -463,7 +463,7 @@
 	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);
 	}
--- a/libpurple/protocols/jabber/ping.c	Sun Apr 12 23:57:27 2009 +0000
+++ b/libpurple/protocols/jabber/ping.c	Wed Apr 15 01:44:17 2009 +0000
@@ -55,15 +55,10 @@
                                   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");