Wed, 03 Oct 2007 00:47:25 +0000
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
|
20837
c038b7fffbdc
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
1 | /** |
|
c038b7fffbdc
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
2 | * |
|
c038b7fffbdc
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
3 | * Purple is the legal property of its developers, whose names are too numerous |
|
c038b7fffbdc
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
c038b7fffbdc
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
5 | * source distribution. |
|
c038b7fffbdc
Don't link the bonjour prpl on win32 directly to the Apple Bonjour library, instead do everything indirectly and display an error message at login time indicating that Bonjour isn't installed. This should make the prpl more discoverable.
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
6 | * |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
10 | * (at your option) any later version. |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
11 | * |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
15 | * GNU Library General Public License for more details. |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
16 | * |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19832
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
20 | */ |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
21 | |
|
18338
d3cb08f27e04
More compile fixes from rekkanoryo for G_GNUC_NULL_TERMINATED issues
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17659
diff
changeset
|
22 | #include "internal.h" |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
23 | #include "debug.h" |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
24 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
25 | #include "buddy.h" |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
26 | #include "mdns_interface.h" |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
27 | #include "dns_sd_proxy.h" |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
28 | #include "dnsquery.h" |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
29 | #include "mdns_common.h" |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
30 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
31 | |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
32 | /* data structure for the resolve callback */ |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
33 | typedef struct _ResolveCallbackArgs { |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
34 | DNSServiceRef resolver; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
35 | guint resolver_handler; |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
36 | gchar *full_service_name; |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
37 | |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
38 | PurpleDnsQueryData *query; |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
39 | |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
40 | BonjourBuddy* buddy; |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
41 | } ResolveCallbackArgs; |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
42 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
43 | /* data used by win32 bonjour implementation */ |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
44 | typedef struct _win32_session_impl_data { |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
45 | DNSServiceRef presence_svc; |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
46 | DNSServiceRef browser_svc; |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
47 | DNSRecordRef buddy_icon_rec; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
48 | |
|
19207
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
49 | guint presence_handler; |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
50 | guint browser_handler; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
51 | } Win32SessionImplData; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
52 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
53 | typedef struct _win32_buddy_impl_data { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
54 | DNSServiceRef txt_query; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
55 | guint txt_query_handler; |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
56 | DNSServiceRef null_query; |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
57 | guint null_query_handler; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
58 | } Win32BuddyImplData; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
59 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
60 | static void |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
61 | _mdns_handle_event(gpointer data, gint source, PurpleInputCondition condition) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
62 | DNSServiceProcessResult((DNSServiceRef) data); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
63 | } |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
64 | |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
65 | static void |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
66 | _mdns_parse_text_record(BonjourBuddy* buddy, const char* record, uint16_t record_len) |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
67 | { |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
68 | const char *txt_entry; |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
69 | uint8_t txt_len; |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
70 | int i; |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
71 | |
|
19220
60d667d6bdc5
Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
72 | clear_bonjour_buddy_values(buddy); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
73 | for (i = 0; buddy_TXT_records[i] != NULL; i++) { |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
74 | txt_entry = TXTRecordGetValuePtr(record_len, record, buddy_TXT_records[i], &txt_len); |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
75 | if (txt_entry != NULL) |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
76 | set_bonjour_buddy_value(buddy, buddy_TXT_records[i], txt_entry, txt_len); |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
77 | } |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
78 | } |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
79 | |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
80 | static void DNSSD_API |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19210
diff
changeset
|
81 | _mdns_record_query_callback(DNSServiceRef DNSServiceRef, DNSServiceFlags flags, |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
82 | uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
83 | uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
84 | uint32_t ttl, void *context) |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
85 | { |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
86 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
87 | if (kDNSServiceErr_NoError != errorCode) { |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
88 | purple_debug_error("bonjour", "record query - callback error.\n"); |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
89 | /* TODO: Probably should remove the buddy when this happens */ |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
90 | } else if (flags & kDNSServiceFlagsAdd) { |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
91 | if (rrtype == kDNSServiceType_TXT) { |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
92 | /* New Buddy */ |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
93 | BonjourBuddy *bb = (BonjourBuddy*) context; |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
94 | _mdns_parse_text_record(bb, rdata, rdlen); |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
95 | bonjour_buddy_add_to_purple(bb, NULL); |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
96 | } else if (rrtype == kDNSServiceType_NULL) { |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
97 | /* Buddy Icon response */ |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
98 | BonjourBuddy *bb = (BonjourBuddy*) context; |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
99 | Win32BuddyImplData *idata = bb->mdns_impl_data; |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
100 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
101 | g_return_if_fail(idata != NULL); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
102 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
103 | bonjour_buddy_got_buddy_icon(bb, rdata, rdlen); |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
104 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
105 | /* We've got what we need; stop listening */ |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
106 | purple_input_remove(idata->null_query_handler); |
|
19579
d79d5c95ce5a
Reset unsigned int input handlers to 0 instead of -1.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19221
diff
changeset
|
107 | idata->null_query_handler = 0; |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
108 | DNSServiceRefDeallocate(idata->null_query); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
109 | idata->null_query = NULL; |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
110 | } |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
111 | } |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
112 | } |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
113 | |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
114 | static void |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
115 | _mdns_resolve_host_callback(GSList *hosts, gpointer data, const char *error_message) |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
116 | { |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
117 | ResolveCallbackArgs* args = (ResolveCallbackArgs*)data; |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
118 | BonjourBuddy* bb = args->buddy; |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
119 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
120 | if (!hosts || !hosts->data) { |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
121 | purple_debug_error("bonjour", "host resolution - callback error.\n"); |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
122 | bonjour_buddy_delete(bb); |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
123 | } else { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
124 | struct sockaddr_in *addr = (struct sockaddr_in*)g_slist_nth_data(hosts, 1); |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
125 | Win32BuddyImplData *idata = bb->mdns_impl_data; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
126 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
127 | g_return_if_fail(idata != NULL); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
128 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
129 | g_free(bb->ip); |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
130 | bb->ip = g_strdup(inet_ntoa(addr->sin_addr)); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
131 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
132 | /* finally, set up the continuous txt record watcher, and add the buddy to purple */ |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
133 | |
|
19207
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
134 | if (kDNSServiceErr_NoError == DNSServiceQueryRecord(&idata->txt_query, kDNSServiceFlagsLongLivedQuery, |
|
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
135 | kDNSServiceInterfaceIndexAny, args->full_service_name, kDNSServiceType_TXT, |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
136 | kDNSServiceClass_IN, _mdns_record_query_callback, bb)) { |
|
19207
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
137 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
138 | purple_debug_info("bonjour", "Found buddy %s at %s:%d\n", bb->name, bb->ip, bb->port_p2pj); |
|
19207
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
139 | |
|
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
140 | idata->txt_query_handler = purple_input_add(DNSServiceRefSockFD(idata->txt_query), |
|
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
141 | PURPLE_INPUT_READ, _mdns_handle_event, idata->txt_query); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
142 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
143 | bonjour_buddy_add_to_purple(bb, NULL); |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
144 | } else |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
145 | bonjour_buddy_delete(bb); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
146 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
147 | } |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
148 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
149 | /* free the hosts list*/ |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
150 | g_slist_free(hosts); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
151 | |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
152 | /* free the remaining args memory */ |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
153 | purple_dnsquery_destroy(args->query); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
154 | g_free(args->full_service_name); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
155 | g_free(args); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
156 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
157 | |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
158 | static void DNSSD_API |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
159 | _mdns_service_resolve_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
160 | const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const char *txtRecord, void *context) |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
161 | { |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
162 | ResolveCallbackArgs *args = (ResolveCallbackArgs*)context; |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
163 | |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
164 | /* remove the input fd and destroy the service ref */ |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
165 | purple_input_remove(args->resolver_handler); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
166 | DNSServiceRefDeallocate(args->resolver); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
167 | |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
168 | if (kDNSServiceErr_NoError != errorCode) |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
169 | { |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
170 | purple_debug_error("bonjour", "service resolver - callback error.\n"); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
171 | bonjour_buddy_delete(args->buddy); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
172 | g_free(args); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
173 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
174 | else |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
175 | { |
|
17613
1a64916f979a
Fix network byte order issues with win32 bonjour stuff. Also copy the buddy's ip address so that subsequent calls don't overwrite it (it already is being copied and freed because of the howl implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
17612
diff
changeset
|
176 | args->buddy->port_p2pj = ntohs(port); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
177 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
178 | /* parse the text record */ |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
179 | _mdns_parse_text_record(args->buddy, txtRecord, txtLen); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
180 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
181 | /* set more arguments, and start the host resolver */ |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
182 | args->full_service_name = g_strdup(fullname); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
183 | |
|
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
184 | if (!(args->query = |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
185 | purple_dnsquery_a(hosttarget, port, _mdns_resolve_host_callback, args))) |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
186 | { |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
187 | purple_debug_error("bonjour", "service resolver - host resolution failed.\n"); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
188 | bonjour_buddy_delete(args->buddy); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
189 | g_free(args->full_service_name); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
190 | g_free(args); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
191 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
192 | } |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
193 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
194 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
195 | |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
196 | static void DNSSD_API |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
197 | _mdns_service_register_callback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
198 | const char *name, const char *regtype, const char *domain, void *context) { |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
199 | |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
200 | /* TODO: deal with collision */ |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
201 | if (kDNSServiceErr_NoError != errorCode) |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
202 | purple_debug_error("bonjour", "service advertisement - callback error (%d).\n", errorCode); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
203 | else |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
204 | purple_debug_info("bonjour", "service advertisement - callback.\n"); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
205 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
206 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
207 | static void DNSSD_API |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
208 | _mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
209 | DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
210 | { |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
211 | PurpleAccount *account = (PurpleAccount*)context; |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
212 | PurpleBuddy *pb = NULL; |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
213 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
214 | if (kDNSServiceErr_NoError != errorCode) |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19748
diff
changeset
|
215 | purple_debug_error("bonjour", "service browser - callback error\n"); |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
216 | else if (flags & kDNSServiceFlagsAdd) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
217 | /* A presence service instance has been discovered... check it isn't us! */ |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
218 | if (purple_utf8_strcasecmp(serviceName, account->username) != 0) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
219 | /* OK, lets go ahead and resolve it to add to the buddy list */ |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
220 | ResolveCallbackArgs *args = g_new0(ResolveCallbackArgs, 1); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
221 | args->buddy = bonjour_buddy_new(serviceName, account); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
222 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
223 | if (kDNSServiceErr_NoError != DNSServiceResolve(&args->resolver, 0, 0, serviceName, regtype, |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
224 | replyDomain, _mdns_service_resolve_callback, args)) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
225 | bonjour_buddy_delete(args->buddy); |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
226 | g_free(args); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
227 | purple_debug_error("bonjour", "service browser - failed to resolve service.\n"); |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
228 | } else { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
229 | /* get a file descriptor for this service ref, and add it to the input list */ |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
230 | gint fd = DNSServiceRefSockFD(args->resolver); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
231 | args->resolver_handler = purple_input_add(fd, PURPLE_INPUT_READ, _mdns_handle_event, args->resolver); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
232 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
233 | } |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
234 | } else { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
235 | /* A peer has sent a goodbye packet, remove them from the buddy list */ |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
236 | purple_debug_info("bonjour", "service browser - remove notification\n"); |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
237 | pb = purple_find_buddy(account, serviceName); |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
238 | if (pb != NULL) |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19579
diff
changeset
|
239 | purple_blist_remove_buddy(pb); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
240 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
241 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
242 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
243 | /**************************** |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
244 | * mdns_interface functions * |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
245 | ****************************/ |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
246 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
247 | gboolean _mdns_init_session(BonjourDnsSd *data) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
248 | data->mdns_impl_data = g_new0(Win32SessionImplData, 1); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
249 | return TRUE; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
250 | } |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
251 | |
| 19221 | 252 | gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
253 | TXTRecordRef dns_data; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
254 | gboolean ret = TRUE; |
| 19221 | 255 | DNSServiceErrorType set_ret = kDNSServiceErr_NoError; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
256 | Win32SessionImplData *idata = data->mdns_impl_data; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
257 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
258 | g_return_val_if_fail(idata != NULL, FALSE); |
|
17608
795ce8e3d44e
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
259 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
260 | TXTRecordCreate(&dns_data, 256, NULL); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
261 | |
| 19221 | 262 | while (records) { |
| 263 | PurpleKeyValuePair *kvp = records->data; | |
| 264 | set_ret = TXTRecordSetValue(&dns_data, kvp->key, strlen(kvp->value), kvp->value); | |
| 265 | if (set_ret != kDNSServiceErr_NoError) | |
| 266 | break; | |
| 267 | records = records->next; | |
| 268 | } | |
|
17608
795ce8e3d44e
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
269 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
270 | if (set_ret != kDNSServiceErr_NoError) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
271 | purple_debug_error("bonjour", "Unable to allocate memory for text record.\n"); |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
272 | ret = FALSE; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
273 | } else { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
274 | DNSServiceErrorType err = kDNSServiceErr_NoError; |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
275 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
276 | /* OK, we're done constructing the text record, (re)publish the service */ |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
277 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
278 | switch (type) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
279 | case PUBLISH_START: |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
280 | purple_debug_info("bonjour", "Registering presence on port %d\n", data->port_p2pj); |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
281 | err = DNSServiceRegister(&idata->presence_svc, 0, 0, purple_account_get_username(data->account), ICHAT_SERVICE, |
|
17613
1a64916f979a
Fix network byte order issues with win32 bonjour stuff. Also copy the buddy's ip address so that subsequent calls don't overwrite it (it already is being copied and freed because of the howl implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
17612
diff
changeset
|
282 | NULL, NULL, htons(data->port_p2pj), TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
283 | _mdns_service_register_callback, NULL); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
284 | break; |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
285 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
286 | case PUBLISH_UPDATE: |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
287 | purple_debug_info("bonjour", "Updating presence.\n"); |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
288 | err = DNSServiceUpdateRecord(idata->presence_svc, NULL, 0, TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), 0); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
289 | break; |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
290 | } |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
291 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
292 | if (err != kDNSServiceErr_NoError) { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
293 | purple_debug_error("bonjour", "Failed to publish presence service.\n"); |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
294 | ret = FALSE; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
295 | } else if (type == PUBLISH_START) { |
|
19207
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
296 | /* We need to do this because according to the Apple docs: |
|
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
297 | * "the client is responsible for ensuring that DNSServiceProcessResult() is called |
|
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
298 | * whenever there is a reply from the daemon - the daemon may terminate its connection |
|
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
299 | * with a client that does not process the daemon's responses */ |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
300 | idata->presence_handler = purple_input_add(DNSServiceRefSockFD(idata->presence_svc), |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
301 | PURPLE_INPUT_READ, _mdns_handle_event, idata->presence_svc); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
302 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
303 | } |
|
17612
72b49b54ee39
Cleanup win32 of bonjour stuff - fix to only use glib to allocate and free memory to avoid confusion later.
Daniel Atallah <datallah@pidgin.im>
parents:
17611
diff
changeset
|
304 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
305 | /* Free the memory used by temp data */ |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
306 | TXTRecordDeallocate(&dns_data); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
307 | return ret; |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
308 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
309 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
310 | gboolean _mdns_browse(BonjourDnsSd *data) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
311 | Win32SessionImplData *idata = data->mdns_impl_data; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
312 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
313 | g_return_val_if_fail(idata != NULL, FALSE); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
314 | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
315 | if (DNSServiceBrowse(&idata->browser_svc, 0, 0, ICHAT_SERVICE, NULL, |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
316 | _mdns_service_browse_callback, data->account) |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
317 | == kDNSServiceErr_NoError) { |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
318 | idata->browser_handler = purple_input_add(DNSServiceRefSockFD(idata->browser_svc), |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
319 | PURPLE_INPUT_READ, _mdns_handle_event, idata->browser_svc); |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
320 | return TRUE; |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
321 | } |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
322 | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
323 | return FALSE; |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
diff
changeset
|
324 | } |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
325 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
326 | void _mdns_stop(BonjourDnsSd *data) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
327 | Win32SessionImplData *idata = data->mdns_impl_data; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
328 | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
329 | if (idata == NULL) |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
330 | return; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
331 | |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
332 | if (idata->presence_svc != NULL) { |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
333 | purple_input_remove(idata->presence_handler); |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
334 | DNSServiceRefDeallocate(idata->presence_svc); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
335 | } |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
336 | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
337 | if (idata->browser_svc != NULL) { |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
338 | purple_input_remove(idata->browser_handler); |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
339 | DNSServiceRefDeallocate(idata->browser_svc); |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
340 | } |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
341 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
342 | g_free(idata); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
343 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
344 | data->mdns_impl_data = NULL; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
345 | } |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
346 | |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
347 | gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) { |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
348 | Win32SessionImplData *idata = data->mdns_impl_data; |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
349 | DNSServiceErrorType err = kDNSServiceErr_NoError; |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
350 | |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
351 | g_return_val_if_fail(idata != NULL, FALSE); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
352 | |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
353 | if (avatar_data != NULL && idata->buddy_icon_rec == NULL) { |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
354 | purple_debug_info("bonjour", "Setting new buddy icon.\n"); |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
355 | err = DNSServiceAddRecord(idata->presence_svc, &idata->buddy_icon_rec, |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
356 | 0, kDNSServiceType_NULL, avatar_len, avatar_data, 0); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
357 | } else if (avatar_data != NULL) { |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
358 | purple_debug_info("bonjour", "Updating existing buddy icon.\n"); |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
359 | err = DNSServiceUpdateRecord(idata->presence_svc, idata->buddy_icon_rec, |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
360 | 0, avatar_len, avatar_data, 0); |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
361 | } else if (idata->buddy_icon_rec != NULL) { |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
362 | purple_debug_info("bonjour", "Removing existing buddy icon.\n"); |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
363 | DNSServiceRemoveRecord(idata->presence_svc, idata->buddy_icon_rec, 0); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
364 | idata->buddy_icon_rec = NULL; |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
365 | } |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
366 | |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
367 | if (err != kDNSServiceErr_NoError) |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
368 | purple_debug_error("bonjour", "Error (%d) setting buddy icon record.\n", err); |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
369 | |
|
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
370 | return (err == kDNSServiceErr_NoError); |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
371 | } |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
372 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
373 | void _mdns_init_buddy(BonjourBuddy *buddy) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
374 | buddy->mdns_impl_data = g_new0(Win32BuddyImplData, 1); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
375 | } |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
376 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
377 | void _mdns_delete_buddy(BonjourBuddy *buddy) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
378 | Win32BuddyImplData *idata = buddy->mdns_impl_data; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
379 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
380 | g_return_if_fail(idata != NULL); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
381 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
382 | if (idata->txt_query != NULL) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
383 | purple_input_remove(idata->txt_query_handler); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
384 | DNSServiceRefDeallocate(idata->txt_query); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
385 | } |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
386 | |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
387 | if (idata->null_query != NULL) { |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
388 | purple_input_remove(idata->null_query_handler); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
389 | DNSServiceRefDeallocate(idata->null_query); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
390 | } |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
391 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
392 | g_free(idata); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
393 | |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
394 | buddy->mdns_impl_data = NULL; |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
395 | } |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
19056
diff
changeset
|
396 | |
|
19210
4dcb230b1dbd
_mdns_retrieve_retrieve_buddy_icon() - what kind of crack am I on anyway?
Daniel Atallah <datallah@pidgin.im>
parents:
19208
diff
changeset
|
397 | void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
398 | Win32BuddyImplData *idata = buddy->mdns_impl_data; |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
399 | char svc_name[kDNSServiceMaxDomainName]; |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
400 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
401 | g_return_if_fail(idata != NULL); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
402 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
403 | /* Cancel any existing query */ |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
404 | if (idata->null_query != NULL) { |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
405 | purple_input_remove(idata->null_query_handler); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
406 | idata->null_query_handler = 0; |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
407 | DNSServiceRefDeallocate(idata->null_query); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
408 | idata->null_query = NULL; |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
409 | } |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
410 | |
|
19206
ed0343b92c15
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
411 | DNSServiceConstructFullName(svc_name, buddy->name, ICHAT_SERVICE, "local"); |
|
19207
e63cbb092381
Fix recieving status updates for bonjour (win32 implementation).
Daniel Atallah <datallah@pidgin.im>
parents:
19206
diff
changeset
|
412 | if (kDNSServiceErr_NoError == DNSServiceQueryRecord(&idata->null_query, 0, kDNSServiceInterfaceIndexAny, svc_name, |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19210
diff
changeset
|
413 | kDNSServiceType_NULL, kDNSServiceClass_IN, _mdns_record_query_callback, buddy)) { |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
414 | idata->null_query_handler = purple_input_add(DNSServiceRefSockFD(idata->null_query), |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
19099
diff
changeset
|
415 | PURPLE_INPUT_READ, _mdns_handle_event, idata->null_query); |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
416 | } |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
417 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
418 | } |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
419 |