annotate libpurple/protocols/bonjour/buddy.h @ 25622:2fb8c39d0494

Send file by p2p when we are server
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Wed, 09 Jul 2008 15:05:09 +0000
parents d50194ab3016
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
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
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19573
diff changeset
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
15374
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #include "jabber.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 typedef struct _BonjourBuddy
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 {
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: 15823
diff changeset
27 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: 15823
diff changeset
28
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 gchar *name;
21806
41959f031322 Update Bonjour prpl to support multiple presence records for the same buddy. Eliminate the Howl backend to avoid having to maintain yet another set of code. References #4187 (more to come to fix the rest of the ticket).
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20346
diff changeset
30 GSList *ips;
17742
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
31 gint port_p2pj;
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
32
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 gchar *first;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 gchar *phsh;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 gchar *status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 gchar *email;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 gchar *last;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 gchar *jid;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 gchar *AIM;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 gchar *vc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 gchar *msg;
17742
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
42 gchar *ext;
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
43 gchar *nick;
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
44 gchar *node;
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
45 gchar *ver;
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
46
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 BonjourJabberConversation *conversation;
17742
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
48
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: 17742
diff changeset
49 gpointer mdns_impl_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 } BonjourBuddy;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51
17742
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
52 static const char *const buddy_TXT_records[] = {
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
53 "1st",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
54 "email",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
55 "ext",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
56 "jid",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
57 "last",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
58 "msg",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
59 "nick",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
60 "node",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
61 "phsh",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
62 /* "port.p2pj", Deprecated - MUST ignore */
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
63 "status",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
64 /* "txtvers", Deprecated - hardcoded to 1 */
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
65 "vc",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
66 "ver",
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
67 "AIM", /* non standard */
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
68 NULL
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
69 };
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: 15823
diff changeset
70
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 * Creates a new buddy.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 */
17742
c921f901c7ea Improve bonjour buddy TXT record parsing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
74 BonjourBuddy *bonjour_buddy_new(const gchar *name, PurpleAccount *account);
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: 15823
diff changeset
75
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: 15823
diff changeset
76 /**
18858
f773aa054dca Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18847
diff changeset
77 * Clear any existing values from the buddy.
f773aa054dca Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18847
diff changeset
78 * This is called before updating so that we can notice removals
f773aa054dca Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18847
diff changeset
79 */
f773aa054dca Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18847
diff changeset
80 void clear_bonjour_buddy_values(BonjourBuddy *buddy);
f773aa054dca Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18847
diff changeset
81
f773aa054dca Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18847
diff changeset
82 /**
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: 15823
diff changeset
83 * 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: 15823
diff changeset
84 */
20346
07c2e60026da applied changes from e9e74094baa29c6f5589385507221a2502b817fb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
85 void set_bonjour_buddy_value(BonjourBuddy *buddy, const char *record_key, const char *value, guint32 len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 * 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
89 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 gboolean bonjour_buddy_check(BonjourBuddy *buddy);
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 /**
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
93 * If the buddy doesn't previously exists, it is created. Else, its data is changed (???)
19573
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18858
diff changeset
94 * purple_buddy is optional; it saves an additional lookup if we already have it
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 */
19573
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18858
diff changeset
96 void bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy, PurpleBuddy *purple_buddy);
15374
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 /**
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
99 * The buddy has signed off Bonjour.
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
100 * If the buddy is being saved, mark as offline, otherwise delete
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
101 */
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
102 void bonjour_buddy_signed_off(PurpleBuddy *purple_buddy);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
103
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21806
diff changeset
104 /**
18847
2bf2bd713955 Calculate the icon hash instead of using the current phsh value - iChat seems to update the TXT record before updating the NULL record containing image data, this causes the old image to be retrieved - perhaps we should re-fetch when this happens?
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
105 * We got the buddy icon data; deal with it
2bf2bd713955 Calculate the icon hash instead of using the current phsh value - iChat seems to update the TXT record before updating the NULL record containing image data, this causes the old image to be retrieved - perhaps we should re-fetch when this happens?
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
106 */
2bf2bd713955 Calculate the icon hash instead of using the current phsh value - iChat seems to update the TXT record before updating the NULL record containing image data, this causes the old image to be retrieved - perhaps we should re-fetch when this happens?
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
107 void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len);
2bf2bd713955 Calculate the icon hash instead of using the current phsh value - iChat seems to update the TXT record before updating the NULL record containing image data, this causes the old image to be retrieved - perhaps we should re-fetch when this happens?
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
108
2bf2bd713955 Calculate the icon hash instead of using the current phsh value - iChat seems to update the TXT record before updating the NULL record containing image data, this causes the old image to be retrieved - perhaps we should re-fetch when this happens?
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
109 /**
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 * Deletes a buddy from memory.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 void bonjour_buddy_delete(BonjourBuddy *buddy);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 #endif