Mercurial > pidgin
annotate libpurple/protocols/bonjour/mdns_avahi.c @ 18850:2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 09 Aug 2007 18:32:19 +0000 |
parents | 1787e601aafc |
children | f773aa054dca |
rev | line source |
---|---|
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
1 /* |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
2 * This program is free software; you can redistribute it and/or modify |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
3 * it under the terms of the GNU General Public License as published by |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
4 * the Free Software Foundation; either version 2 of the License, or |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
5 * (at your option) any later version. |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
6 * |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
7 * This program is distributed in the hope that it will be useful, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
10 * GNU Library General Public License for more details. |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
11 * |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
12 * You should have received a copy of the GNU General Public License |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
13 * along with this program; if not, write to the Free Software |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
15 */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
16 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
17 #include "internal.h" |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
18 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
19 #include "mdns_interface.h" |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
20 #include "debug.h" |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
21 #include "buddy.h" |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
22 #include "bonjour.h" |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
23 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
24 #include <avahi-client/client.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
25 #include <avahi-client/lookup.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
26 #include <avahi-client/publish.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
27 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
28 #include <avahi-common/address.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
29 #include <avahi-common/malloc.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
30 #include <avahi-common/error.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
31 #include <avahi-common/strlst.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
32 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
33 #include <avahi-glib/glib-malloc.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
34 #include <avahi-glib/glib-watch.h> |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
35 |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
36 /* For some reason, this is missing from the Avahi type defines */ |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
37 #ifndef AVAHI_DNS_TYPE_NULL |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
38 #define AVAHI_DNS_TYPE_NULL 0x0A |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
39 #endif |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
40 |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
41 /* data used by avahi bonjour implementation */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
42 typedef struct _avahi_session_impl_data { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
43 AvahiClient *client; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
44 AvahiGLibPoll *glib_poll; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
45 AvahiServiceBrowser *sb; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
46 AvahiEntryGroup *group; |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
47 AvahiEntryGroup *buddy_icon_group; |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
48 } AvahiSessionImplData; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
49 |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
50 typedef struct _avahi_buddy_impl_data { |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
51 AvahiServiceResolver *resolver; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
52 AvahiRecordBrowser *buddy_icon_rec_browser; |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
53 } AvahiBuddyImplData; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
54 |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
55 static void |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
56 _resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
57 AvahiResolverEvent event, const char *name, const char *type, const char *domain, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
58 const char *host_name, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
59 AvahiLookupResultFlags flags, void *userdata) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
60 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
61 BonjourBuddy *buddy; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
62 PurpleAccount *account = userdata; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
63 AvahiStringList *l; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
64 size_t size; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
65 char *key, *value; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
66 int ret; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
67 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
68 g_return_if_fail(r != NULL); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
69 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
70 switch (event) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
71 case AVAHI_RESOLVER_FAILURE: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
72 purple_debug_error("bonjour", "_resolve_callback - Failure: %s\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
73 avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r)))); |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
74 avahi_service_resolver_free(r); |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
75 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
76 case AVAHI_RESOLVER_FOUND: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
77 /* create a buddy record */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
78 buddy = bonjour_buddy_new(name, account); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
79 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
80 ((AvahiBuddyImplData *)buddy->mdns_impl_data)->resolver = r; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
81 |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
82 /* Get the ip as a string */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
83 buddy->ip = g_malloc(AVAHI_ADDRESS_STR_MAX); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
84 avahi_address_snprint(buddy->ip, AVAHI_ADDRESS_STR_MAX, a); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
85 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
86 buddy->port_p2pj = port; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
87 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
88 /* Obtain the parameters from the text_record */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
89 l = txt; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
90 while (l != NULL) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
91 ret = avahi_string_list_get_pair(l, &key, &value, &size); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
92 l = l->next; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
93 if (ret < 0) |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
94 continue; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
95 set_bonjour_buddy_value(buddy, key, value, size); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
96 /* TODO: Since we're using the glib allocator, I think we |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
97 * can use the values instead of re-copying them */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
98 avahi_free(key); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
99 avahi_free(value); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
100 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
101 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
102 if (!bonjour_buddy_check(buddy)) |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
103 bonjour_buddy_delete(buddy); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
104 else |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
105 /* Add or update the buddy in our buddy list */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
106 bonjour_buddy_add_to_purple(buddy); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
107 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
108 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
109 default: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
110 purple_debug_info("bonjour", "Unrecognized Service Resolver event: %d.\n", event); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
111 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
112 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
113 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
114 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
115 static void |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
116 _browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
117 AvahiProtocol protocol, AvahiBrowserEvent event, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
118 const char *name, const char *type, const char *domain, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
119 AvahiLookupResultFlags flags, void *userdata) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
120 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
121 PurpleAccount *account = userdata; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
122 PurpleBuddy *gb = NULL; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
123 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
124 switch (event) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
125 case AVAHI_BROWSER_FAILURE: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
126 purple_debug_error("bonjour", "_browser_callback - Failure: %s\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
127 avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
128 /* TODO: This is an error that should be handled. */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
129 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
130 case AVAHI_BROWSER_NEW: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
131 /* A new peer has joined the network and uses iChat bonjour */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
132 purple_debug_info("bonjour", "_browser_callback - new service\n"); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
133 /* Make sure it isn't us */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
134 if (g_ascii_strcasecmp(name, account->username) != 0) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
135 if (!avahi_service_resolver_new(avahi_service_browser_get_client(b), |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
136 interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
137 0, _resolver_callback, account)) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
138 purple_debug_warning("bonjour", "_browser_callback -- Error initiating resolver: %s\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
139 avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
140 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
141 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
142 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
143 case AVAHI_BROWSER_REMOVE: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
144 purple_debug_info("bonjour", "_browser_callback - Remove service\n"); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
145 gb = purple_find_buddy(account, name); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
146 if (gb != NULL) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
147 bonjour_buddy_delete(gb->proto_data); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
148 purple_blist_remove_buddy(gb); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
149 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
150 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
151 case AVAHI_BROWSER_ALL_FOR_NOW: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
152 case AVAHI_BROWSER_CACHE_EXHAUSTED: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
153 purple_debug_warning("bonjour", "(Browser) %s\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
154 event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW"); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
155 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
156 default: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
157 purple_debug_info("bonjour", "Unrecognized Service browser event: %d.\n", event); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
158 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
159 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
160 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
161 static void |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
162 _buddy_icon_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
163 BonjourDnsSd *data = userdata; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
164 AvahiSessionImplData *idata = data->mdns_impl_data; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
165 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
166 g_return_if_fail(g == idata->buddy_icon_group || idata->buddy_icon_group == NULL); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
167 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
168 switch(state) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
169 case AVAHI_ENTRY_GROUP_ESTABLISHED: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
170 purple_debug_info("bonjour", "Successfully registered buddy icon data.\n"); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
171 case AVAHI_ENTRY_GROUP_COLLISION: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
172 purple_debug_error("bonjour", "Collision registering buddy icon data.\n"); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
173 break; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
174 case AVAHI_ENTRY_GROUP_FAILURE: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
175 purple_debug_error("bonjour", "Error registering buddy icon data: %s\n.", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
176 avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
177 break; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
178 case AVAHI_ENTRY_GROUP_UNCOMMITED: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
179 case AVAHI_ENTRY_GROUP_REGISTERING: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
180 break; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
181 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
182 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
183 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
184 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
185 static void |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
186 _entry_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
187 AvahiSessionImplData *idata = userdata; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
188 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
189 g_return_if_fail(g == idata->group || idata->group == NULL); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
190 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
191 switch(state) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
192 case AVAHI_ENTRY_GROUP_ESTABLISHED: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
193 purple_debug_info("bonjour", "Successfully registered service.\n"); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
194 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
195 case AVAHI_ENTRY_GROUP_COLLISION: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
196 purple_debug_error("bonjour", "Collision registering entry group.\n"); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
197 /* TODO: Handle error - this should log out the account. (Possibly with "wants to die")*/ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
198 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
199 case AVAHI_ENTRY_GROUP_FAILURE: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
200 purple_debug_error("bonjour", "Error registering entry group: %s\n.", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
201 avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
202 /* TODO: Handle error - this should log out the account.*/ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
203 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
204 case AVAHI_ENTRY_GROUP_UNCOMMITED: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
205 case AVAHI_ENTRY_GROUP_REGISTERING: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
206 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
207 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
208 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
209 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
210 |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
211 static void |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
212 _buddy_icon_record_cb(AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
213 AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type, |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
214 const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata) { |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
215 BonjourBuddy *buddy = userdata; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
216 AvahiBuddyImplData *idata = buddy->mdns_impl_data; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
217 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
218 switch (event) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
219 case AVAHI_BROWSER_NEW: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
220 bonjour_buddy_got_buddy_icon(buddy, rdata, size); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
221 break; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
222 case AVAHI_BROWSER_REMOVE: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
223 case AVAHI_BROWSER_CACHE_EXHAUSTED: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
224 case AVAHI_BROWSER_ALL_FOR_NOW: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
225 case AVAHI_BROWSER_FAILURE: |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
226 purple_debug_error("bonjour", "Error rerieving buddy icon record: %s\n", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
227 avahi_strerror(avahi_client_errno(avahi_record_browser_get_client(b)))); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
228 break; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
229 } |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
230 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
231 /* Stop listening */ |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
232 avahi_record_browser_free(idata->buddy_icon_rec_browser); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
233 idata->buddy_icon_rec_browser = NULL; |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
234 } |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
235 |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
236 /**************************** |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
237 * mdns_interface functions * |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
238 ****************************/ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
239 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
240 gboolean _mdns_init_session(BonjourDnsSd *data) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
241 AvahiSessionImplData *idata = g_new0(AvahiSessionImplData, 1); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
242 const AvahiPoll *poll_api; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
243 int error; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
244 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
245 /* Tell avahi to use g_malloc and g_free */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
246 avahi_set_allocator (avahi_glib_allocator ()); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
247 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
248 /* This currently depends on the glib mainloop, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
249 * we should make it use the libpurple abstraction */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
250 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
251 idata->glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
252 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
253 poll_api = avahi_glib_poll_get(idata->glib_poll); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
254 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
255 idata->client = avahi_client_new(poll_api, 0, NULL, data, &error); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
256 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
257 if (idata->client == NULL) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
258 purple_debug_error("bonjour", "Error initializing Avahi: %s", avahi_strerror(error)); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
259 avahi_glib_poll_free(idata->glib_poll); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
260 g_free(idata); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
261 return FALSE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
262 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
263 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
264 data->mdns_impl_data = idata; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
265 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
266 return TRUE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
267 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
268 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
269 gboolean _mdns_publish(BonjourDnsSd *data, PublishType type) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
270 int publish_result = 0; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
271 char portstring[6]; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
272 const char *jid, *aim, *email; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
273 AvahiSessionImplData *idata = data->mdns_impl_data; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
274 AvahiStringList *lst = NULL; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
275 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
276 g_return_val_if_fail(idata != NULL, FALSE); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
277 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
278 if (!idata->group) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
279 idata->group = avahi_entry_group_new(idata->client, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
280 _entry_group_cb, idata); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
281 if (!idata->group) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
282 purple_debug_error("bonjour", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
283 "Unable to initialize the data for the mDNS (%s).\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
284 avahi_strerror(avahi_client_errno(idata->client))); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
285 return FALSE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
286 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
287 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
288 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
289 /* Convert the port to a string */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
290 snprintf(portstring, sizeof(portstring), "%d", data->port_p2pj); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
291 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
292 jid = purple_account_get_string(data->account, "jid", NULL); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
293 aim = purple_account_get_string(data->account, "AIM", NULL); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
294 email = purple_account_get_string(data->account, "email", NULL); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
295 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
296 /* We should try to follow XEP-0174, but some clients have "issues", so we humor them. |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
297 * See http://telepathy.freedesktop.org/wiki/SalutInteroperability |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
298 */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
299 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
300 /* Needed by iChat */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
301 lst = avahi_string_list_add_pair(lst,"txtvers", "1"); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
302 /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
303 lst = avahi_string_list_add_pair(lst, "1st", data->first); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
304 /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
305 lst = avahi_string_list_add_pair(lst, "last", data->last); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
306 /* Needed by Adium */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
307 lst = avahi_string_list_add_pair(lst, "port.p2pj", portstring); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
308 /* Needed by iChat, Gaim/Pidgin <= 2.0.1 */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
309 lst = avahi_string_list_add_pair(lst, "status", data->status); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
310 /* Currently always set to "!" since we don't support AV and wont ever be in a conference */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
311 lst = avahi_string_list_add_pair(lst, "vc", data->vc); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
312 lst = avahi_string_list_add_pair(lst, "ver", VERSION); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
313 if (email != NULL && *email != '\0') |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
314 lst = avahi_string_list_add_pair(lst, "email", email); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
315 if (jid != NULL && *jid != '\0') |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
316 lst = avahi_string_list_add_pair(lst, "jid", jid); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
317 /* Nonstandard, but used by iChat */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
318 if (aim != NULL && *aim != '\0') |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
319 lst = avahi_string_list_add_pair(lst, "AIM", aim); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
320 if (data->msg != NULL && *data->msg != '\0') |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
321 lst = avahi_string_list_add_pair(lst, "msg", data->msg); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
322 if (data->phsh != NULL && *data->phsh != '\0') |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
323 lst = avahi_string_list_add_pair(lst, "phsh", data->phsh); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
324 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
325 /* TODO: ext, nick, node */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
326 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
327 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
328 /* Publish the service */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
329 switch (type) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
330 case PUBLISH_START: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
331 publish_result = avahi_entry_group_add_service_strlst( |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
332 idata->group, AVAHI_IF_UNSPEC, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
333 AVAHI_PROTO_UNSPEC, 0, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
334 purple_account_get_username(data->account), |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
335 ICHAT_SERVICE, NULL, NULL, data->port_p2pj, lst); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
336 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
337 case PUBLISH_UPDATE: |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
338 publish_result = avahi_entry_group_update_service_txt_strlst( |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
339 idata->group, AVAHI_IF_UNSPEC, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
340 AVAHI_PROTO_UNSPEC, 0, |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
341 purple_account_get_username(data->account), |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
342 ICHAT_SERVICE, NULL, lst); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
343 break; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
344 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
345 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
346 /* Free the memory used by temp data */ |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
347 avahi_string_list_free(lst); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
348 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
349 if (publish_result < 0) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
350 purple_debug_error("bonjour", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
351 "Failed to add the " ICHAT_SERVICE " service. Error: %s\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
352 avahi_strerror(publish_result)); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
353 return FALSE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
354 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
355 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
356 if (type == PUBLISH_START |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
357 && (publish_result = avahi_entry_group_commit(idata->group)) < 0) { |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
358 purple_debug_error("bonjour", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
359 "Failed to commit " ICHAT_SERVICE " service. Error: %s\n", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
360 avahi_strerror(publish_result)); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
361 return FALSE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
362 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
363 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
364 return TRUE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
365 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
366 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
367 gboolean _mdns_browse(BonjourDnsSd *data) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
368 AvahiSessionImplData *idata = data->mdns_impl_data; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
369 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
370 g_return_val_if_fail(idata != NULL, FALSE); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
371 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
372 idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, ICHAT_SERVICE, NULL, 0, _browser_callback, data->account); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
373 if (!idata->sb) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
374 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
375 purple_debug_error("bonjour", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
376 "Unable to initialize service browser. Error: %s\n.", |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
377 avahi_strerror(avahi_client_errno(idata->client))); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
378 return FALSE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
379 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
380 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
381 return TRUE; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
382 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
383 |
18845
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
384 gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) { |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
385 AvahiSessionImplData *idata = data->mdns_impl_data; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
386 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
387 if (idata == NULL || idata->client == NULL) |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
388 return FALSE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
389 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
390 if (avatar_data != NULL) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
391 gboolean new_group = FALSE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
392 gchar *svc_name; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
393 int ret; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
394 AvahiPublishFlags flags = 0; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
395 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
396 if (idata->buddy_icon_group == NULL) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
397 purple_debug_info("bonjour", "Setting new buddy icon.\n"); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
398 new_group = TRUE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
399 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
400 idata->buddy_icon_group = avahi_entry_group_new(idata->client, |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
401 _buddy_icon_group_cb, data); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
402 } else { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
403 purple_debug_info("bonjour", "Updating existing buddy icon.\n"); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
404 flags |= AVAHI_PUBLISH_UPDATE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
405 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
406 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
407 if (idata->buddy_icon_group == NULL) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
408 purple_debug_error("bonjour", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
409 "Unable to initialize the buddy icon group (%s).\n", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
410 avahi_strerror(avahi_client_errno(idata->client))); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
411 return FALSE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
412 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
413 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
414 svc_name = g_strdup_printf("%s." ICHAT_SERVICE "local", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
415 purple_account_get_username(data->account)); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
416 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
417 ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC, |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
418 AVAHI_PROTO_UNSPEC, flags, svc_name, |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
419 AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
420 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
421 g_free(svc_name); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
422 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
423 if (ret < 0) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
424 purple_debug_error("bonjour", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
425 "Failed to register buddy icon. Error: %s\n", avahi_strerror(ret)); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
426 if (new_group) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
427 avahi_entry_group_free(idata->buddy_icon_group); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
428 idata->buddy_icon_group = NULL; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
429 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
430 return FALSE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
431 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
432 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
433 if (new_group && (ret = avahi_entry_group_commit(idata->buddy_icon_group)) < 0) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
434 purple_debug_error("bonjour", |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
435 "Failed to commit buddy icon group. Error: %s\n", avahi_strerror(ret)); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
436 if (new_group) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
437 avahi_entry_group_free(idata->buddy_icon_group); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
438 idata->buddy_icon_group = NULL; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
439 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
440 return FALSE; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
441 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
442 } else if (idata->buddy_icon_group != NULL) { |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
443 purple_debug_info("bonjour", "Removing existing buddy icon.\n"); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
444 avahi_entry_group_free(idata->buddy_icon_group); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
445 idata->buddy_icon_group = NULL; |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
446 } |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
447 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
448 return TRUE; |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
449 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
450 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
451 void _mdns_stop(BonjourDnsSd *data) { |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
452 AvahiSessionImplData *idata = data->mdns_impl_data; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
453 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
454 if (idata == NULL || idata->client == NULL) |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
455 return; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
456 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
457 if (idata->sb != NULL) |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
458 avahi_service_browser_free(idata->sb); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
459 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
460 avahi_client_free(idata->client); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
461 avahi_glib_poll_free(idata->glib_poll); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
462 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
463 g_free(idata); |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
464 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
465 data->mdns_impl_data = NULL; |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
466 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
467 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
468 void _mdns_init_buddy(BonjourBuddy *buddy) { |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
469 buddy->mdns_impl_data = g_new0(AvahiBuddyImplData, 1); |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
470 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
471 |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
472 void _mdns_delete_buddy(BonjourBuddy *buddy) { |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
473 AvahiBuddyImplData *idata = buddy->mdns_impl_data; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
474 |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
475 g_return_if_fail(idata != NULL); |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
476 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
477 if (idata->buddy_icon_rec_browser != NULL) |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
478 avahi_record_browser_free(idata->buddy_icon_rec_browser); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
479 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
480 if (idata->resolver != NULL) |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
481 avahi_service_resolver_free(idata->resolver); |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
482 |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
483 g_free(idata); |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
484 |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
485 buddy->mdns_impl_data = NULL; |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
486 } |
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
487 |
18849
1787e601aafc
_mdns_retrieve_retrieve_buddy_icon() - what kind of crack am I on anyway?
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18848
diff
changeset
|
488 void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
489 PurpleConnection *conn = purple_account_get_connection(buddy->account); |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
490 BonjourData *bd = conn->proto_data; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
491 AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
492 AvahiBuddyImplData *idata = buddy->mdns_impl_data; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
493 gchar *name; |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
494 |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
495 g_return_if_fail(idata != NULL); |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
496 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
497 if (idata->buddy_icon_rec_browser != NULL) |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
498 avahi_record_browser_free(idata->buddy_icon_rec_browser); |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
499 |
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
500 purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name); |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
501 |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
502 name = g_strdup_printf("%s." ICHAT_SERVICE "local", buddy->name); |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
503 idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC, |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
504 AVAHI_PROTO_UNSPEC, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
505 _buddy_icon_record_cb, buddy); |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
506 g_free(name); |
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
507 |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
508 if (!idata->buddy_icon_rec_browser) { |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
509 purple_debug_error("bonjour", |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
510 "Unable to initialize buddy icon record browser. Error: %s\n.", |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
511 avahi_strerror(avahi_client_errno(session_idata->client))); |
18850
2283d5bfc24b
Implement setting buddy icons for avahi implementation. Fix receiving status changes and some other fixes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
512 } |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
513 |
18805
1244b5f43661
Here is a native avahi implementation of the bonjour prpl that I whipped up. Someone more autofoo savvy will probably want to review what I've done to that stuff. Fixes #326.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff
changeset
|
514 } |
18830
2ae9b483c4db
Avahi bonjour implementation of receiving buddy icons.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18805
diff
changeset
|
515 |