comparison libpurple/protocols/jabber/ping.c @ 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 ae41d8e827e3
children 75b30b849293
comparison
equal deleted inserted replaced
26566:8c3b1a059ecc 26567:d00a8111e479
53 53
54 static void jabber_ping_result_cb(JabberStream *js, const char *from, 54 static void jabber_ping_result_cb(JabberStream *js, const char *from,
55 JabberIqType type, const char *id, 55 JabberIqType type, const char *id,
56 xmlnode *packet, gpointer data) 56 xmlnode *packet, gpointer data)
57 { 57 {
58 char *own_bare_jid = g_strdup_printf("%s@%s", js->user->node, 58 if (purple_strequal(from, js->user->domain))
59 js->user->domain); 59 /* If the pong is from the server, assume it's a result of the
60
61 if (!from || !strcmp(from, own_bare_jid)) {
62 /* If the pong is from our bare JID, treat it as a return from the
63 * keepalive functions */ 60 * keepalive functions */
64 jabber_keepalive_pong_cb(js); 61 jabber_keepalive_pong_cb(js);
65 }
66 g_free(own_bare_jid);
67 62
68 if (type == JABBER_IQ_RESULT) { 63 if (type == JABBER_IQ_RESULT) {
69 purple_debug_info("jabber", "PONG!\n"); 64 purple_debug_info("jabber", "PONG!\n");
70 } else { 65 } else {
71 purple_debug_info("jabber", "(not supported)\n"); 66 purple_debug_info("jabber", "(not supported)\n");