comparison libpurple/protocols/jabber/jabber.c @ 29682:b2b1fa27047a

propagate from branch 'im.pidgin.pidgin' (head 13ac492a493b4d31c8b29905174b43a533304300) to branch 'im.pidgin.cpw.attention_ui' (head 347126c6f7434b4777f4fdc28ea1c8f796fe707e)
author Marcus Lundblad <ml@update.uu.se>
date Sat, 02 May 2009 06:39:51 +0000
parents 5aabe95773dd 4548c114e953
children 45795fd9c0a9
comparison
equal deleted inserted replaced
26836:836a36564ff5 29682:b2b1fa27047a
2775 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, 2775 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv,
2776 const char *cmd, char **args, char **error, void *data) 2776 const char *cmd, char **args, char **error, void *data)
2777 { 2777 {
2778 JabberStream *js = conv->account->gc->proto_data; 2778 JabberStream *js = conv->account->gc->proto_data;
2779 const gchar *who; 2779 const gchar *who;
2780 gchar *description;
2781 PurpleBuddy *buddy;
2782 const char *alias;
2783 PurpleAttentionType *attn =
2784 purple_get_attention_type_from_code(conv->account, 0);
2780 2785
2781 if (!args || !args[0]) { 2786 if (!args || !args[0]) {
2782 /* use the buddy from conversation, if it's a one-to-one conversation */ 2787 /* use the buddy from conversation, if it's a one-to-one conversation */
2783 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { 2788 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
2784 who = purple_conversation_get_name(conv); 2789 who = purple_conversation_get_name(conv);
2787 } 2792 }
2788 } else { 2793 } else {
2789 who = args[0]; 2794 who = args[0];
2790 } 2795 }
2791 2796
2792 if (_jabber_send_buzz(js, who, error)) { 2797 buddy = purple_find_buddy(conv->account, who);
2793 const gchar *alias; 2798 if (buddy != NULL)
2794 gchar *str; 2799 alias = purple_buddy_get_contact_alias(buddy);
2795 PurpleBuddy *buddy = 2800 else
2796 purple_find_buddy(purple_connection_get_account(conv->account->gc), 2801 alias = who;
2797 who); 2802
2798 2803 description =
2799 if (buddy != NULL) 2804 g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias);
2800 alias = purple_buddy_get_contact_alias(buddy); 2805 purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL));
2801 else 2806 purple_conversation_write(conv, NULL, description,
2802 alias = who; 2807 PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM, time(NULL));
2803 2808 g_free(description);
2804 str = g_strdup_printf(_("Buzzing %s..."), alias); 2809 return _jabber_send_buzz(js, who, error) ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED;
2805 purple_conversation_write(conv, NULL, str,
2806 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
2807 g_free(str);
2808
2809 return PURPLE_CMD_RET_OK;
2810 } else {
2811 return PURPLE_CMD_RET_FAILED;
2812 }
2813 } 2810 }
2814 2811
2815 GList *jabber_attention_types(PurpleAccount *account) 2812 GList *jabber_attention_types(PurpleAccount *account)
2816 { 2813 {
2817 static GList *types = NULL; 2814 static GList *types = NULL;