changeset 25940:c2cb082f5f2f

Reduce the debug log spam from the ping code and fix a logic error. The response will come from our own bare JID (or have no 'from' attributes) for the keepalive pings.
author Paul Aurich <paul@darkrain42.org>
date Sun, 08 Feb 2009 16:50:58 +0000
parents 150282919040
children d1a0e487d45f
files libpurple/protocols/jabber/ping.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/ping.c	Sun Feb 08 08:12:19 2009 +0000
+++ b/libpurple/protocols/jabber/ping.c	Sun Feb 08 16:50:58 2009 +0000
@@ -38,8 +38,6 @@
 jabber_ping_parse(JabberStream *js, const char *from,
                   JabberIqType type, const char *id, xmlnode *ping)
 {
-	purple_debug_info("jabber", "jabber_ping_parse\n");
-
 	if (type == JABBER_IQ_GET) {
 		JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT);
 
@@ -58,14 +56,15 @@
 {
 	const char *type = xmlnode_get_attrib(packet, "type");
 	const char *from = xmlnode_get_attrib(packet, "from");
-
-	purple_debug_info("jabber", "jabber_ping_result_cb\n");
+	char *own_bare_jid = g_strdup_printf("%s@%s", js->user->node,
+	                                     js->user->domain);
 
-	if (!from || !strcmp(from, js->user->domain)) {
-		/* If the pong is from our server, treat it as a return from the
+	if (!from || !strcmp(from, own_bare_jid)) {
+		/* If the pong is from our bare JID, treat it as a return from the
 		 * keepalive functions */
 		jabber_keepalive_pong_cb(js);
 	}
+	g_free(own_bare_jid);
 
 	if(type && !strcmp(type, "result")) {
 		purple_debug_info("jabber", "PONG!\n");
@@ -79,8 +78,6 @@
 	JabberIq *iq;
 	xmlnode *ping;
 
-	purple_debug_info("jabber", "jabber_ping_jid\n");
-
 	iq = jabber_iq_new(js, JABBER_IQ_GET);
 	if (jid)
 		xmlnode_set_attrib(iq->node, "to", jid);