Mercurial > pidgin
annotate libpurple/protocols/bonjour/buddy.h @ 18663:072fb6413fcd
forgot these
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 27 Jul 2007 16:34:01 +0000 |
parents | c921f901c7ea |
children | ed1def07d86e |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * GNU Library General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * along with this program; if not, write to the Free Software |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 #ifndef _BONJOUR_BUDDY |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 #define _BONJOUR_BUDDY |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 #include <glib.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
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:
15822
diff
changeset
|
22 #include "config.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 |
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:
15822
diff
changeset
|
26 #ifdef USE_BONJOUR_APPLE |
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:
15822
diff
changeset
|
27 #include "dns_sd_proxy.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:
15822
diff
changeset
|
28 #else /* USE_BONJOUR_HOWL */ |
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:
15822
diff
changeset
|
29 #include <howl.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:
15822
diff
changeset
|
30 #endif |
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:
15822
diff
changeset
|
31 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 typedef struct _BonjourBuddy |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 { |
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:
15822
diff
changeset
|
34 PurpleAccount *account; |
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:
15822
diff
changeset
|
35 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 gchar *name; |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
37 gchar *ip; |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
38 gint port_p2pj; |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
39 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 gchar *first; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 gchar *phsh; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 gchar *status; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 gchar *email; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 gchar *last; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 gchar *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 gchar *AIM; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 gchar *vc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 gchar *msg; |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
49 gchar *ext; |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
50 gchar *nick; |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
51 gchar *node; |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
52 gchar *ver; |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
53 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 BonjourJabberConversation *conversation; |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
55 |
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:
15822
diff
changeset
|
56 #ifdef USE_BONJOUR_APPLE |
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:
15822
diff
changeset
|
57 DNSServiceRef txt_query; |
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:
15822
diff
changeset
|
58 int txt_query_fd; |
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:
15822
diff
changeset
|
59 #endif |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
60 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 } BonjourBuddy; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
63 static const char *const buddy_TXT_records[] = { |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
64 "1st", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
65 "email", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
66 "ext", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
67 "jid", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
68 "last", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
69 "msg", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
70 "nick", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
71 "node", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
72 "phsh", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
73 /* "port.p2pj", Deprecated - MUST ignore */ |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
74 "status", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
75 /* "txtvers", Deprecated - hardcoded to 1 */ |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
76 "vc", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
77 "ver", |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
78 "AIM", /* non standard */ |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
79 NULL |
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
80 }; |
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:
15822
diff
changeset
|
81 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 * Creates a new buddy. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 */ |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
85 BonjourBuddy *bonjour_buddy_new(const gchar *name, PurpleAccount *account); |
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:
15822
diff
changeset
|
86 |
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:
15822
diff
changeset
|
87 /** |
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:
15822
diff
changeset
|
88 * Sets a value in the BonjourBuddy struct, destroying the old value |
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:
15822
diff
changeset
|
89 */ |
17504
c921f901c7ea
Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
90 void set_bonjour_buddy_value(BonjourBuddy* buddy, const char *record_key, const char *value, uint32_t len); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 * Check if all the compulsory buddy data is present. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 gboolean bonjour_buddy_check(BonjourBuddy *buddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 * If the buddy doesn't previoulsy exists, it is created. Else, its data is changed (???) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 */ |
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:
15822
diff
changeset
|
100 void bonjour_buddy_add_to_purple(BonjourBuddy *buddy); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 * Deletes a buddy from memory. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 void bonjour_buddy_delete(BonjourBuddy *buddy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 #endif |