Mercurial > pidgin.yaz
comparison libpurple/protocols/bonjour/jabber.c @ 31989:6ec53e134447
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
committer: Daniel Atallah <daniel.atallah@gmail.com>
author | Simon van der Linden <simon@vanderlinden.eu.org> |
---|---|
date | Tue, 03 May 2011 16:12:36 +0000 |
parents | 03988b6b41dd |
children | e1d31abb245c |
comparison
equal
deleted
inserted
replaced
31986:3e11fa72c5d8 | 31989:6ec53e134447 |
---|---|
829 bb->conversation->connect_data = NULL; | 829 bb->conversation->connect_data = NULL; |
830 | 830 |
831 if (source < 0) { | 831 if (source < 0) { |
832 PurpleConversation *conv = NULL; | 832 PurpleConversation *conv = NULL; |
833 PurpleAccount *account = NULL; | 833 PurpleAccount *account = NULL; |
834 | 834 GSList *tmp = bb->ips; |
835 purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", | 835 |
836 purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error ? error : "(null)"); | 836 purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d (%s); Trying next IP address\n", |
837 purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error); | |
838 | |
839 for (; strcmp(bb->conversation->ip, tmp->data) != 0; tmp = g_slist_next(tmp)); | |
840 tmp = g_slist_next(tmp); | |
837 | 841 |
838 account = purple_buddy_get_account(pb); | 842 account = purple_buddy_get_account(pb); |
843 | |
844 if (tmp != NULL) { | |
845 const gchar *ip; | |
846 PurpleProxyConnectData *connect_data; | |
847 | |
848 ip = tmp->data; | |
849 | |
850 purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n", | |
851 purple_buddy_get_name(pb), ip, bb->port_p2pj); | |
852 | |
853 connect_data = purple_proxy_connect(purple_account_get_connection(account), | |
854 account, ip, bb->port_p2pj, _connected_to_buddy, pb); | |
855 | |
856 if (connect_data != NULL) { | |
857 g_free(bb->conversation->ip); | |
858 bb->conversation->ip = g_strdup(ip); | |
859 bb->conversation->connect_data = connect_data; | |
860 | |
861 return; | |
862 } | |
863 } | |
864 | |
865 purple_debug_error("bonjour", "No more addresses for buddy %s. Aborting", purple_buddy_get_name(pb)); | |
839 | 866 |
840 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); | 867 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); |
841 if (conv != NULL) | 868 if (conv != NULL) |
842 purple_conversation_write(conv, NULL, | 869 purple_conversation_write(conv, NULL, |
843 _("Unable to send the message, the conversation couldn't be started."), | 870 _("Unable to send the message, the conversation couldn't be started."), |
993 /* Check if there is a previously open conversation */ | 1020 /* Check if there is a previously open conversation */ |
994 if (bb->conversation == NULL) | 1021 if (bb->conversation == NULL) |
995 { | 1022 { |
996 PurpleProxyConnectData *connect_data; | 1023 PurpleProxyConnectData *connect_data; |
997 PurpleProxyInfo *proxy_info; | 1024 PurpleProxyInfo *proxy_info; |
998 /* For better or worse, use the first IP*/ | 1025 const char *ip = bb->ips->data; /* Start with the first IP address. */ |
999 const char *ip = bb->ips->data; | 1026 |
1000 | 1027 purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n", to, ip, bb->port_p2pj); |
1001 purple_debug_info("bonjour", "Starting conversation with %s\n", to); | |
1002 | 1028 |
1003 /* Make sure that the account always has a proxy of "none". | 1029 /* Make sure that the account always has a proxy of "none". |
1004 * This is kind of dirty, but proxy_connect_none() isn't exposed. */ | 1030 * This is kind of dirty, but proxy_connect_none() isn't exposed. */ |
1005 proxy_info = purple_account_get_proxy_info(jdata->account); | 1031 proxy_info = purple_account_get_proxy_info(jdata->account); |
1006 if (proxy_info == NULL) { | 1032 if (proxy_info == NULL) { |