Mercurial > pidgin
comparison libpurple/protocols/bonjour/mdns_avahi.c @ 32672:3828a61c44da
A boring and large patch so I can merge heads.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 23 Dec 2011 08:21:58 +0000 |
parents | 9c8b28dc6656 |
children |
comparison
equal
deleted
inserted
replaced
32671:0e69949b3e61 | 32672:3828a61c44da |
---|---|
177 | 177 |
178 /* Get the ip as a string */ | 178 /* Get the ip as a string */ |
179 ip[0] = '\0'; | 179 ip[0] = '\0'; |
180 avahi_address_snprint(ip, AVAHI_ADDRESS_STR_MAX, a); | 180 avahi_address_snprint(ip, AVAHI_ADDRESS_STR_MAX, a); |
181 | 181 |
182 if (protocol == AVAHI_PROTO_INET6) | |
183 append_iface_if_linklocal(ip, interface); | |
184 | |
182 purple_debug_info("bonjour", "_resolve_callback - name:%s ip:%s prev_ip:%s\n", | 185 purple_debug_info("bonjour", "_resolve_callback - name:%s ip:%s prev_ip:%s\n", |
183 name, ip, rd->ip); | 186 name, ip, rd->ip); |
184 | 187 |
185 if (rd->ip == NULL || strcmp(rd->ip, ip) != 0) { | 188 if (rd->ip == NULL || strcmp(rd->ip, ip) != 0) { |
186 /* We store duplicates in bb->ips, so we always remove the one */ | 189 /* We store duplicates in bb->ips, so we always remove the one */ |
188 bb->ips = g_slist_remove(bb->ips, rd->ip); | 191 bb->ips = g_slist_remove(bb->ips, rd->ip); |
189 g_free((gchar *) rd->ip); | 192 g_free((gchar *) rd->ip); |
190 } | 193 } |
191 /* IPv6 goes at the front of the list and IPv4 at the end so that we "prefer" IPv6, if present */ | 194 /* IPv6 goes at the front of the list and IPv4 at the end so that we "prefer" IPv6, if present */ |
192 if (protocol == AVAHI_PROTO_INET6) { | 195 if (protocol == AVAHI_PROTO_INET6) { |
193 rd->ip = g_strdup_printf("%s%%%d", ip, interface); | 196 rd->ip = g_strdup_printf("%s", ip); |
194 bb->ips = g_slist_prepend(bb->ips, (gchar *) rd->ip); | 197 bb->ips = g_slist_prepend(bb->ips, (gchar *) rd->ip); |
195 } else { | 198 } else { |
196 rd->ip = g_strdup(ip); | 199 rd->ip = g_strdup(ip); |
197 bb->ips = g_slist_append(bb->ips, (gchar *) rd->ip); | 200 bb->ips = g_slist_append(bb->ips, (gchar *) rd->ip); |
198 } | 201 } |
613 buddy->mdns_impl_data = NULL; | 616 buddy->mdns_impl_data = NULL; |
614 } | 617 } |
615 | 618 |
616 void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { | 619 void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { |
617 PurpleConnection *conn = purple_account_get_connection(buddy->account); | 620 PurpleConnection *conn = purple_account_get_connection(buddy->account); |
618 BonjourData *bd = conn->proto_data; | 621 BonjourData *bd = purple_connection_get_protocol_data(conn); |
619 AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; | 622 AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; |
620 AvahiBuddyImplData *idata = buddy->mdns_impl_data; | 623 AvahiBuddyImplData *idata = buddy->mdns_impl_data; |
621 gchar *name; | 624 gchar *name; |
622 | 625 |
623 g_return_if_fail(idata != NULL); | 626 g_return_if_fail(idata != NULL); |