Mercurial > pidgin
comparison libpurple/prpl.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
| author | Elliott Sales de Andrade <qulogic@pidgin.im> |
|---|---|
| date | Sat, 02 Jun 2012 02:30:49 +0000 |
| parents | 2ec94166be43 |
| children |
comparison
equal
deleted
inserted
replaced
| 32818:01ff09d4a463 | 32819:2c6510167895 |
|---|---|
| 30 #include "util.h" | 30 #include "util.h" |
| 31 | 31 |
| 32 /**************************************************************************/ | 32 /**************************************************************************/ |
| 33 /** @name Attention Type API */ | 33 /** @name Attention Type API */ |
| 34 /**************************************************************************/ | 34 /**************************************************************************/ |
| 35 | |
| 36 struct _PurpleAttentionType | |
| 37 { | |
| 38 const char *name; /**< Shown in GUI elements */ | |
| 39 const char *incoming_description; /**< Shown when sent */ | |
| 40 const char *outgoing_description; /**< Shown when receied */ | |
| 41 const char *icon_name; /**< Icon to display (optional) */ | |
| 42 const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ | |
| 43 }; | |
| 44 | |
| 45 | |
| 35 PurpleAttentionType * | 46 PurpleAttentionType * |
| 36 purple_attention_type_new(const char *ulname, const char *name, | 47 purple_attention_type_new(const char *ulname, const char *name, |
| 37 const char *inc_desc, const char *out_desc) | 48 const char *inc_desc, const char *out_desc) |
| 38 { | 49 { |
| 39 PurpleAttentionType *attn = g_new0(PurpleAttentionType, 1); | 50 PurpleAttentionType *attn = g_new0(PurpleAttentionType, 1); |
| 433 time_t mtime; | 444 time_t mtime; |
| 434 | 445 |
| 435 g_return_if_fail(gc != NULL); | 446 g_return_if_fail(gc != NULL); |
| 436 g_return_if_fail(who != NULL); | 447 g_return_if_fail(who != NULL); |
| 437 | 448 |
| 438 prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); | 449 prpl = purple_find_prpl(purple_account_get_protocol_id(purple_connection_get_account(gc))); |
| 439 send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; | 450 send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; |
| 440 g_return_if_fail(send_attention != NULL); | 451 g_return_if_fail(send_attention != NULL); |
| 441 | 452 |
| 442 mtime = time(NULL); | 453 mtime = time(NULL); |
| 443 | 454 |
| 444 attn = purple_get_attention_type_from_code(gc->account, type_code); | 455 attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); |
| 445 | 456 |
| 446 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) | 457 if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) |
| 447 alias = purple_buddy_get_contact_alias(buddy); | 458 alias = purple_buddy_get_contact_alias(buddy); |
| 448 else | 459 else |
| 449 alias = who; | 460 alias = who; |
| 460 description, who); | 471 description, who); |
| 461 | 472 |
| 462 if (!send_attention(gc, who, type_code)) | 473 if (!send_attention(gc, who, type_code)) |
| 463 return; | 474 return; |
| 464 | 475 |
| 465 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who); | 476 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, purple_connection_get_account(gc), who); |
| 466 purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); | 477 purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); |
| 467 purple_prpl_attention(conv, who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); | 478 purple_prpl_attention(conv, who, type_code, PURPLE_MESSAGE_SEND, time(NULL)); |
| 468 | 479 |
| 469 g_free(description); | 480 g_free(description); |
| 470 } | 481 } |
| 479 gchar *description; | 490 gchar *description; |
| 480 time_t mtime; | 491 time_t mtime; |
| 481 | 492 |
| 482 mtime = time(NULL); | 493 mtime = time(NULL); |
| 483 | 494 |
| 484 attn = purple_get_attention_type_from_code(gc->account, type_code); | 495 attn = purple_get_attention_type_from_code(purple_connection_get_account(gc), type_code); |
| 485 | 496 |
| 486 /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ | 497 /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ |
| 487 flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; | 498 flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; |
| 488 | 499 |
| 489 /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display | 500 /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display |
