Mercurial > pidgin
comparison libpurple/protocols/bonjour/buddy.c @ 22975:d50194ab3016
Bonjour buddies will be saved persistently if they're moved out of the
"Bonjour" group. Thanks to Eion Robb for the patch (blame me if something is
broken as I tweaked a few things). Fixes #5753.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 16 May 2008 18:21:09 +0000 |
parents | 41959f031322 |
children | ef0bcbe33689 |
comparison
equal
deleted
inserted
replaced
22974:8ac3ffa6841e | 22975:d50194ab3016 |
---|---|
151 if (buddy == NULL) | 151 if (buddy == NULL) |
152 buddy = purple_find_buddy(account, bonjour_buddy->name); | 152 buddy = purple_find_buddy(account, bonjour_buddy->name); |
153 | 153 |
154 if (buddy == NULL) { | 154 if (buddy == NULL) { |
155 buddy = purple_buddy_new(account, bonjour_buddy->name, NULL); | 155 buddy = purple_buddy_new(account, bonjour_buddy->name, NULL); |
156 buddy->proto_data = bonjour_buddy; | |
157 purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); | 156 purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); |
158 purple_blist_add_buddy(buddy, NULL, group, NULL); | 157 purple_blist_add_buddy(buddy, NULL, group, NULL); |
159 } | 158 } |
160 | 159 |
160 buddy->proto_data = bonjour_buddy; | |
161 | |
161 /* Create the alias for the buddy using the first and the last name */ | 162 /* Create the alias for the buddy using the first and the last name */ |
162 if (bonjour_buddy->nick) | 163 if (bonjour_buddy->nick) |
163 serv_got_alias(purple_account_get_connection(account), buddy->name, bonjour_buddy->nick); | 164 serv_got_alias(purple_account_get_connection(account), buddy->name, bonjour_buddy->nick); |
164 else { | 165 else { |
165 gchar *alias = NULL; | 166 gchar *alias = NULL; |
199 } else if (!new_hash) | 200 } else if (!new_hash) |
200 purple_buddy_icons_set_for_user(account, buddy->name, NULL, 0, NULL); | 201 purple_buddy_icons_set_for_user(account, buddy->name, NULL, 0, NULL); |
201 } | 202 } |
202 | 203 |
203 /** | 204 /** |
205 * The buddy has signed off Bonjour. | |
206 * If the buddy is being saved, mark as offline, otherwise delete | |
207 */ | |
208 void bonjour_buddy_signed_off(PurpleBuddy *pb) { | |
209 if (PURPLE_BLIST_NODE_SHOULD_SAVE(pb)) | |
210 purple_prpl_got_user_status(purple_buddy_get_account(pb), | |
211 purple_buddy_get_name(pb), "offline", NULL); | |
212 else { | |
213 purple_account_remove_buddy(purple_buddy_get_account(pb), pb, NULL); | |
214 purple_blist_remove_buddy(pb); | |
215 } | |
216 } | |
217 | |
218 /** | |
204 * We got the buddy icon data; deal with it | 219 * We got the buddy icon data; deal with it |
205 */ | 220 */ |
206 void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len) { | 221 void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len) { |
207 /* Recalculate the hash instead of using the current phsh to make sure it is accurate for the icon. */ | 222 /* Recalculate the hash instead of using the current phsh to make sure it is accurate for the icon. */ |
208 char *p, *hash; | 223 char *p, *hash; |