pidgin: 427f3622: bonjour: Recurse through user IP address...
datallah at pidgin.im
datallah at pidgin.im
Tue May 3 12:41:42 EDT 2011
----------------------------------------------------------------------
Revision: 427f3622bbeb4d441ed1d9578800c1d8dce7849f
Parent: 2c478c4a5297ed4f4ceca9e3fa210d6e4d27622d
Author: Simon van der Linden <simon at vanderlinden.eu.org>
Date: 05/03/11 12:12:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/427f3622bbeb4d441ed1d9578800c1d8dce7849f
Changelog:
bonjour: Recurse through user IP addresses instead of using the first one only
This, among other things, makes interactivity with iChat more reliable because
iChat apparently advertises an IPv6 address, but doesn't listen on it.
Fixes #13773
Changes against parent 2c478c4a5297ed4f4ceca9e3fa210d6e4d27622d
patched libpurple/protocols/bonjour/jabber.c
-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/jabber.c 52f292720ce7aea2b5c539f9d66a8b99c120d566
+++ libpurple/protocols/bonjour/jabber.c 644bea285388702ee3242a35210c2362c3782c9c
@@ -831,12 +831,39 @@ _connected_to_buddy(gpointer data, gint
if (source < 0) {
PurpleConversation *conv = NULL;
PurpleAccount *account = NULL;
+ GSList *tmp = bb->ips;
- purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n",
- purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error ? error : "(null)");
+ purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d (%s); Trying next IP address\n",
+ purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error);
+ for (; strcmp(bb->conversation->ip, tmp->data) != 0; tmp = g_slist_next(tmp));
+ tmp = g_slist_next(tmp);
+
account = purple_buddy_get_account(pb);
+ if (tmp != NULL) {
+ const gchar *ip;
+ PurpleProxyConnectData *connect_data;
+
+ ip = tmp->data;
+
+ purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n",
+ purple_buddy_get_name(pb), ip, bb->port_p2pj);
+
+ connect_data = purple_proxy_connect(purple_account_get_connection(account),
+ account, ip, bb->port_p2pj, _connected_to_buddy, pb);
+
+ if (connect_data != NULL) {
+ g_free(bb->conversation->ip);
+ bb->conversation->ip = g_strdup(ip);
+ bb->conversation->connect_data = connect_data;
+
+ return;
+ }
+ }
+
+ purple_debug_error("bonjour", "No more addresses for buddy %s. Aborting", purple_buddy_get_name(pb));
+
conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account);
if (conv != NULL)
purple_conversation_write(conv, NULL,
@@ -995,10 +1022,9 @@ _find_or_start_conversation(BonjourJabbe
{
PurpleProxyConnectData *connect_data;
PurpleProxyInfo *proxy_info;
- /* For better or worse, use the first IP*/
- const char *ip = bb->ips->data;
+ const char *ip = bb->ips->data; /* Start with the first IP address. */
- purple_debug_info("bonjour", "Starting conversation with %s\n", to);
+ purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n", to, ip, bb->port_p2pj);
/* Make sure that the account always has a proxy of "none".
* This is kind of dirty, but proxy_connect_none() isn't exposed. */
More information about the Commits
mailing list