Sat, 28 Sep 2019 03:28:30 -0500
update bonjour to just use purple.h
| 11477 | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify | |
| 3 | * it under the terms of the GNU General Public License as published by | |
| 4 | * the Free Software Foundation; either version 2 of the License, or | |
| 5 | * (at your option) any later version. | |
| 6 | * | |
| 7 | * This program is distributed in the hope that it will be useful, | |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 10 | * GNU Library General Public License for more details. | |
| 11 | * | |
| 12 | * You should have received a copy of the GNU General Public License | |
| 13 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19748
diff
changeset
|
14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
| 11477 | 15 | */ |
| 16 | ||
| 17 | #include <glib.h> | |
| 18 | #include <stdlib.h> | |
| 19 | ||
|
18338
d3cb08f27e04
More compile fixes from rekkanoryo for G_GNUC_NULL_TERMINATED issues
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17663
diff
changeset
|
20 | #include "internal.h" |
|
39960
4a5610d858ef
update bonjour to just use purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
39815
diff
changeset
|
21 | #include <purple.h> |
|
4a5610d858ef
update bonjour to just use purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
39815
diff
changeset
|
22 | |
| 11477 | 23 | #include "buddy.h" |
| 24 | #include "bonjour.h" | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
25 | #include "mdns_interface.h" |
| 11477 | 26 | |
| 27 | /** | |
| 28 | * Creates a new buddy. | |
| 29 | */ | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
30 | BonjourBuddy * |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
31 | bonjour_buddy_new(const gchar *name, PurpleAccount* account) |
| 11477 | 32 | { |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
33 | BonjourBuddy *buddy = g_new0(BonjourBuddy, 1); |
| 11477 | 34 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
35 | buddy->account = account; |
| 11477 | 36 | buddy->name = g_strdup(name); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
37 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
38 | _mdns_init_buddy(buddy); |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
39 | |
| 11477 | 40 | return buddy; |
| 41 | } | |
| 42 | ||
|
39815
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
43 | void |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
44 | clear_bonjour_buddy_values(BonjourBuddy *buddy) |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
45 | { |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
46 | g_clear_pointer(&buddy->first, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
47 | g_clear_pointer(&buddy->email, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
48 | g_clear_pointer(&buddy->ext, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
49 | g_clear_pointer(&buddy->jid, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
50 | g_clear_pointer(&buddy->last, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
51 | g_clear_pointer(&buddy->msg, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
52 | g_clear_pointer(&buddy->nick, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
53 | g_clear_pointer(&buddy->node, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
54 | g_clear_pointer(&buddy->phsh, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
55 | g_clear_pointer(&buddy->status, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
56 | g_clear_pointer(&buddy->vc, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
57 | g_clear_pointer(&buddy->ver, g_free); |
|
77cda76aa2cd
Replace _B_CLR with g_clear_pointer.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38358
diff
changeset
|
58 | g_clear_pointer(&buddy->AIM, g_free); |
|
19220
60d667d6bdc5
Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <datallah@pidgin.im>
parents:
19208
diff
changeset
|
59 | } |
|
60d667d6bdc5
Clear bonjour buddy values before resetting them so that we notice value removals.
Daniel Atallah <datallah@pidgin.im>
parents:
19208
diff
changeset
|
60 | |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
61 | void |
|
20238
e4abd12fb7ec
applied changes from e9e74094baa29c6f5589385507221a2502b817fb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
62 | set_bonjour_buddy_value(BonjourBuddy* buddy, const char *record_key, const char *value, guint32 len){ |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
63 | gchar **fld = NULL; |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
64 | |
|
20238
e4abd12fb7ec
applied changes from e9e74094baa29c6f5589385507221a2502b817fb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
65 | g_return_if_fail(record_key != NULL); |
|
e4abd12fb7ec
applied changes from e9e74094baa29c6f5589385507221a2502b817fb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
66 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
67 | if (purple_strequal(record_key, "1st")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
68 | fld = &buddy->first; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
69 | else if(purple_strequal(record_key, "email")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
70 | fld = &buddy->email; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
71 | else if(purple_strequal(record_key, "ext")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
72 | fld = &buddy->ext; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
73 | else if(purple_strequal(record_key, "jid")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
74 | fld = &buddy->jid; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
75 | else if(purple_strequal(record_key, "last")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
76 | fld = &buddy->last; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
77 | else if(purple_strequal(record_key, "msg")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
78 | fld = &buddy->msg; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
79 | else if(purple_strequal(record_key, "nick")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
80 | fld = &buddy->nick; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
81 | else if(purple_strequal(record_key, "node")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
82 | fld = &buddy->node; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
83 | else if(purple_strequal(record_key, "phsh")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
84 | fld = &buddy->phsh; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
85 | else if(purple_strequal(record_key, "status")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
86 | fld = &buddy->status; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
87 | else if(purple_strequal(record_key, "vc")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
88 | fld = &buddy->vc; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
89 | else if(purple_strequal(record_key, "ver")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
90 | fld = &buddy->ver; |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
25132
diff
changeset
|
91 | else if(purple_strequal(record_key, "AIM")) |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
92 | fld = &buddy->AIM; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
93 | |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
94 | if(fld == NULL) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
95 | return; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
96 | |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
97 | g_free(*fld); |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
98 | *fld = NULL; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
99 | *fld = g_strndup(value, len); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
100 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
101 | |
| 11477 | 102 | /** |
| 103 | * Check if all the compulsory buddy data is present. | |
| 104 | */ | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
105 | gboolean |
|
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
106 | bonjour_buddy_check(BonjourBuddy *buddy) |
| 11477 | 107 | { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
108 | if (buddy->account == NULL) |
| 11477 | 109 | return FALSE; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
110 | |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
111 | if (buddy->name == NULL) |
| 11477 | 112 | return FALSE; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
113 | |
| 11477 | 114 | return TRUE; |
| 115 | } | |
| 116 | ||
| 117 | /** | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
118 | * If the buddy does not yet exist, then create it and add it to |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
119 | * our buddy list. In either case we set the correct status for |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
120 | * the buddy. |
| 11477 | 121 | */ |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
122 | void |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19397
diff
changeset
|
123 | bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy, PurpleBuddy *buddy) |
| 11477 | 124 | { |
| 15884 | 125 | PurpleGroup *group; |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
126 | PurpleAccount *account = bonjour_buddy->account; |
|
24562
22ed1e1ef32f
More Bonjour struct hiding fixes.
Richard Laager <rlaager@pidgin.im>
parents:
23160
diff
changeset
|
127 | const char *status_id, *old_hash, *new_hash, *name; |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
128 | |
| 15884 | 129 | /* Translate between the Bonjour status and the Purple status */ |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
130 | if (bonjour_buddy->status != NULL && g_ascii_strcasecmp("dnd", bonjour_buddy->status) == 0) |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
131 | status_id = BONJOUR_STATUS_ID_AWAY; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
132 | else |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
133 | status_id = BONJOUR_STATUS_ID_AVAILABLE; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
134 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
135 | /* |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
136 | * TODO: Figure out the idle time by getting the "away" |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
137 | * field from the DNS SD. |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
138 | */ |
| 11477 | 139 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
140 | /* Make sure the Bonjour group exists in our buddy list */ |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
141 | group = purple_blist_find_group(BONJOUR_GROUP_NAME); /* Use the buddy's domain, instead? */ |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
142 | if (group == NULL) { |
| 15884 | 143 | group = purple_group_new(BONJOUR_GROUP_NAME); |
| 144 | purple_blist_add_group(group, NULL); | |
| 11477 | 145 | } |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
146 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
147 | /* Make sure the buddy exists in our buddy list */ |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19397
diff
changeset
|
148 | if (buddy == NULL) |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34706
diff
changeset
|
149 | buddy = purple_blist_find_buddy(account, bonjour_buddy->name); |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
150 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
151 | if (buddy == NULL) { |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
152 | buddy = purple_buddy_new(account, bonjour_buddy->name, NULL); |
|
34865
764a33b41ac7
Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
153 | purple_blist_node_set_transient(PURPLE_BLIST_NODE(buddy), TRUE); |
| 15884 | 154 | purple_blist_add_buddy(buddy, NULL, group, NULL); |
| 11477 | 155 | } |
|
23160
0aff8f3882f4
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <datallah@pidgin.im>
parents:
23140
diff
changeset
|
156 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23160
diff
changeset
|
157 | name = purple_buddy_get_name(buddy); |
|
24935
b9a3603e84c0
Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents:
24562
diff
changeset
|
158 | purple_buddy_set_protocol_data(buddy, bonjour_buddy); |
|
23160
0aff8f3882f4
applied changes from 3d595739f53a259d5dae408a05f64d2836f02ac9
Daniel Atallah <datallah@pidgin.im>
parents:
23140
diff
changeset
|
159 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
160 | /* Create the alias for the buddy using the first and the last name */ |
|
25129
476e928f6127
Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@pidgin.im>
parents:
24562
diff
changeset
|
161 | if (bonjour_buddy->nick && *bonjour_buddy->nick) |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34865
diff
changeset
|
162 | purple_serv_got_alias(purple_account_get_connection(account), name, bonjour_buddy->nick); |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
163 | else { |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
164 | gchar *alias = NULL; |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
165 | const char *first, *last; |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
166 | first = bonjour_buddy->first; |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
167 | last = bonjour_buddy->last; |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
168 | if ((first && *first) || (last && *last)) |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
169 | alias = g_strdup_printf("%s%s%s", |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
170 | (first && *first ? first : ""), |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
171 | (first && *first && last && *last ? " " : ""), |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
172 | (last && *last ? last : "")); |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34865
diff
changeset
|
173 | purple_serv_got_alias(purple_account_get_connection(account), name, alias); |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
174 | g_free(alias); |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
175 | } |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
176 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
177 | /* Set the user's status */ |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
178 | if (bonjour_buddy->msg != NULL) |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34865
diff
changeset
|
179 | purple_protocol_got_user_status(account, name, status_id, |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
180 | "message", bonjour_buddy->msg, NULL); |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
181 | else |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34865
diff
changeset
|
182 | purple_protocol_got_user_status(account, name, status_id, NULL); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
183 | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34865
diff
changeset
|
184 | purple_protocol_got_user_idle(account, name, FALSE, 0); |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
185 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
186 | /* TODO: Because we don't save Bonjour buddies in blist.xml, |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
187 | * we will always have to look up the buddy icon at login time. |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
188 | * I think we should figure out a way to do something about this. */ |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
189 | |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
190 | /* Deal with the buddy icon */ |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
191 | old_hash = purple_buddy_icons_get_checksum_for_user(buddy); |
|
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
192 | new_hash = (bonjour_buddy->phsh && *(bonjour_buddy->phsh)) ? bonjour_buddy->phsh : NULL; |
| 38260 | 193 | if (new_hash && !purple_strequal(old_hash, new_hash)) { |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
194 | /* Look up the new icon data */ |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
195 | /* TODO: Make sure the hash assigned to the retrieved buddy icon is the same |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
196 | * as what we looked up. */ |
|
19094
b4d0fe1a515a
Implement bonjour buddy icons in the win32 implementation. Avahi's howl wrapper doesn't implement sw_discovery_query_record(), so we can't do it elsewhere yet.
Daniel Atallah <datallah@pidgin.im>
parents:
19093
diff
changeset
|
197 | bonjour_dns_sd_retrieve_buddy_icon(bonjour_buddy); |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
198 | } else if (!new_hash) |
|
24562
22ed1e1ef32f
More Bonjour struct hiding fixes.
Richard Laager <rlaager@pidgin.im>
parents:
23160
diff
changeset
|
199 | purple_buddy_icons_set_for_user(account, name, NULL, 0, NULL); |
| 11477 | 200 | } |
| 201 | ||
| 202 | /** | |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
203 | * The buddy has signed off Bonjour. |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
204 | * If the buddy is being saved, mark as offline, otherwise delete |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
205 | */ |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
206 | void bonjour_buddy_signed_off(PurpleBuddy *pb) { |
|
34865
764a33b41ac7
Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents:
34728
diff
changeset
|
207 | if (purple_blist_node_is_transient(PURPLE_BLIST_NODE(pb))) { |
|
34697
fde4eb63fab0
Refactored protocols with initial GObject blist API
Ankit Vani <a@nevitus.org>
parents:
25132
diff
changeset
|
208 | purple_account_remove_buddy(purple_buddy_get_account(pb), pb, NULL); |
|
fde4eb63fab0
Refactored protocols with initial GObject blist API
Ankit Vani <a@nevitus.org>
parents:
25132
diff
changeset
|
209 | purple_blist_remove_buddy(pb); |
|
fde4eb63fab0
Refactored protocols with initial GObject blist API
Ankit Vani <a@nevitus.org>
parents:
25132
diff
changeset
|
210 | } else { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
34865
diff
changeset
|
211 | purple_protocol_got_user_status(purple_buddy_get_account(pb), |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
212 | purple_buddy_get_name(pb), "offline", NULL); |
|
24935
b9a3603e84c0
Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents:
24562
diff
changeset
|
213 | bonjour_buddy_delete(purple_buddy_get_protocol_data(pb)); |
|
b9a3603e84c0
Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents:
24562
diff
changeset
|
214 | purple_buddy_set_protocol_data(pb, NULL); |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
215 | } |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
216 | } |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
217 | |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
21920
diff
changeset
|
218 | /** |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
219 | * We got the buddy icon data; deal with it |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
220 | */ |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
221 | void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len) { |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
222 | /* Recalculate the hash instead of using the current phsh to make sure it is accurate for the icon. */ |
|
35837
528ddb11791c
Drop purple_util_get_image_extension and purple_util_get_image_filename
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
223 | gchar *hash; |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
224 | |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
225 | if (data == NULL || len == 0) |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
226 | return; |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
227 | |
|
35837
528ddb11791c
Drop purple_util_get_image_extension and purple_util_get_image_filename
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
228 | hash = g_compute_checksum_for_data(G_CHECKSUM_SHA1, data, len); |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
229 | |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
230 | purple_debug_info("bonjour", "Got buddy icon for %s icon hash='%s' phsh='%s'.\n", buddy->name, |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
231 | hash, buddy->phsh ? buddy->phsh : "(null)"); |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
232 | |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
233 | purple_buddy_icons_set_for_user(buddy->account, buddy->name, |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
234 | g_memdup(data, len), len, hash); |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
235 | |
|
19397
b1befd204757
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 <datallah@pidgin.im>
parents:
19220
diff
changeset
|
236 | g_free(hash); |
|
19208
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
237 | } |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
238 | |
|
34419d052ac8
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 <datallah@pidgin.im>
parents:
19204
diff
changeset
|
239 | /** |
| 11477 | 240 | * Deletes a buddy from memory. |
| 241 | */ | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
242 | void |
|
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
243 | bonjour_buddy_delete(BonjourBuddy *buddy) |
| 11477 | 244 | { |
| 245 | g_free(buddy->name); | |
|
21920
3087a567aedf
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 <datallah@pidgin.im>
parents:
20238
diff
changeset
|
246 | while (buddy->ips != NULL) { |
|
3087a567aedf
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 <datallah@pidgin.im>
parents:
20238
diff
changeset
|
247 | g_free(buddy->ips->data); |
|
3087a567aedf
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 <datallah@pidgin.im>
parents:
20238
diff
changeset
|
248 | buddy->ips = g_slist_delete_link(buddy->ips, buddy->ips); |
|
3087a567aedf
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 <datallah@pidgin.im>
parents:
20238
diff
changeset
|
249 | } |
| 11477 | 250 | g_free(buddy->first); |
| 251 | g_free(buddy->phsh); | |
| 252 | g_free(buddy->status); | |
| 253 | g_free(buddy->email); | |
| 254 | g_free(buddy->last); | |
| 255 | g_free(buddy->jid); | |
| 256 | g_free(buddy->AIM); | |
| 257 | g_free(buddy->vc); | |
| 258 | g_free(buddy->msg); | |
| 17631 | 259 | g_free(buddy->ext); |
| 260 | g_free(buddy->nick); | |
| 261 | g_free(buddy->node); | |
| 262 | g_free(buddy->ver); | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
263 | |
|
17663
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17631
diff
changeset
|
264 | bonjour_jabber_close_conversation(buddy->conversation); |
|
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17631
diff
changeset
|
265 | buddy->conversation = NULL; |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
266 | |
|
19093
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
267 | /* Clean up any mdns implementation data */ |
|
b2657106df0e
Refactor the bonjour mdns implementation abstraction in preparation for the avahi implementation. Also fix alias assignment from the server to populate the server alias instead of the local alias.
Daniel Atallah <datallah@pidgin.im>
parents:
18338
diff
changeset
|
268 | _mdns_delete_buddy(buddy); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
269 | |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
270 | g_free(buddy); |
| 11477 | 271 | } |