libpurple/protocols/bonjour/mdns_avahi.c

Wed, 13 May 2009 20:29:03 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Wed, 13 May 2009 20:29:03 +0000
changeset 27110
05ca719b901b
parent 24938
fc6952107e1f
child 27162
fefeaa2bfa0f
permissions
-rw-r--r--

Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.

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;
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
118 int ret;
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
119 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
120 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
121 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
122 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
123
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
125
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
126 pb = purple_find_buddy(account, name);
24938
fc6952107e1f Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents: 23140
diff changeset
127 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
128
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
129 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
130 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
131 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
132 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
133
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
134 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
135 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
136 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
137 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
138 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
139 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
140 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
141
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 /* 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
143 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
144 _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
145
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
146 /* 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
147 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
148 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
149 }
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
150 }
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
151 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
152 case AVAHI_RESOLVER_FOUND:
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
153 /* 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
154 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
155 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
156 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
157
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
158 /* 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
159 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
160 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170
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 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
172 }
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
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
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
175 /* Get the ip as a string */
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 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
177
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
178 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
179 /* 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
180 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
181 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
182 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
183 }
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
184 bb->ips = g_slist_prepend(bb->ips, g_strdup(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
185 rd->ip = bb->ips->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
186 }
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
187
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
188 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
189
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
190 /* 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
191 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
192 for(l = txt; l != NULL; l = l->next) {
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
193 if ((ret = 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
194 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
195 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
196 /* 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
197 * 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
198 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
199 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
200 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
201
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
202 if (!bonjour_buddy_check(bb)) {
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
203 _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
204 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
205 /* 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
206 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
207 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
208 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
209 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
210 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
211 }
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
212 } 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
213 /* 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
214 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
215
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
217 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
218 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
219 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
220
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
221 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
222
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
223 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
224 _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
225 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
226 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
227 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
228
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
230 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
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 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
233 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
234 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
235 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
236 /* 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
237 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
238 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
239 /* 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
240 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
241 /* Make sure it isn't us */
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
242 if (purple_utf8_strcasecmp(name, account->username) != 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
243 if (!avahi_service_resolver_new(avahi_service_browser_get_client(b),
21720
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21612
diff changeset
244 interface, protocol, name, type, domain, AVAHI_PROTO_INET,
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
245 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
246 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
247 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
248 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
251 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
252 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
253 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
254 if (pb != NULL) {
24938
fc6952107e1f Finished moving to api for bonjour
Gary Kramlich <grim@reaperworld.com>
parents: 23140
diff changeset
255 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
256 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
257 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
258 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
259
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
260 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
261
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
262 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
263
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
264 /* 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
265
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
266 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
267 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
268 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
269 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
270 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
271 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
272
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 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
274
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 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
276
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 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
278 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
279 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
280 /* 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
281 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
282 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
283 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
284 }
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 _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
286
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 /* 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
288 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
289 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
290 }
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
291 }
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
292 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
293 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
294 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
295 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
296 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
297 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
298 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
299 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
300
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
301 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
302 _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
303 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
304 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
305
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
306 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
307
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
308 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
309 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
310 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
311 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
312 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 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
322 }
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 }
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
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 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
327 _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
328 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
329
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
330 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
331
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
332 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
333 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
334 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
335 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
336 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
337 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
338 /* 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
339 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
340 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
341 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
342 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
343 /* 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
344 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
345 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
346 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
347 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
348 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
352 static void
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
353 _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
354 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
355 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
356 BonjourBuddy *buddy = userdata;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
357 AvahiBuddyImplData *idata = buddy->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
358
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
359 switch (event) {
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
360 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
361 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
362 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
363 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
364 case AVAHI_BROWSER_CACHE_EXHAUSTED:
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
365 case AVAHI_BROWSER_ALL_FOR_NOW:
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
366 case AVAHI_BROWSER_FAILURE:
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
367 purple_debug_error("bonjour", "Error rerieving buddy icon record: %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
368 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
369 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
370 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
371
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
372 /* 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
373 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
374 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
375 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
376 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
377 }
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
378
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
379 /****************************
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
380 * 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
381 ****************************/
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
382
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
383 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
384 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
385 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
386 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
387
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
388 /* 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
389 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
390
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
391 /* 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
392 * 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
393
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
394 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
395
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
396 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
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 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
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 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
401 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
402 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
403 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
404 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
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
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
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 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
410 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
19221
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
412 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
413 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
414 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
415 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
416
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
418
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
419 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
420 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
421 _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
422 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
423 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
424 "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
425 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
426 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
427 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
428 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
19221
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
430 while (records) {
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
431 PurpleKeyValuePair *kvp = records->data;
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
432 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
433 records = records->next;
29e6dd223bc5 Yay for code reuse.
Daniel Atallah <datallah@pidgin.im>
parents: 19220
diff changeset
434 }
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
435
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 /* 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
437 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
438 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
439 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
440 idata->group, AVAHI_IF_UNSPEC,
21720
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21612
diff changeset
441 AVAHI_PROTO_INET, 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
442 purple_account_get_username(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
443 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
444 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
445 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
446 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
447 idata->group, AVAHI_IF_UNSPEC,
21720
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21612
diff changeset
448 AVAHI_PROTO_INET, 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
449 purple_account_get_username(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
450 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
451 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
452 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
453
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
454 /* 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
455 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
456
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
458 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
459 "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
460 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
461 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
462 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
463
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
464 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
465 && (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
466 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
467 "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
468 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
469 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
470 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
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
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
476 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
477
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
479
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
480 idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, 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
481 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
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 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
484 "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
485 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
486 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
487 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 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
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
19206
ed0343b92c15 Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
492 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
493 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
494
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
495 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
496 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
497
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
498 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
499 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
500 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
501 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
502 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
503
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
504 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
505 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
506 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
507
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
508 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
509 _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
510 } 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
511 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
512 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
513 }
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->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
516 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
517 "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
518 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
519 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
520 }
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
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
522 svc_name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local",
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
523 purple_account_get_username(data->account));
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
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 ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC,
21720
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21612
diff changeset
526 AVAHI_PROTO_INET, 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
527 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
528
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 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
530
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 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
532 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
533 "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
534 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
535 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
536 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
537 }
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 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
539 }
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 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
542 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
543 "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
544 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
545 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
546 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
547 }
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 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
549 }
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 } 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
551 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
552 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
553 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
554 }
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
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 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
557 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
558
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
559 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
560 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
561
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
562 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
563 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
564
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
565 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
566 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
567
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
568 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
569 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
570
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
571 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
572
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
573 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
574 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
575
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <datallah@pidgin.im>
parents:
diff changeset
576 void _mdns_init_buddy(BonjourBuddy *buddy) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
577 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
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
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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 void _mdns_delete_buddy(BonjourBuddy *buddy) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
581 AvahiBuddyImplData *idata = buddy->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
582
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
583 g_return_if_fail(idata != NULL);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
584
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
585 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
586 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
587
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
588 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
589 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
590 _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
591 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
592 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
593
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
594 g_free(idata);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
595
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
596 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
597 }
28880833384b Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more 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
19210
4dcb230b1dbd _mdns_retrieve_retrieve_buddy_icon() - what kind of crack am I on anyway?
Daniel Atallah <datallah@pidgin.im>
parents: 19209
diff changeset
599 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
600 PurpleConnection *conn = purple_account_get_connection(buddy->account);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
601 BonjourData *bd = conn->proto_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
602 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
603 AvahiBuddyImplData *idata = buddy->mdns_impl_data;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
604 gchar *name;
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
605
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
606 g_return_if_fail(idata != NULL);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
607
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
608 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
609 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
610
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
611 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
612
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
613 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
614 idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC,
21720
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21612
diff changeset
615 AVAHI_PROTO_INET, 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
616 _buddy_icon_record_cb, buddy);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
617 g_free(name);
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
618
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
619 if (!idata->buddy_icon_rec_browser) {
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
620 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
621 "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
622 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
623 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
624
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
625 }
19131
56cccfe5743e Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <datallah@pidgin.im>
parents: 19100
diff changeset
626

mercurial