Mercurial > pidgin.yaz
comparison libpurple/protocols/mxit/mxit.c @ 29786:f549ad844d54
propagate from branch 'im.pidgin.pidgin.next.minor' (head 42544ec892337510146c931806a95dbf69c2fe30)
to branch 'im.pidgin.pidgin' (head 32a27a2c6eebcccdecd7d7cd420b3789c69cbb09)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 18 Feb 2010 09:22:01 +0000 |
parents | 81ea740f92a4 ecc6217baa1e |
children | 2cb6ea4420a0 |
comparison
equal
deleted
inserted
replaced
29785:4c266d9c17eb | 29786:f549ad844d54 |
---|---|
187 | 187 |
188 purple_debug_info( MXIT_PLUGIN_ID, "Conversation started with '%s'\n", who ); | 188 purple_debug_info( MXIT_PLUGIN_ID, "Conversation started with '%s'\n", who ); |
189 | 189 |
190 /* find the buddy object */ | 190 /* find the buddy object */ |
191 buddy = purple_find_buddy( session->acc, who ); | 191 buddy = purple_find_buddy( session->acc, who ); |
192 if ( ( !buddy ) || ( !buddy->proto_data ) ) | 192 if ( !buddy ) |
193 return; | |
194 | |
195 contact = purple_buddy_get_protocol_data(buddy); | |
196 if ( !contact ) | |
193 return; | 197 return; |
194 | 198 |
195 /* we ignore all conversations with which we have chatted with in this session */ | 199 /* we ignore all conversations with which we have chatted with in this session */ |
196 if ( find_active_chat( session->active_chats, who ) ) | 200 if ( find_active_chat( session->active_chats, who ) ) |
197 return; | 201 return; |
198 | 202 |
199 /* determite if this buddy is a MXit service */ | 203 /* determite if this buddy is a MXit service */ |
200 contact = buddy->proto_data; | |
201 switch ( contact->type ) { | 204 switch ( contact->type ) { |
202 case MXIT_TYPE_BOT : | 205 case MXIT_TYPE_BOT : |
203 case MXIT_TYPE_CHATROOM : | 206 case MXIT_TYPE_CHATROOM : |
204 case MXIT_TYPE_GALLERY : | 207 case MXIT_TYPE_GALLERY : |
205 case MXIT_TYPE_INFO : | 208 case MXIT_TYPE_INFO : |
257 * @param buddy The buddy | 260 * @param buddy The buddy |
258 * @return The icon name (excluding extension) | 261 * @return The icon name (excluding extension) |
259 */ | 262 */ |
260 static const char* mxit_list_emblem( PurpleBuddy* buddy ) | 263 static const char* mxit_list_emblem( PurpleBuddy* buddy ) |
261 { | 264 { |
262 struct contact* contact = buddy->proto_data; | 265 struct contact* contact = purple_buddy_get_protocol_data(buddy); |
263 | 266 |
264 if ( !contact ) | 267 if ( !contact ) |
265 return NULL; | 268 return NULL; |
266 | 269 |
267 /* subscription state is Pending, Rejected or Deleted */ | 270 /* subscription state is Pending, Rejected or Deleted */ |
298 * @param buddy The buddy. | 301 * @param buddy The buddy. |
299 * @return The status text | 302 * @return The status text |
300 */ | 303 */ |
301 char* mxit_status_text( PurpleBuddy* buddy ) | 304 char* mxit_status_text( PurpleBuddy* buddy ) |
302 { | 305 { |
303 struct contact* contact = buddy->proto_data; | 306 struct contact* contact = purple_buddy_get_protocol_data(buddy); |
304 | 307 |
305 if ( !contact ) | 308 if ( !contact ) |
306 return NULL; | 309 return NULL; |
307 | 310 |
308 if ( contact->statusMsg ) { | 311 if ( contact->statusMsg ) { |
323 * @param info The tooltip info being returned | 326 * @param info The tooltip info being returned |
324 * @param full Return full or summarized information | 327 * @param full Return full or summarized information |
325 */ | 328 */ |
326 static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboolean full ) | 329 static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboolean full ) |
327 { | 330 { |
328 struct contact* contact = buddy->proto_data; | 331 struct contact* contact = purple_buddy_get_protocol_data(buddy); |
329 | 332 |
330 if ( !contact ) | 333 if ( !contact ) |
331 return; | 334 return; |
332 | 335 |
333 /* status (reference: "libpurple/notify.h") */ | 336 /* status (reference: "libpurple/notify.h") */ |
459 { | 462 { |
460 struct contact* contact; | 463 struct contact* contact; |
461 | 464 |
462 purple_debug_info( MXIT_PLUGIN_ID, "mxit_free_buddy\n" ); | 465 purple_debug_info( MXIT_PLUGIN_ID, "mxit_free_buddy\n" ); |
463 | 466 |
464 contact = buddy->proto_data; | 467 contact = purple_buddy_get_protocol_data(buddy); |
465 if ( contact ) { | 468 if ( contact ) { |
466 if ( contact->statusMsg ) | 469 if ( contact->statusMsg ) |
467 g_free( contact->statusMsg ); | 470 g_free( contact->statusMsg ); |
468 if ( contact->avatarId ) | 471 if ( contact->avatarId ) |
469 g_free( contact->avatarId ); | 472 g_free( contact->avatarId ); |
470 g_free( contact ); | 473 g_free( contact ); |
471 } | 474 } |
472 buddy->proto_data = NULL; | 475 |
476 purple_buddy_set_protocol_data(buddy, NULL); | |
473 } | 477 } |
474 | 478 |
475 | 479 |
476 /*------------------------------------------------------------------------ | 480 /*------------------------------------------------------------------------ |
477 * Periodic task called every KEEPALIVE_INTERVAL (30 sec) to to maintain | 481 * Periodic task called every KEEPALIVE_INTERVAL (30 sec) to to maintain |