annotate libpurple/protocols/bonjour/mdns_common.c @ 20116:a61aa7cc757d

Use purple_connection_ssl_error in prpl-irc
author Will Thompson <will.thompson@collabora.co.uk>
date Wed, 19 Sep 2007 15:01:47 +0000
parents 44b4e8bd759b
children 9340e1db0f46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
1 /*
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
2 * This program is free software; you can redistribute it and/or modify
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
3 * it under the terms of the GNU General Public License as published by
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
4 * the Free Software Foundation; either version 2 of the License, or
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
5 * (at your option) any later version.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
6 *
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
7 * This program is distributed in the hope that it will be useful,
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
10 * GNU Library General Public License for more details.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
11 *
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
12 * You should have received a copy of the GNU General Public License
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
13 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19654
diff changeset
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
15 */
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
16
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
17 #include <string.h>
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
18
18276
1faa319ab4c3 More compile fixes from rekkanoryo for G_GNUC_NULL_TERMINATED issues
Stu Tomlinson <stu@nosnilmot.com>
parents: 17552
diff changeset
19 #include "internal.h"
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
20 #include "debug.h"
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
21
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
22 #include "mdns_common.h"
18798
ed1def07d86e 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 <daniel.atallah@gmail.com>
parents: 18276
diff changeset
23 #include "mdns_interface.h"
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
24 #include "bonjour.h"
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
25 #include "buddy.h"
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
26
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
27
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
28 /**
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
29 * Allocate space for the dns-sd data.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
30 */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
31 BonjourDnsSd * bonjour_dns_sd_new() {
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
32 BonjourDnsSd *data = g_new0(BonjourDnsSd, 1);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
33 return data;
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
34 }
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
35
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
36 /**
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
37 * Deallocate the space of the dns-sd data.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
38 */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
39 void bonjour_dns_sd_free(BonjourDnsSd *data) {
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
40 g_free(data->first);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
41 g_free(data->last);
17501
c96b085ddf5c Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17495
diff changeset
42 g_free(data->phsh);
c96b085ddf5c Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17495
diff changeset
43 g_free(data->status);
c96b085ddf5c Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17495
diff changeset
44 g_free(data->vc);
c96b085ddf5c Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17495
diff changeset
45 g_free(data->msg);
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
46 g_free(data);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
47 }
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
48
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
49 static GSList *generate_presence_txt_records(BonjourDnsSd *data) {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
50 GSList *ret = NULL;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
51 PurpleKeyValuePair *kvp;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
52 char portstring[6];
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
53 const char *jid, *aim, *email;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
54
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
55 /* Convert the port to a string */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
56 snprintf(portstring, sizeof(portstring), "%d", data->port_p2pj);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
57
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
58 jid = purple_account_get_string(data->account, "jid", NULL);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
59 aim = purple_account_get_string(data->account, "AIM", NULL);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
60 email = purple_account_get_string(data->account, "email", NULL);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
61
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
62 #define _M_ADD_R(k, v) \
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
63 kvp = g_new0(PurpleKeyValuePair, 1); \
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
64 kvp->key = g_strdup(k); \
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
65 kvp->value = g_strdup(v); \
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
66 ret = g_slist_prepend(ret, kvp); \
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
67
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
68 /* We should try to follow XEP-0174, but some clients have "issues", so we humor them.
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
69 * See http://telepathy.freedesktop.org/wiki/SalutInteroperability
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
70 */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
71
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
72 /* Needed by iChat */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
73 _M_ADD_R("txtvers", "1")
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
74 /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
75 _M_ADD_R("1st", data->first)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
76 /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
77 _M_ADD_R("last", data->last)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
78 /* Needed by Adium */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
79 _M_ADD_R("port.p2pj", portstring)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
80 /* Needed by iChat, Gaim/Pidgin <= 2.0.1 */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
81 _M_ADD_R("status", data->status)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
82 _M_ADD_R("node", "libpurple")
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
83 _M_ADD_R("ver", VERSION)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
84 /* Currently always set to "!" since we don't support AV and wont ever be in a conference */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
85 _M_ADD_R("vc", data->vc)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
86 if (email != NULL && *email != '\0') {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
87 _M_ADD_R("email", email)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
88 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
89 if (jid != NULL && *jid != '\0') {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
90 _M_ADD_R("jid", jid)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
91 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
92 /* Nonstandard, but used by iChat */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
93 if (aim != NULL && *aim != '\0') {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
94 _M_ADD_R("AIM", aim)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
95 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
96 if (data->msg != NULL && *data->msg != '\0') {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
97 _M_ADD_R("msg", data->msg)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
98 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
99 if (data->phsh != NULL && *data->phsh != '\0') {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
100 _M_ADD_R("phsh", data->phsh)
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
101 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
102
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
103 /* TODO: ext, nick */
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
104 return ret;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
105 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
106
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
107 static void free_presence_txt_records(GSList *lst) {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
108 PurpleKeyValuePair *kvp;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
109 while(lst) {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
110 kvp = lst->data;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
111 g_free(kvp->key);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
112 g_free(kvp->value);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
113 g_free(kvp);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
114 lst = g_slist_remove(lst, lst->data);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
115 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
116 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
117
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
118 static gboolean publish_presence(BonjourDnsSd *data, PublishType type) {
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
119 GSList *txt_records;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
120 gboolean ret;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
121
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
122 txt_records = generate_presence_txt_records(data);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
123 ret = _mdns_publish(data, type, txt_records);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
124 free_presence_txt_records(txt_records);
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
125
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
126 return ret;
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
127 }
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
128
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
129 /**
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
130 * Send a new dns-sd packet updating our status.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
131 */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
132 void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message) {
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
133 g_free(data->status);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
134 g_free(data->msg);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
135
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
136 data->status = g_strdup(status);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
137 data->msg = g_strdup(status_message);
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
138
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
139 /* Update our text record with the new status */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
140 publish_presence(data, PUBLISH_UPDATE);
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
141 }
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
142
18845
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
143 /**
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
144 * Retrieve the buddy icon blob
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
145 */
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
146 void bonjour_dns_sd_retrieve_buddy_icon(BonjourBuddy* buddy) {
18849
1787e601aafc _mdns_retrieve_retrieve_buddy_icon() - what kind of crack am I on anyway?
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18845
diff changeset
147 _mdns_retrieve_buddy_icon(buddy);
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
148 }
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
149
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
150 void bonjour_dns_sd_update_buddy_icon(BonjourDnsSd *data) {
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
151 PurpleStoredImage *img;
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
152
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
153 if ((img = purple_buddy_icons_find_account_icon(data->account))) {
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
154 gconstpointer avatar_data;
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
155 gsize avatar_len;
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
156
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
157 avatar_data = purple_imgstore_get_data(img);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
158 avatar_len = purple_imgstore_get_size(img);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
159
18845
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
160 if (_mdns_set_buddy_icon_data(data, avatar_data, avatar_len)) {
19285
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
161 /* The filename is a SHA-1 hash of the data (conveniently what we need) */
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
162 const char *p, *filename = purple_imgstore_get_filename(img);
18845
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
163
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
164 g_free(data->phsh);
19285
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
165 data->phsh = NULL;
18845
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
166
19285
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
167 /* Get rid of the extension */
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
168 p = strchr(filename, '.');
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
169 if (p)
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
170 data->phsh = g_strndup(filename, p - filename);
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
171 else
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
172 purple_debug_error("bonjour", "account buddy icon returned unexpected filename (%s)"
2d6d936867bc Take advantage of the fact that our buddy icon filenames are SHA-1 hashes to avoid recalculating them in the bonjour protocol. I noticed that it wasn't calculating the hash correctly anyway while doing this.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18859
diff changeset
173 "; unable to extract hash. Clearing buddy icon\n", filename);
18845
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
174
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
175 /* Update our TXT record */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
176 publish_presence(data, PUBLISH_UPDATE);
18845
09f52521ff5b Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
177 }
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
178
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
179 purple_imgstore_unref(img);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
180 } else {
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
181 /* We need to do this regardless of whether data->phsh is set so that we
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
182 * cancel any icons that are currently in the process of being set */
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
183 _mdns_set_buddy_icon_data(data, NULL, 0);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
184 if (data->phsh != NULL) {
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
185 /* Clear the buddy icon */
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
186 g_free(data->phsh);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
187 data->phsh = NULL;
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
188 /* Update our TXT record */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
189 publish_presence(data, PUBLISH_UPDATE);
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
190 }
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
191 }
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
192 }
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18804
diff changeset
193
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
194 /**
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
195 * Advertise our presence within the dns-sd daemon and start browsing
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
196 * for other bonjour peers.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
197 */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
198 gboolean bonjour_dns_sd_start(BonjourDnsSd *data) {
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
199
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
200 /* Initialize the dns-sd data and session */
18798
ed1def07d86e 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 <daniel.atallah@gmail.com>
parents: 18276
diff changeset
201 if (!_mdns_init_session(data))
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
202 return FALSE;
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
203
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
204 /* Publish our bonjour IM client at the mDNS daemon */
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
205 if (!publish_presence(data, PUBLISH_START))
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
206 return FALSE;
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
207
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
208 /* Advise the daemon that we are waiting for connections */
18798
ed1def07d86e 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 <daniel.atallah@gmail.com>
parents: 18276
diff changeset
209 if (!_mdns_browse(data)) {
19654
941965d6fd88 Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19285
diff changeset
210 purple_debug_error("bonjour", "Unable to get service.\n");
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
211 return FALSE;
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
212 }
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
213
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
214 return TRUE;
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
215 }
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
216
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
217 /**
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
218 * Unregister the "_presence._tcp" service at the mDNS daemon.
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
219 */
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
220
18859
c1546f6c0432 Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18849
diff changeset
221 void bonjour_dns_sd_stop(BonjourDnsSd *data) {
18798
ed1def07d86e 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 <daniel.atallah@gmail.com>
parents: 18276
diff changeset
222 _mdns_stop(data);
17495
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents:
diff changeset
223 }