libpurple/protocols/bonjour/mdns_avahi.c

Fri, 23 Dec 2011 08:21:58 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Fri, 23 Dec 2011 08:21:58 +0000
branch
cpw.qulogic.gtk3
changeset 32438
dc8991868906
parent 30825
87a79bbdc985
permissions
-rw-r--r--

A boring and large patch so I can merge heads.

19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
1 /*
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
2 * This program is free software; you can redistribute it and/or modify
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
3 * it under the terms of the GNU General Public License as published by
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
4 * the Free Software Foundation; either version 2 of the License, or
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
5 * (at your option) any later version.
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
6 *
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
7 * This program is distributed in the hope that it will be useful,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
10 * GNU Library General Public License for more details.
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
11 *
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
12 * You should have received a copy of the GNU General Public License
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
13 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19832
diff changeset
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
15 */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
16
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
17 #include "internal.h"
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
18
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
19 #include "mdns_interface.h"
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
20 #include "debug.h"
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
21 #include "buddy.h"
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
22 #include "bonjour.h"
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
23
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
24 #include <avahi-client/client.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
25 #include <avahi-client/lookup.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
26 #include <avahi-client/publish.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
27
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
28 #include <avahi-common/address.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
29 #include <avahi-common/malloc.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
30 #include <avahi-common/error.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
31 #include <avahi-common/strlst.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
32
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
33 #include <avahi-glib/glib-malloc.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
34 #include <avahi-glib/glib-watch.h>
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
35
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
36 /* Avahi only defines the types that it actually uses (which at this time doesn't include NULL) */
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
37 #ifndef AVAHI_DNS_TYPE_NULL
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
38 #define AVAHI_DNS_TYPE_NULL 0x0A
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
39 #endif
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
40
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
41 /* data used by avahi bonjour implementation */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
42 typedef struct _avahi_session_impl_data {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
43 AvahiClient *client;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
44 AvahiGLibPoll *glib_poll;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
45 AvahiServiceBrowser *sb;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
46 AvahiEntryGroup *group;
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
47 AvahiEntryGroup *buddy_icon_group;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
48 } AvahiSessionImplData;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
49
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
50 typedef struct _avahi_buddy_service_resolver_data {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
51 AvahiServiceResolver *resolver;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
52 AvahiIfIndex interface;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
53 AvahiProtocol protocol;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
54 gchar *name;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
55 gchar *type;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
56 gchar *domain;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
57 /* This is a reference to the entry in BonjourBuddy->ips */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
58 const char *ip;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
59 } AvahiSvcResolverData;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
60
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
61 typedef struct _avahi_buddy_impl_data {
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
62 GSList *resolvers;
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
63 AvahiRecordBrowser *buddy_icon_rec_browser;
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
64 } AvahiBuddyImplData;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
65
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
66 static gint
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
67 _find_resolver_data(gconstpointer a, gconstpointer b) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
68 const AvahiSvcResolverData *rd_a = a;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
69 const AvahiSvcResolverData *rd_b = b;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
70 gint ret = 1;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
71
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
72 if(rd_a->interface == rd_b->interface
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
73 && rd_a->protocol == rd_b->protocol
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
74 && !strcmp(rd_a->name, rd_b->name)
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
75 && !strcmp(rd_a->type, rd_b->type)
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
76 && !strcmp(rd_a->domain, rd_b->domain)) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
77 ret = 0;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
78 }
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
79
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
80 return ret;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
81 }
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
82
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
83 static gint
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
84 _find_resolver_data_by_resolver(gconstpointer a, gconstpointer b) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
85 const AvahiSvcResolverData *rd_a = a;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
86 const AvahiServiceResolver *resolver = b;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
87 gint ret = 1;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
88
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
89 if(rd_a->resolver == resolver)
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
90 ret = 0;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
91
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
92 return ret;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
93 }
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
94
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
95 static void
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
96 _cleanup_resolver_data(AvahiSvcResolverData *rd) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
97 if (rd->resolver)
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
98 avahi_service_resolver_free(rd->resolver);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
99 g_free(rd->name);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
100 g_free(rd->type);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
101 g_free(rd->domain);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
102 g_free(rd);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
103 }
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
104
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
105
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
106 static void
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
107 _resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
108 AvahiResolverEvent event, const char *name, const char *type, const char *domain,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
109 const char *host_name, const AvahiAddress *a, uint16_t port, AvahiStringList *txt,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
110 AvahiLookupResultFlags flags, void *userdata) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
111
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
112 PurpleBuddy *pb;
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
113 BonjourBuddy *bb;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
114 PurpleAccount *account = userdata;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
115 AvahiStringList *l;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
116 size_t size;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
117 char *key, *value;
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
118 char ip[AVAHI_ADDRESS_STR_MAX];
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
119 AvahiBuddyImplData *b_impl;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
120 AvahiSvcResolverData *rd;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
121 GSList *res;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
122
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
123 g_return_if_fail(r != NULL);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
124
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
125 pb = purple_find_buddy(account, name);
24938
fc6952107e1f Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents: 23140
diff changeset
126 bb = (pb != NULL) ? purple_buddy_get_protocol_data(pb) : NULL;
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
127
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
128 switch (event) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
129 case AVAHI_RESOLVER_FAILURE:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
130 purple_debug_error("bonjour", "_resolve_callback - Failure: %s\n",
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
131 avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r))));
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
132
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
133 avahi_service_resolver_free(r);
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
134 if (bb != NULL) {
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
135 b_impl = bb->mdns_impl_data;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
136 res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
137 if (res != NULL) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
138 rd = res->data;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
139 b_impl->resolvers = g_slist_remove_link(b_impl->resolvers, res);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
140
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
141 /* We've already freed the resolver */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
142 rd->resolver = NULL;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
143 _cleanup_resolver_data(rd);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
144
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
145 /* If this was the last resolver, remove the buddy */
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
146 if (b_impl->resolvers == NULL)
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
147 bonjour_buddy_signed_off(pb);
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
148 }
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
149 }
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
150 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
151 case AVAHI_RESOLVER_FOUND:
28826
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
152
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
153 purple_debug_info("bonjour", "_resolve_callback - name:%s account:%p bb:%p\n",
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
154 name, account, bb);
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
155
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
156 /* create a buddy record */
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
157 if (bb == NULL)
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
158 bb = bonjour_buddy_new(name, account);
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
159 b_impl = bb->mdns_impl_data;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
160
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
161 /* If we're reusing an existing buddy, it may be a new resolver or an existing one. */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
162 res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
163 if (res != NULL)
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
164 rd = res->data;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
165 else {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
166 rd = g_new0(AvahiSvcResolverData, 1);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
167 rd->resolver = r;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
168 rd->interface = interface;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
169 rd->protocol = protocol;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
170 rd->name = g_strdup(name);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
171 rd->type = g_strdup(type);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
172 rd->domain = g_strdup(domain);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
173
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
174 b_impl->resolvers = g_slist_prepend(b_impl->resolvers, rd);
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
175 }
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
176
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
177
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
178 /* Get the ip as a string */
28826
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
179 ip[0] = '\0';
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
180 avahi_address_snprint(ip, AVAHI_ADDRESS_STR_MAX, a);
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
181
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30825
diff changeset
182 if (protocol == AVAHI_PROTO_INET6)
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30825
diff changeset
183 append_iface_if_linklocal(ip, interface);
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30825
diff changeset
184
28826
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
185 purple_debug_info("bonjour", "_resolve_callback - name:%s ip:%s prev_ip:%s\n",
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
186 name, ip, rd->ip);
4018b0013b94 Add some additional debug output to the avahi mdns implemenation.
Daniel Atallah <datallah@pidgin.im>
parents: 28077
diff changeset
187
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
188 if (rd->ip == NULL || strcmp(rd->ip, ip) != 0) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
189 /* We store duplicates in bb->ips, so we always remove the one */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
190 if (rd->ip != NULL) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
191 bb->ips = g_slist_remove(bb->ips, rd->ip);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
192 g_free((gchar *) rd->ip);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
193 }
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
194 /* IPv6 goes at the front of the list and IPv4 at the end so that we "prefer" IPv6, if present */
30791
560b4f6da5d1 Specify an IPv6 scope on the IP address being used to reference a Bonjour Buddy.
Daniel Atallah <datallah@pidgin.im>
parents: 30626
diff changeset
195 if (protocol == AVAHI_PROTO_INET6) {
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30825
diff changeset
196 rd->ip = g_strdup_printf("%s", ip);
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
197 bb->ips = g_slist_prepend(bb->ips, (gchar *) rd->ip);
30791
560b4f6da5d1 Specify an IPv6 scope on the IP address being used to reference a Bonjour Buddy.
Daniel Atallah <datallah@pidgin.im>
parents: 30626
diff changeset
198 } else {
560b4f6da5d1 Specify an IPv6 scope on the IP address being used to reference a Bonjour Buddy.
Daniel Atallah <datallah@pidgin.im>
parents: 30626
diff changeset
199 rd->ip = g_strdup(ip);
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
200 bb->ips = g_slist_append(bb->ips, (gchar *) rd->ip);
30791
560b4f6da5d1 Specify an IPv6 scope on the IP address being used to reference a Bonjour Buddy.
Daniel Atallah <datallah@pidgin.im>
parents: 30626
diff changeset
201 }
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
202 }
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
203
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
204 bb->port_p2pj = port;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
205
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
206 /* Obtain the parameters from the text_record */
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
207 clear_bonjour_buddy_values(bb);
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
208 for(l = txt; l != NULL; l = l->next) {
30626
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29761
diff changeset
209 if (avahi_string_list_get_pair(l, &key, &value, &size) < 0)
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
210 continue;
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
211 set_bonjour_buddy_value(bb, key, value, size);
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
212 /* TODO: Since we're using the glib allocator, I think we
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
213 * can use the values instead of re-copying them */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
214 avahi_free(key);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
215 avahi_free(value);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
216 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
217
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
218 if (!bonjour_buddy_check(bb)) {
28077
c2b493e058f1 Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <darkrain42@pidgin.im>
parents: 27162
diff changeset
219 b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd);
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
220 _cleanup_resolver_data(rd);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
221 /* If this was the last resolver, remove the buddy */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
222 if (b_impl->resolvers == NULL) {
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
223 if (pb != NULL)
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
224 bonjour_buddy_signed_off(pb);
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
225 else
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
226 bonjour_buddy_delete(bb);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
227 }
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
228 } else
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
229 /* Add or update the buddy in our buddy list */
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
230 bonjour_buddy_add_to_purple(bb, pb);
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
231
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
232 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
233 default:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
234 purple_debug_info("bonjour", "Unrecognized Service Resolver event: %d.\n", event);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
235 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
236
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
237 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
238
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
239 static void
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
240 _browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interface,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
241 AvahiProtocol protocol, AvahiBrowserEvent event,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
242 const char *name, const char *type, const char *domain,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
243 AvahiLookupResultFlags flags, void *userdata) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
244
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
245 PurpleAccount *account = userdata;
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
246 PurpleBuddy *pb = NULL;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
247
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
248 switch (event) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
249 case AVAHI_BROWSER_FAILURE:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
250 purple_debug_error("bonjour", "_browser_callback - Failure: %s\n",
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
251 avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
252 /* TODO: This is an error that should be handled. */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
253 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
254 case AVAHI_BROWSER_NEW:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
255 /* A new peer has joined the network and uses iChat bonjour */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
256 purple_debug_info("bonjour", "_browser_callback - new service\n");
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
257 /* Make sure it isn't us */
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30791
diff changeset
258 if (purple_utf8_strcasecmp(name, bonjour_get_jid(account)) != 0) {
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
259 if (!avahi_service_resolver_new(avahi_service_browser_get_client(b),
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
260 interface, protocol, name, type, domain, protocol,
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
261 0, _resolver_callback, account)) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
262 purple_debug_warning("bonjour", "_browser_callback -- Error initiating resolver: %s\n",
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
263 avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
264 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
265 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
266 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
267 case AVAHI_BROWSER_REMOVE:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
268 purple_debug_info("bonjour", "_browser_callback - Remove service\n");
19748
ae5eab65f8de Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents: 19221
diff changeset
269 pb = purple_find_buddy(account, name);
21612
9fce536735e3 Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
270 if (pb != NULL) {
24938
fc6952107e1f Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents: 23140
diff changeset
271 BonjourBuddy *bb = purple_buddy_get_protocol_data(pb);
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
272 AvahiBuddyImplData *b_impl;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
273 GSList *l;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
274 AvahiSvcResolverData *rd_search;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
275
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
276 g_return_if_fail(bb != NULL);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
277
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
278 b_impl = bb->mdns_impl_data;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
279
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
280 /* There may be multiple presences, we should only get rid of this one */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
281
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
282 rd_search = g_new0(AvahiSvcResolverData, 1);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
283 rd_search->interface = interface;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
284 rd_search->protocol = protocol;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
285 rd_search->name = (gchar *) name;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
286 rd_search->type = (gchar *) type;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
287 rd_search->domain = (gchar *) domain;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
288
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
289 l = g_slist_find_custom(b_impl->resolvers, rd_search, _find_resolver_data);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
290
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
291 g_free(rd_search);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
292
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
293 if (l != NULL) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
294 AvahiSvcResolverData *rd = l->data;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
295 b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
296 /* This IP is no longer available */
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
297 if (rd->ip != NULL) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
298 bb->ips = g_slist_remove(bb->ips, rd->ip);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
299 g_free((gchar *) rd->ip);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
300 }
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
301 _cleanup_resolver_data(rd);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
302
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
303 /* If this was the last resolver, remove the buddy */
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
304 if (b_impl->resolvers == NULL)
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 22175
diff changeset
305 bonjour_buddy_signed_off(pb);
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
306 }
21612
9fce536735e3 Various bugfixes including using purple_account_remove_buddy() in addition to purple_blist_remove_buddy() to make sure that the buddy gets cleaned up fully when logging out or we go offline.
Daniel Atallah <datallah@pidgin.im>
parents: 19859
diff changeset
307 }
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
308 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
309 case AVAHI_BROWSER_ALL_FOR_NOW:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
310 case AVAHI_BROWSER_CACHE_EXHAUSTED:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
311 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
312 default:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
313 purple_debug_info("bonjour", "Unrecognized Service browser event: %d.\n", event);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
314 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
315 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
316
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
317 static void
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
318 _buddy_icon_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
319 BonjourDnsSd *data = userdata;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
320 AvahiSessionImplData *idata = data->mdns_impl_data;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
321
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
322 g_return_if_fail(g == idata->buddy_icon_group || idata->buddy_icon_group == NULL);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
323
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
324 switch(state) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
325 case AVAHI_ENTRY_GROUP_ESTABLISHED:
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
326 purple_debug_info("bonjour", "Successfully registered buddy icon data.\n");
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
327 break;
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
328 case AVAHI_ENTRY_GROUP_COLLISION:
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
329 purple_debug_error("bonjour", "Collision registering buddy icon data.\n");
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
330 break;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
331 case AVAHI_ENTRY_GROUP_FAILURE:
19832
84b69b21672b Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19748
diff changeset
332 purple_debug_error("bonjour", "Error registering buddy icon data: %s.\n",
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
333 avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))));
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
334 break;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
335 case AVAHI_ENTRY_GROUP_UNCOMMITED:
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
336 case AVAHI_ENTRY_GROUP_REGISTERING:
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
337 break;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
338 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
339
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
340 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
341
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
342 static void
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
343 _entry_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
344 AvahiSessionImplData *idata = userdata;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
345
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
346 g_return_if_fail(g == idata->group || idata->group == NULL);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
347
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
348 switch(state) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
349 case AVAHI_ENTRY_GROUP_ESTABLISHED:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
350 purple_debug_info("bonjour", "Successfully registered service.\n");
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
351 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
352 case AVAHI_ENTRY_GROUP_COLLISION:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
353 purple_debug_error("bonjour", "Collision registering entry group.\n");
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
354 /* TODO: Handle error - this should log out the account. (Possibly with "wants to die")*/
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
355 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
356 case AVAHI_ENTRY_GROUP_FAILURE:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
357 purple_debug_error("bonjour", "Error registering entry group: %s\n.",
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
358 avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
359 /* TODO: Handle error - this should log out the account.*/
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
360 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
361 case AVAHI_ENTRY_GROUP_UNCOMMITED:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
362 case AVAHI_ENTRY_GROUP_REGISTERING:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
363 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
364 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
365
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
366 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
367
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
368 static void
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
369 _buddy_icon_record_cb(AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol,
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
370 AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type,
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
371 const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata) {
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
372 BonjourBuddy *buddy = userdata;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
373 AvahiBuddyImplData *idata = buddy->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
374
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
375 switch (event) {
27162
fefeaa2bfa0f Correctly ignore Avahi's informational events when querying records for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24938
diff changeset
376 case AVAHI_BROWSER_CACHE_EXHAUSTED:
fefeaa2bfa0f Correctly ignore Avahi's informational events when querying records for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24938
diff changeset
377 case AVAHI_BROWSER_ALL_FOR_NOW:
fefeaa2bfa0f Correctly ignore Avahi's informational events when querying records for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24938
diff changeset
378 /* Ignore these "meta" informational events */
fefeaa2bfa0f Correctly ignore Avahi's informational events when querying records for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24938
diff changeset
379 return;
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
380 case AVAHI_BROWSER_NEW:
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
381 bonjour_buddy_got_buddy_icon(buddy, rdata, size);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
382 break;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
383 case AVAHI_BROWSER_REMOVE:
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
384 case AVAHI_BROWSER_FAILURE:
27162
fefeaa2bfa0f Correctly ignore Avahi's informational events when querying records for the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24938
diff changeset
385 purple_debug_error("bonjour", "Error retrieving buddy icon record: %s\n",
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
386 avahi_strerror(avahi_client_errno(avahi_record_browser_get_client(b))));
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
387 break;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
388 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
389
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
390 /* Stop listening */
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
391 avahi_record_browser_free(b);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
392 if (idata->buddy_icon_rec_browser == b) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
393 idata->buddy_icon_rec_browser = NULL;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
394 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
395 }
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
396
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
397 /****************************
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
398 * mdns_interface functions *
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
399 ****************************/
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
400
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
401 gboolean _mdns_init_session(BonjourDnsSd *data) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
402 AvahiSessionImplData *idata = g_new0(AvahiSessionImplData, 1);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
403 const AvahiPoll *poll_api;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
404 int error;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
405
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
406 /* Tell avahi to use g_malloc and g_free */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
407 avahi_set_allocator (avahi_glib_allocator ());
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
408
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
409 /* This currently depends on the glib mainloop,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
410 * we should make it use the libpurple abstraction */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
411
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
412 idata->glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
413
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
414 poll_api = avahi_glib_poll_get(idata->glib_poll);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
415
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
416 idata->client = avahi_client_new(poll_api, 0, NULL, data, &error);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
417
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
418 if (idata->client == NULL) {
19832
84b69b21672b Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19748
diff changeset
419 purple_debug_error("bonjour", "Error initializing Avahi: %s\n", avahi_strerror(error));
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
420 avahi_glib_poll_free(idata->glib_poll);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
421 g_free(idata);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
422 return FALSE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
423 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
424
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
425 data->mdns_impl_data = idata;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
426
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30791
diff changeset
427 bonjour_dns_sd_set_jid(data->account, avahi_client_get_host_name(idata->client));
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30791
diff changeset
428
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
429 return TRUE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
430 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
431
19221
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
432 gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records) {
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
433 int publish_result = 0;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
434 AvahiSessionImplData *idata = data->mdns_impl_data;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
435 AvahiStringList *lst = NULL;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
436
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
437 g_return_val_if_fail(idata != NULL, FALSE);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
438
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
439 if (!idata->group) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
440 idata->group = avahi_entry_group_new(idata->client,
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
441 _entry_group_cb, idata);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
442 if (!idata->group) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
443 purple_debug_error("bonjour",
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
444 "Unable to initialize the data for the mDNS (%s).\n",
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
445 avahi_strerror(avahi_client_errno(idata->client)));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
446 return FALSE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
447 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
448 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
449
19221
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
450 while (records) {
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
451 PurpleKeyValuePair *kvp = records->data;
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
452 lst = avahi_string_list_add_pair(lst, kvp->key, kvp->value);
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
453 records = records->next;
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
454 }
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
455
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
456 /* Publish the service */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
457 switch (type) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
458 case PUBLISH_START:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
459 publish_result = avahi_entry_group_add_service_strlst(
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
460 idata->group, AVAHI_IF_UNSPEC,
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
461 AVAHI_PROTO_UNSPEC, 0,
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30791
diff changeset
462 bonjour_get_jid(data->account),
22175
fe24624d2a07 Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
Daniel Atallah <datallah@pidgin.im>
parents: 21920
diff changeset
463 LINK_LOCAL_RECORD_NAME, NULL, NULL, data->port_p2pj, lst);
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
464 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
465 case PUBLISH_UPDATE:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
466 publish_result = avahi_entry_group_update_service_txt_strlst(
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
467 idata->group, AVAHI_IF_UNSPEC,
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
468 AVAHI_PROTO_UNSPEC, 0,
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30791
diff changeset
469 bonjour_get_jid(data->account),
22175
fe24624d2a07 Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
Daniel Atallah <datallah@pidgin.im>
parents: 21920
diff changeset
470 LINK_LOCAL_RECORD_NAME, NULL, lst);
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
471 break;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
472 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
473
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
474 /* Free the memory used by temp data */
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
475 avahi_string_list_free(lst);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
476
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
477 if (publish_result < 0) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
478 purple_debug_error("bonjour",
22175
fe24624d2a07 Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
Daniel Atallah <datallah@pidgin.im>
parents: 21920
diff changeset
479 "Failed to add the " LINK_LOCAL_RECORD_NAME " service. Error: %s\n",
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
480 avahi_strerror(publish_result));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
481 return FALSE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
482 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
483
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
484 if (type == PUBLISH_START
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
485 && (publish_result = avahi_entry_group_commit(idata->group)) < 0) {
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
486 purple_debug_error("bonjour",
22175
fe24624d2a07 Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
Daniel Atallah <datallah@pidgin.im>
parents: 21920
diff changeset
487 "Failed to commit " LINK_LOCAL_RECORD_NAME " service. Error: %s\n",
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
488 avahi_strerror(publish_result));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
489 return FALSE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
490 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
491
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
492 return TRUE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
493 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
494
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
495 gboolean _mdns_browse(BonjourDnsSd *data) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
496 AvahiSessionImplData *idata = data->mdns_impl_data;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
497
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
498 g_return_val_if_fail(idata != NULL, FALSE);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
499
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
500 idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, LINK_LOCAL_RECORD_NAME, NULL, 0, _browser_callback, data->account);
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
501 if (!idata->sb) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
502
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
503 purple_debug_error("bonjour",
19832
84b69b21672b Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19748
diff changeset
504 "Unable to initialize service browser. Error: %s.\n",
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
505 avahi_strerror(avahi_client_errno(idata->client)));
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
506 return FALSE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
507 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
508
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
509 return TRUE;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
510 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
511
19206
ed0343b92c15 Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
512 gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) {
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
513 AvahiSessionImplData *idata = data->mdns_impl_data;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
514
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
515 if (idata == NULL || idata->client == NULL)
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
516 return FALSE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
517
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
518 if (avatar_data != NULL) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
519 gboolean new_group = FALSE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
520 gchar *svc_name;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
521 int ret;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
522 AvahiPublishFlags flags = 0;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
523
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
524 if (idata->buddy_icon_group == NULL) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
525 purple_debug_info("bonjour", "Setting new buddy icon.\n");
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
526 new_group = TRUE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
527
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
528 idata->buddy_icon_group = avahi_entry_group_new(idata->client,
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
529 _buddy_icon_group_cb, data);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
530 } else {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
531 purple_debug_info("bonjour", "Updating existing buddy icon.\n");
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
532 flags |= AVAHI_PUBLISH_UPDATE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
533 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
534
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
535 if (idata->buddy_icon_group == NULL) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
536 purple_debug_error("bonjour",
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
537 "Unable to initialize the buddy icon group (%s).\n",
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
538 avahi_strerror(avahi_client_errno(idata->client)));
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
539 return FALSE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
540 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
541
22175
fe24624d2a07 Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
Daniel Atallah <datallah@pidgin.im>
parents: 21920
diff changeset
542 svc_name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local",
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30791
diff changeset
543 bonjour_get_jid(data->account));
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
544
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
545 ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC,
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
546 AVAHI_PROTO_UNSPEC, flags, svc_name,
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
547 AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
548
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
549 g_free(svc_name);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
550
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
551 if (ret < 0) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
552 purple_debug_error("bonjour",
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
553 "Failed to register buddy icon. Error: %s\n", avahi_strerror(ret));
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
554 if (new_group) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
555 avahi_entry_group_free(idata->buddy_icon_group);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
556 idata->buddy_icon_group = NULL;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
557 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
558 return FALSE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
559 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
560
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
561 if (new_group && (ret = avahi_entry_group_commit(idata->buddy_icon_group)) < 0) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
562 purple_debug_error("bonjour",
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
563 "Failed to commit buddy icon group. Error: %s\n", avahi_strerror(ret));
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
564 if (new_group) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
565 avahi_entry_group_free(idata->buddy_icon_group);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
566 idata->buddy_icon_group = NULL;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
567 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
568 return FALSE;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
569 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
570 } else if (idata->buddy_icon_group != NULL) {
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
571 purple_debug_info("bonjour", "Removing existing buddy icon.\n");
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
572 avahi_entry_group_free(idata->buddy_icon_group);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
573 idata->buddy_icon_group = NULL;
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
574 }
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
575
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
576 return TRUE;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
577 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
578
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
579 void _mdns_stop(BonjourDnsSd *data) {
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
580 AvahiSessionImplData *idata = data->mdns_impl_data;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
581
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
582 if (idata == NULL || idata->client == NULL)
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
583 return;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
584
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
585 if (idata->sb != NULL)
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
586 avahi_service_browser_free(idata->sb);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
587
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
588 avahi_client_free(idata->client);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
589 avahi_glib_poll_free(idata->glib_poll);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
590
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
591 g_free(idata);
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
592
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
593 data->mdns_impl_data = NULL;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
594 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
595
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
596 void _mdns_init_buddy(BonjourBuddy *buddy) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
597 buddy->mdns_impl_data = g_new0(AvahiBuddyImplData, 1);
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
598 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
599
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
600 void _mdns_delete_buddy(BonjourBuddy *buddy) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
601 AvahiBuddyImplData *idata = buddy->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
602
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
603 g_return_if_fail(idata != NULL);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
604
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
605 if (idata->buddy_icon_rec_browser != NULL)
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
606 avahi_record_browser_free(idata->buddy_icon_rec_browser);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
607
21920
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
608 while(idata->resolvers != NULL) {
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
609 AvahiSvcResolverData *rd = idata->resolvers->data;
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
610 _cleanup_resolver_data(rd);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
611 idata->resolvers = g_slist_delete_link(idata->resolvers, idata->resolvers);
3087a567aedf Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
612 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
613
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
614 g_free(idata);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
615
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
616 buddy->mdns_impl_data = NULL;
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
617 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
618
19210
4dcb230b1dbd _mdns_retrieve_retrieve_buddy_icon() - what kind of crack am I on anyway?
Daniel Atallah <datallah@pidgin.im>
parents: 19209
diff changeset
619 void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
620 PurpleConnection *conn = purple_account_get_connection(buddy->account);
32438
dc8991868906 A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30825
diff changeset
621 BonjourData *bd = purple_connection_get_protocol_data(conn);
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
622 AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
623 AvahiBuddyImplData *idata = buddy->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
624 gchar *name;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
625
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
626 g_return_if_fail(idata != NULL);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
627
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
628 if (idata->buddy_icon_rec_browser != NULL)
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
629 avahi_record_browser_free(idata->buddy_icon_rec_browser);
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
630
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
631 purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name);
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
632
22175
fe24624d2a07 Fix the _presence._tcp. record not to be referred to as the ICHAT_PRESENCE, that has been bothering me for a while.
Daniel Atallah <datallah@pidgin.im>
parents: 21920
diff changeset
633 name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", buddy->name);
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
634 idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC,
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 28826
diff changeset
635 AVAHI_PROTO_UNSPEC, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0,
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
636 _buddy_icon_record_cb, buddy);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
637 g_free(name);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
638
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
639 if (!idata->buddy_icon_rec_browser) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
640 purple_debug_error("bonjour",
19832
84b69b21672b Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19748
diff changeset
641 "Unable to initialize buddy icon record browser. Error: %s.\n",
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
642 avahi_strerror(avahi_client_errno(session_idata->client)));
19211
16a8e6193a3d Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <datallah@pidgin.im>
parents: 19210
diff changeset
643 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
644
19100
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
645 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
646

mercurial