# HG changeset patch # User Richard Laager # Date 1189965955 0 # Node ID 5bc492d82ff42499266378928c1008212179de95 # Parent bfa1557a77739d25da8ac29ce747c913a81312b5# Parent 7aaebdb013c97a3e0d9bcabd4fa5f4d119892ee1 explicit merge of '46d8a45835e685c9dd812f5c6c0df074388bec8a' and 'fa439470adac87fe2027a307e96c857766b06d12' diff -r 7aaebdb013c9 -r 5bc492d82ff4 ChangeLog.API --- a/ChangeLog.API Sun Sep 16 18:05:12 2007 +0000 +++ b/ChangeLog.API Sun Sep 16 18:05:55 2007 +0000 @@ -9,6 +9,15 @@ * serv_send_attention(), serv_got_attention(), as well as send_attention and attention_types in PurplePluginProtocolInfo. This new API is used for zapping in MySpaceIM, buzzing in Yahoo, and nudging in MSN. + * PurpleConvMessage structure to represent a message in a + conversation. purple_conversation_message_get_sender, + purple_conversation_message_get_message, + purple_conversation_message_get_flags and + purple_conversation_message_get_timestamp to get information about a + PurpleConvMessage. + * purple_conversation_get_message_history() to retrieve a list of + PurpleConvMessage's in a conversation, and + purple_conversation_clear_message_history to clear the history. Changed: * purple_prefs_load is now called within purple_prefs_init. diff -r 7aaebdb013c9 -r 5bc492d82ff4 Doxyfile.in diff -r 7aaebdb013c9 -r 5bc492d82ff4 autogen.sh diff -r 7aaebdb013c9 -r 5bc492d82ff4 doc/TracHeader.html diff -r 7aaebdb013c9 -r 5bc492d82ff4 finch/libgnt/test/Makefile diff -r 7aaebdb013c9 -r 5bc492d82ff4 finch/libgnt/test/file.c diff -r 7aaebdb013c9 -r 5bc492d82ff4 finch/libgnt/test/menu.c diff -r 7aaebdb013c9 -r 5bc492d82ff4 finch/libgnt/test/tv.c diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/Makefile.am diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/conversation.c --- a/libpurple/conversation.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/conversation.c Sun Sep 16 18:05:55 2007 +0000 @@ -39,7 +39,6 @@ static GList *ims = NULL; static GList *chats = NULL; static PurpleConversationUiOps *default_ops = NULL; -static GHashTable *histories = NULL; void purple_conversations_set_ui_ops(PurpleConversationUiOps *ops) @@ -209,7 +208,6 @@ add_message_to_history(PurpleConversation *conv, const char *who, const char *message, PurpleMessageFlags flags, time_t when) { - GList *list; PurpleConvMessage *msg; if (flags & PURPLE_MESSAGE_SEND) { @@ -228,9 +226,7 @@ msg->what = g_strdup(message); msg->when = when; - list = g_hash_table_lookup(histories, conv); - list = g_list_prepend(list, msg); - g_hash_table_insert(histories, conv, list); + conv->message_history = g_list_prepend(conv->message_history, msg); } static void @@ -2068,14 +2064,14 @@ void purple_conversation_clear_message_history(PurpleConversation *conv) { - GList *list = g_hash_table_lookup(histories, conv); + GList *list = conv->message_history; message_history_free(list); - g_hash_table_remove(histories, conv); + conv->message_history = NULL; } GList *purple_conversation_get_message_history(PurpleConversation *conv) { - return g_hash_table_lookup(histories, conv); + return conv->message_history; } const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) @@ -2382,9 +2378,6 @@ purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONVERSATION), purple_value_new(PURPLE_TYPE_BOXED, "GList **")); - - /* Initialize the history */ - histories = g_hash_table_new(g_direct_hash, g_direct_equal); } void @@ -2393,6 +2386,5 @@ while (conversations) purple_conversation_destroy((PurpleConversation*)conversations->data); purple_signals_unregister_by_instance(purple_conversations_get_handle()); - g_hash_table_destroy(histories); - histories = NULL; } + diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/conversation.h --- a/libpurple/conversation.h Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/conversation.h Sun Sep 16 18:05:55 2007 +0000 @@ -327,7 +327,7 @@ GHashTable *data; /**< Plugin-specific data. */ PurpleConnectionFlags features; /**< The supported features */ - + GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ }; #ifdef __cplusplus diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/dbus-analyze-functions.py --- a/libpurple/dbus-analyze-functions.py Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/dbus-analyze-functions.py Sun Sep 16 18:05:55 2007 +0000 @@ -26,6 +26,11 @@ "purple_conv_placement_get_current_func", "purple_conv_placement_set_current_func", + # Similar to the above: + "purple_account_set_register_callback", + "purple_account_unregister", + "purple_connection_new_unregister", + # This is excluded because this script treats PurpleLogReadFlags* # as pointer to a struct, instead of a pointer to an enum. This # causes a compilation error. Someone should fix this script. diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/plugins/statenotify.c diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/Makefile.mingw --- a/libpurple/protocols/jabber/Makefile.mingw Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/Makefile.mingw Sun Sep 16 18:05:55 2007 +0000 @@ -42,8 +42,11 @@ ## ## SOURCES, OBJECTS ## -C_SRC = auth.c \ +C_SRC = \ + adhoccommands.c \ + auth.c \ buddy.c \ + caps.c \ chat.c \ disco.c \ google.c \ @@ -53,10 +56,14 @@ message.c \ oob.c \ parser.c \ + pep.c \ ping.c \ presence.c \ roster.c \ si.c \ + usermood.c \ + usernick.c \ + usertune.c \ xdata.c \ win32/posix.uname.c diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/adhoccommands.c --- a/libpurple/protocols/jabber/adhoccommands.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/adhoccommands.c Sun Sep 16 18:05:55 2007 +0000 @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "adhoccommands.h" #include #include @@ -264,7 +266,7 @@ jabber_iq_send(iq); } -void jabber_adhoc_server_execute(PurplePluginAction *action) { +static void jabber_adhoc_server_execute(PurplePluginAction *action) { JabberAdHocCommands *cmd = action->user_data; if(cmd) { PurpleConnection *gc = (PurpleConnection *) action->context; diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/caps.c Sun Sep 16 18:05:55 2007 +0000 @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "caps.h" #include #include "internal.h" @@ -464,19 +466,22 @@ JabberCapsValue *client; JabberCapsKey *key = g_new0(JabberCapsKey, 1); char *originalext = g_strdup(ext); - char *oneext, *ctx; jabber_caps_cbplususerdata *userdata = g_new0(jabber_caps_cbplususerdata, 1); userdata->cb = cb; userdata->user_data = user_data; userdata->who = g_strdup(who); userdata->node = g_strdup(node); userdata->ver = g_strdup(ver); - - if(originalext) - for(oneext = strtok_r(originalext, " ", &ctx); oneext; oneext = strtok_r(NULL, " ", &ctx)) { - userdata->ext = g_list_append(userdata->ext,g_strdup(oneext)); + + if(originalext) { + gchar **tmp; + gchar **splat = g_strsplit(originalext, " ", 0); + for(tmp = splat; *tmp; tmp++) { + userdata->ext = g_list_append(userdata->ext, tmp); ++userdata->extOutstanding; } + g_free(splat); + } g_free(originalext); key->node = g_strdup(node); diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/jabber.h --- a/libpurple/protocols/jabber/jabber.h Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sun Sep 16 18:05:55 2007 +0000 @@ -34,7 +34,7 @@ JABBER_CAP_IQ_SEARCH = 1 << 7, JABBER_CAP_IQ_REGISTER = 1 << 8, - /* Google Talk extensions: + /* Google Talk extensions: * http://code.google.com/apis/talk/jep_extensions/extensions.html */ JABBER_CAP_GMAIL_NOTIFY = 1 << 9, diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/message.c --- a/libpurple/protocols/jabber/message.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/message.c Sun Sep 16 18:05:55 2007 +0000 @@ -301,7 +301,7 @@ c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from); - str = g_strdup_printf(_("%s just sent you a Buzz!"), username); + str = g_strdup_printf(_("%s has buzzed you!"), username); purple_conversation_write(c, NULL, str, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); g_free(username); diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/pep.c --- a/libpurple/protocols/jabber/pep.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/pep.c Sun Sep 16 18:05:55 2007 +0000 @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "pep.h" #include "iq.h" #include @@ -107,21 +109,22 @@ void jabber_pep_publish(JabberStream *js, xmlnode *publish) { JabberIq *iq; - + xmlnode *pubsub; + if(js->pep != TRUE) { /* ignore when there's no PEP support on the server */ xmlnode_free(publish); return; } - + iq = jabber_iq_new(js, JABBER_IQ_SET); - - xmlnode *pubsub = xmlnode_new("pubsub"); + + pubsub = xmlnode_new("pubsub"); xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); - + xmlnode_insert_child(pubsub, publish); - + xmlnode_insert_child(iq->node, pubsub); - + jabber_iq_send(iq); } diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Sun Sep 16 18:05:55 2007 +0000 @@ -209,9 +209,9 @@ js->old_length = length; js->old_track = g_strdup(track); } - -#undef CHANGED(a,b) - + +#undef CHANGED + jabber_presence_fake_to_self(js, status); } diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/usermood.c --- a/libpurple/protocols/jabber/usermood.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/usermood.c Sun Sep 16 18:05:55 2007 +0000 @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "usermood.h" #include "pep.h" #include @@ -125,18 +127,17 @@ } } if (newmood != NULL) { + const char *status_id; JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL); if(!resource) { /* huh? */ - if (moodtext) - g_free(moodtext); + g_free(moodtext); return; } - const char *status_id = jabber_buddy_state_get_status_id(resource->state); - + status_id = jabber_buddy_state_get_status_id(resource->state); + purple_prpl_got_user_status(js->gc->account, from, status_id, "mood", _(newmood), "moodtext", moodtext?moodtext:"", NULL); } - if (moodtext) - g_free(moodtext); + g_free(moodtext); } void jabber_mood_init(void) { diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/usernick.c --- a/libpurple/protocols/jabber/usernick.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/usernick.c Sun Sep 16 18:05:55 2007 +0000 @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "usernick.h" #include "pep.h" #include diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/usertune.c --- a/libpurple/protocols/jabber/usertune.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/usertune.c Sun Sep 16 18:05:55 2007 +0000 @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "usertune.h" #include "pep.h" #include diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/jabber/xdata.c --- a/libpurple/protocols/jabber/xdata.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/jabber/xdata.c Sun Sep 16 18:05:55 2007 +0000 @@ -172,8 +172,8 @@ data->values = g_slist_delete_link(data->values, data->values); } if (data->actions) { + GList *action; hasActions = TRUE; - GList *action; for(action = data->actions; action; action = g_list_next(action)) { g_free(action->data); } diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/msn/msn.c Sun Sep 16 18:05:55 2007 +0000 @@ -119,7 +119,6 @@ return TRUE; } -#ifdef MSN_USE_ATTENTION_API static GList * msn_attention_types(PurpleAccount *account) { @@ -128,7 +127,7 @@ if (!list) { attn = g_new0(PurpleAttentionType, 1); - attn->name = _("nudge"); + attn->name = _("Nudge"); attn->incoming_description = _("%s has nudged you!"); attn->outgoing_description = _("Nudging %s..."); list = g_list_append(list, attn); @@ -136,7 +135,6 @@ return list; } -#endif static PurpleCmdRet @@ -148,14 +146,7 @@ username = purple_conversation_get_name(conv); -#ifdef MSN_USE_ATTENTION_API serv_send_attention(gc, username, MSN_NUDGE); -#else - if (!msn_send_attention(gc, username, MSN_NUDGE)) - return PURPLE_CMD_RET_FAILED; - - purple_conversation_write(conv, NULL, _("You have just sent a Nudge!"), PURPLE_MESSAGE_SYSTEM, time(NULL)); -#endif return PURPLE_CMD_RET_OK; } @@ -2258,15 +2249,10 @@ NULL, /* send_raw */ NULL, /* roomlist_room_serialize */ NULL, /* unregister_user */ - -#ifdef MSN_USE_ATTENTION_API msn_send_attention, /* send_attention */ msn_attention_types, /* attention_types */ -#else + /* padding */ - NULL, - NULL, -#endif NULL }; diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/msn/msn.h --- a/libpurple/protocols/msn/msn.h Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/msn/msn.h Sun Sep 16 18:05:55 2007 +0000 @@ -93,8 +93,6 @@ /* Index into attention_types */ #define MSN_NUDGE 0 -#define MSN_USE_ATTENTION_API - typedef enum { MSN_LIST_FL_OP = 0x01, diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/msn/switchboard.c --- a/libpurple/protocols/msn/switchboard.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/msn/switchboard.c Sun Sep 16 18:05:55 2007 +0000 @@ -974,12 +974,7 @@ else username = g_markup_escape_text(user, -1); -#ifdef MSN_USE_ATTENTION_API serv_got_attention(account->gc, buddy->name, MSN_NUDGE); -#else - str = g_strdup_printf(_("%s just sent you a Nudge!"), username); - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, str); -#endif g_free(username); g_free(str); } diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Sun Sep 16 18:05:55 2007 +0000 @@ -2924,14 +2924,9 @@ NULL, /* whiteboard_prpl_ops */ msim_send_really_raw, /* send_raw */ NULL, /* roomlist_room_serialize */ -#ifdef MSIM_USE_ATTENTION_API + NULL, /* unregister_user */ msim_send_attention, /* send_attention */ msim_attention_types, /* attention_types */ -#else - NULL, /* _purple_reserved1 */ - NULL, /* _purple_reserved2 */ -#endif - NULL, /* _purple_reserved3 */ NULL /* _purple_reserved4 */ }; diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/myspace/myspace.h --- a/libpurple/protocols/myspace/myspace.h Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.h Sun Sep 16 18:05:55 2007 +0000 @@ -73,10 +73,6 @@ * you want to actually use the plugin! */ /*#define MSIM_SELF_TEST */ -/* Use the attention API for zaps? */ -/* Can't have until >=2.2.0, since is a new API. */ -#define MSIM_USE_ATTENTION_API - /* Constants */ /* Maximum length of a password that is acceptable. This is the limit @@ -180,22 +176,7 @@ #define MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS 1 #define MSIM_CONTACT_LIST_IMPORT_TOP_FRIENDS 2 -#ifdef MSIM_USE_ATTENTION_API #define MsimAttentionType PurpleAttentionType -#else -/* Different kinds of attention alerts. Not yet in libpurple, so define - * our own structure here. */ -typedef struct _MsimAttentionType MsimAttentionType; - -/** A type of "attention" message (zap, nudge, buzz, etc. depending on the - * protocol) that can be sent and received. */ -struct _MsimAttentionType { - const gchar *name; /**< Shown before sending. */ - const gchar *incoming_description; /**< Shown when sent. */ - const gchar *outgoing_description; /**< Shown when received. */ - const gchar *icon_name; -}; -#endif /* Functions */ gboolean msim_load(PurplePlugin *plugin); diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/myspace/zap.c --- a/libpurple/protocols/myspace/zap.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/myspace/zap.c Sun Sep 16 18:05:55 2007 +0000 @@ -92,36 +92,10 @@ { gchar *zap_string; gboolean rc; -#ifndef MSIM_USE_ATTENTION_API - GList *types; - MsimAttentionType *attn; - gchar *zap_description; -#endif g_return_val_if_fail(session != NULL, FALSE); g_return_val_if_fail(username != NULL, FALSE); - -#ifdef MSIM_USE_ATTENTION_API - /* serv_send_attention(session->gc, username, code); */ -#else - types = msim_attention_types(session->account); - - attn = g_list_nth_data(types, code); - if (!attn) { - return FALSE; - } - - - zap_description = g_strdup_printf("*** Attention: %s %s ***", attn->outgoing_description, - username); - - serv_got_im(session->gc, username, zap_description, - PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_SYSTEM, time(NULL)); - - g_free(zap_description); -#endif - /* Construct and send the actual zap command. */ zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code); @@ -165,11 +139,7 @@ zap = GPOINTER_TO_INT(zap_num_ptr); -#ifdef MSIM_USE_ATTENTION_API serv_send_attention(session->gc, buddy->name, zap); -#else - g_return_if_fail(msim_send_zap(session, buddy->name, zap)); -#endif } /** Return menu, if any, for a buddy list node. */ @@ -179,8 +149,6 @@ GList *menu, *zap_menu; GList *types; PurpleMenuAction *act; - /* Warning: hardcoded to match that in msim_attention_types. */ - const gchar *zap_names[10]; guint i; if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { @@ -188,7 +156,9 @@ return NULL; } - /* Names from official client. */ + zap_menu = NULL; + + /* TODO: get rid of once is accessible directly in GUI */ types = msim_attention_types(NULL); i = 0; do @@ -196,21 +166,16 @@ MsimAttentionType *attn; attn = (MsimAttentionType *)types->data; - zap_names[i] = attn->name; + + act = purple_menu_action_new(attn->name, PURPLE_CALLBACK(msim_send_zap_from_menu), + GUINT_TO_POINTER(i), NULL); + zap_menu = g_list_append(zap_menu, act); + ++i; } while ((types = g_list_next(types))); - menu = zap_menu = NULL; - - /* TODO: get rid of once is accessible directly in GUI */ - for (i = 0; i < sizeof(zap_names) / sizeof(zap_names[0]); ++i) { - act = purple_menu_action_new(zap_names[i], PURPLE_CALLBACK(msim_send_zap_from_menu), - GUINT_TO_POINTER(i), NULL); - zap_menu = g_list_append(zap_menu, act); - } - act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu); - menu = g_list_append(menu, act); + menu = g_list_append(NULL, act); return menu; } @@ -221,21 +186,6 @@ { gchar *msg_text, *username; gint zap; -#ifndef MSIM_USE_ATTENTION_API - const gchar *zap_past_tense[10]; - gchar *zap_text; - - zap_past_tense[0] = _("zapped"); - zap_past_tense[1] = _("whacked"); - zap_past_tense[2] = _("torched"); - zap_past_tense[3] = _("smooched"); - zap_past_tense[4] = _("hugged"); - zap_past_tense[5] = _("bslapped"); - zap_past_tense[6] = _("goosed"); - zap_past_tense[7] = _("hi-fived"); - zap_past_tense[8] = _("punk'd"); - zap_past_tense[9] = _("raspberried"); -#endif msg_text = msim_msg_get_string(msg, "msg"); username = msim_msg_get_string(msg, "_username"); @@ -247,14 +197,7 @@ zap = CLAMP(zap, 0, 9); -#ifdef MSIM_USE_ATTENTION_API serv_got_attention(session->gc, username, zap); -#else - zap_text = g_strdup_printf(_("*** You have been %s! ***"), zap_past_tense[zap]); - serv_got_im(session->gc, username, zap_text, - PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(zap_text); -#endif g_free(msg_text); g_free(username); diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Sun Sep 16 18:05:55 2007 +0000 @@ -909,13 +909,8 @@ else username = g_markup_escape_text(im->from, -1); -#ifdef YAHOO_USE_ATTENTION_API serv_got_attention(gc, username, YAHOO_BUZZ); -#else - str = g_strdup_printf(_("%s just sent you a Buzz!"), username); - - purple_conversation_write(c, NULL, str, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, im->time); -#endif + g_free(username); g_free(str); g_free(m); @@ -4037,22 +4032,11 @@ static PurpleCmdRet yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { PurpleAccount *account = purple_conversation_get_account(c); -#ifndef YAHOO_USE_ATTENTION_API - const char *username = purple_account_get_username(account); -#endif if (*args && args[0]) return PURPLE_CMD_RET_FAILED; -#ifdef YAHOO_USE_ATTENTION_API serv_send_attention(account->gc, c->name, YAHOO_BUZZ); -#else - - purple_debug(PURPLE_DEBUG_INFO, "yahoo", - "Sending on account %s to buddy %s.\n", username, c->name); - purple_conv_im_send(PURPLE_CONV_IM(c), ""); - purple_conversation_write(c, NULL, _("You have just sent a Buzz!"), PURPLE_MESSAGE_SYSTEM, time(NULL)); -#endif return PURPLE_CMD_RET_OK; } @@ -4129,7 +4113,7 @@ /* Yahoo only supports one attention command: the 'buzz'. */ /* This is index number YAHOO_BUZZ. */ attn = g_new0(PurpleAttentionType, 1); - attn->name = _("buzz"); + attn->name = _("Buzz"); attn->incoming_description = _("%s has buzzed you!"); attn->outgoing_description = _("Buzzing %s..."); list = g_list_append(list, attn); @@ -4347,13 +4331,8 @@ NULL, /* roomlist_room_serialize */ NULL, /* unregister_user */ -#ifdef YAHOO_USE_ATTENTION_API yahoo_send_attention, yahoo_attention_types, -#else - NULL, - NULL, -#endif /* padding */ NULL diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/protocols/yahoo/yahoo.h --- a/libpurple/protocols/yahoo/yahoo.h Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/protocols/yahoo/yahoo.h Sun Sep 16 18:05:55 2007 +0000 @@ -67,12 +67,8 @@ #define YAHOO_STATUS_TYPE_INVISIBLE "invisible" #define YAHOO_STATUS_TYPE_MOBILE "mobile" -#define YAHOO_USE_ATTENTION_API - -#ifdef YAHOO_USE_ATTENTION_API /* Index into attention types list. */ #define YAHOO_BUZZ 0 -#endif enum yahoo_status { YAHOO_STATUS_AVAILABLE = 0, diff -r 7aaebdb013c9 -r 5bc492d82ff4 libpurple/server.c --- a/libpurple/server.c Sun Sep 16 18:05:12 2007 +0000 +++ b/libpurple/server.c Sun Sep 16 18:05:55 2007 +0000 @@ -253,7 +253,7 @@ prpl = purple_find_prpl(purple_account_get_protocol_id(account)); /* Lookup the attention type in the protocol's attention_types list, if any. */ - get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->attention_types; + get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->get_attention_types; if (get_attention_types) { GList *attention_types; @@ -274,7 +274,8 @@ PurplePlugin *prpl; PurpleConversation *conv; gboolean (*send_attention)(PurpleConnection *, const char *, guint); - + PurpleBuddy *buddy; + const char *alias; gchar *description; time_t mtime; @@ -289,10 +290,15 @@ attn = purple_get_attention_type_from_code(gc->account, type_code); + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) + alias = purple_buddy_get_contact_alias(buddy); + else + alias = who; + if (attn && attn->outgoing_description) { - description = g_strdup_printf(attn->outgoing_description, who); + description = g_strdup_printf(attn->outgoing_description, alias); } else { - description = g_strdup_printf(_("Requesting %s's attention..."), who); + description = g_strdup_printf(_("Requesting %s's attention..."), alias); } flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; @@ -314,6 +320,8 @@ { PurpleMessageFlags flags; PurpleAttentionType *attn; + PurpleBuddy *buddy; + const char *alias; gchar *description; time_t mtime; @@ -327,10 +335,15 @@ /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display * it next to the attention command. And if it is null, display a generic icon. */ + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) + alias = purple_buddy_get_contact_alias(buddy); + else + alias = who; + if (attn && attn->incoming_description) { - description = g_strdup_printf(attn->incoming_description, who); + description = g_strdup_printf(attn->incoming_description, alias); } else { - description = g_strdup(_("%s has requested your attention!")); + description = g_strdup_printf(_("%s has requested your attention!"), alias); } purple_debug_info("server", "serv_got_attention: got '%s' from %s\n", diff -r 7aaebdb013c9 -r 5bc492d82ff4 pidgin/plugins/perl/common/GtkDialogs.xs