comparison libpurple/protocols/jabber/jabber.c @ 29282:ae24e54a5014

propagate from branch 'im.pidgin.pidgin' (head 1890ad1259c93f5ad18ceb3365717ebc43b30198) to branch 'im.pidgin.cpw.attention_ui' (head b3be679bb2671eeaa83aae11c9d39e209f999b5d)
author Marcus Lundblad <ml@update.uu.se>
date Sat, 04 Apr 2009 10:51:12 +0000
parents da651b0f40a1 9407348dc714
children 676494d92262
comparison
equal deleted inserted replaced
26429:f171707b7d54 29282:ae24e54a5014
2543 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, 2543 static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv,
2544 const char *cmd, char **args, char **error, void *data) 2544 const char *cmd, char **args, char **error, void *data)
2545 { 2545 {
2546 JabberStream *js = conv->account->gc->proto_data; 2546 JabberStream *js = conv->account->gc->proto_data;
2547 const gchar *who; 2547 const gchar *who;
2548 gchar *description;
2549 PurpleBuddy *buddy;
2550 const char *alias;
2551 PurpleAttentionType *attn =
2552 purple_get_attention_type_from_code(conv->account, 0);
2548 2553
2549 if (!args || !args[0]) { 2554 if (!args || !args[0]) {
2550 /* use the buddy from conversation, if it's a one-to-one conversation */ 2555 /* use the buddy from conversation, if it's a one-to-one conversation */
2551 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { 2556 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
2552 who = purple_conversation_get_name(conv); 2557 who = purple_conversation_get_name(conv);
2555 } 2560 }
2556 } else { 2561 } else {
2557 who = args[0]; 2562 who = args[0];
2558 } 2563 }
2559 2564
2560 if (_jabber_send_buzz(js, who, error)) { 2565 buddy = purple_find_buddy(conv->account, who);
2561 const gchar *alias; 2566 if (buddy != NULL)
2562 gchar *str; 2567 alias = purple_buddy_get_contact_alias(buddy);
2563 PurpleBuddy *buddy = 2568 else
2564 purple_find_buddy(purple_connection_get_account(conv->account->gc), 2569 alias = who;
2565 who); 2570
2566 2571 description =
2567 if (buddy != NULL) 2572 g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias);
2568 alias = purple_buddy_get_contact_alias(buddy); 2573 purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL));
2569 else 2574 purple_conversation_write(conv, NULL, description,
2570 alias = who; 2575 PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM, time(NULL));
2571 2576 g_free(description);
2572 str = g_strdup_printf(_("Buzzing %s..."), alias); 2577 return _jabber_send_buzz(js, who, error) ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED;
2573 purple_conversation_write(conv, NULL, str,
2574 PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
2575 g_free(str);
2576
2577 return PURPLE_CMD_RET_OK;
2578 } else {
2579 return PURPLE_CMD_RET_FAILED;
2580 }
2581 } 2578 }
2582 2579
2583 GList *jabber_attention_types(PurpleAccount *account) 2580 GList *jabber_attention_types(PurpleAccount *account)
2584 { 2581 {
2585 static GList *types = NULL; 2582 static GList *types = NULL;