Mercurial > pidgin.yaz
annotate libpurple/protocols/bonjour/mdns_common.c @ 18859:c1546f6c0432
Yay for code reuse.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 10 Aug 2007 01:29:48 +0000 |
parents | 1787e601aafc |
children | 2d6d936867bc |
rev | line source |
---|---|
17733
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 |
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
|
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
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:
17790
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 "cipher.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 #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
|
22 |
17733
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
|
23 #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
|
24 #include "mdns_interface.h" |
17733
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 "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
|
26 #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
|
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 /** |
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 * 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
|
31 */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
32 BonjourDnsSd * bonjour_dns_sd_new() { |
17733
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 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
|
34 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
|
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 /** |
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 * 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
|
39 */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
40 void bonjour_dns_sd_free(BonjourDnsSd *data) { |
17733
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->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
|
42 g_free(data->last); |
17739
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
43 g_free(data->phsh); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
44 g_free(data->status); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
45 g_free(data->vc); |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17733
diff
changeset
|
46 g_free(data->msg); |
17733
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 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
|
48 } |
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
|
49 |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
50 static GSList *generate_presence_txt_records(BonjourDnsSd *data) { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
51 GSList *ret = NULL; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
52 PurpleKeyValuePair *kvp; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
53 char portstring[6]; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
54 const char *jid, *aim, *email; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
55 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
56 /* Convert the port to a string */ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
57 snprintf(portstring, sizeof(portstring), "%d", data->port_p2pj); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
58 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
59 jid = purple_account_get_string(data->account, "jid", NULL); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
60 aim = purple_account_get_string(data->account, "AIM", NULL); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
61 email = purple_account_get_string(data->account, "email", NULL); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
62 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
63 #define _M_ADD_R(k, v) \ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
64 kvp = g_new0(PurpleKeyValuePair, 1); \ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
65 kvp->key = g_strdup(k); \ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
66 kvp->value = g_strdup(v); \ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
67 ret = g_slist_prepend(ret, kvp); \ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
68 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
69 /* 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
|
70 * See http://telepathy.freedesktop.org/wiki/SalutInteroperability |
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 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
73 /* Needed by iChat */ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
74 _M_ADD_R("txtvers", "1") |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
75 /* 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
|
76 _M_ADD_R("1st", data->first) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
77 /* 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
|
78 _M_ADD_R("last", data->last) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
79 /* Needed by Adium */ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
80 _M_ADD_R("port.p2pj", portstring) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
81 /* Needed by iChat, Gaim/Pidgin <= 2.0.1 */ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
82 _M_ADD_R("status", data->status) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
83 _M_ADD_R("node", "libpurple") |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
84 _M_ADD_R("ver", VERSION) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
85 /* 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
|
86 _M_ADD_R("vc", data->vc) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
87 if (email != NULL && *email != '\0') { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
88 _M_ADD_R("email", email) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
89 } |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
90 if (jid != NULL && *jid != '\0') { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
91 _M_ADD_R("jid", jid) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
92 } |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
93 /* Nonstandard, but used by iChat */ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
94 if (aim != NULL && *aim != '\0') { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
95 _M_ADD_R("AIM", aim) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
96 } |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
97 if (data->msg != NULL && *data->msg != '\0') { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
98 _M_ADD_R("msg", data->msg) |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
99 } |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
100 if (data->phsh != NULL && *data->phsh != '\0') { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
101 _M_ADD_R("phsh", data->phsh) |
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 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
104 /* TODO: ext, nick */ |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
105 return ret; |
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 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
108 static void free_presence_txt_records(GSList *lst) { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
109 PurpleKeyValuePair *kvp; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
110 while(lst) { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
111 kvp = lst->data; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
112 g_free(kvp->key); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
113 g_free(kvp->value); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
114 g_free(kvp); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
115 lst = g_slist_remove(lst, lst->data); |
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 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
119 static gboolean publish_presence(BonjourDnsSd *data, PublishType type) { |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
120 GSList *txt_records; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
121 gboolean ret; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
122 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
123 txt_records = generate_presence_txt_records(data); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
124 ret = _mdns_publish(data, type, txt_records); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
125 free_presence_txt_records(txt_records); |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
126 |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
127 return ret; |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
128 } |
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
129 |
17733
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 /** |
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 * 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
|
132 */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
133 void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message) { |
17733
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->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
|
135 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
|
136 |
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->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
|
138 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
|
139 |
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
|
140 /* Update our text record with the new status */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
141 publish_presence(data, PUBLISH_UPDATE); |
17733
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 } |
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
|
143 |
18845
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
144 /** |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
145 * Retrieve the buddy icon blob |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
146 */ |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
147 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
|
148 _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
|
149 } |
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
|
150 |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
151 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
|
152 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
|
153 |
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 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
|
155 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
|
156 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
|
157 |
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_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
|
159 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
|
160 |
18845
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
161 if (_mdns_set_buddy_icon_data(data, avatar_data, avatar_len)) { |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
162 int i; |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
163 gchar *enc; |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
164 char *p, hash[41]; |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
165 unsigned char hashval[20]; |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
166 |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
167 enc = purple_base64_encode(avatar_data, avatar_len); |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
168 |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
169 purple_cipher_digest_region("sha1", avatar_data, |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
170 avatar_len, sizeof(hashval), |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
171 hashval, NULL); |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
172 |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
173 p = hash; |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
174 for(i=0; i<20; i++, p+=2) |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
175 snprintf(p, 3, "%02x", hashval[i]); |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
176 |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
177 g_free(data->phsh); |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
178 data->phsh = g_strdup(hash); |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
179 |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
180 g_free(enc); |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
181 |
09f52521ff5b
Fix bonjour buddy icons to work with iChat.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
182 /* Update our TXT record */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
183 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
|
184 } |
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
|
185 |
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 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
|
187 } 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
|
188 /* 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
|
189 * 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
|
190 _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
|
191 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
|
192 /* 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
|
193 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
|
194 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
|
195 /* Update our TXT record */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
196 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
|
197 } |
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
|
198 } |
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
|
199 } |
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
|
200 |
17733
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
|
201 /** |
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 * 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
|
203 * 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
|
204 */ |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
205 gboolean bonjour_dns_sd_start(BonjourDnsSd *data) { |
17733
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 |
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 /* 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
|
208 if (!_mdns_init_session(data)) |
17733
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
|
209 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
|
210 |
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 /* 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
|
212 if (!publish_presence(data, PUBLISH_START)) |
17733
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 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
|
214 |
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 /* 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
|
216 if (!_mdns_browse(data)) { |
17733
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 purple_debug_error("bonjour", "Unable to get service."); |
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 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
|
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 |
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
|
221 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
|
222 } |
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 |
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
|
224 /** |
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
|
225 * 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
|
226 */ |
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
|
227 |
18859
c1546f6c0432
Yay for code reuse.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18849
diff
changeset
|
228 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
|
229 _mdns_stop(data); |
17733
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
|
230 } |