diff options
author | Richard Laager <rlaager@pidgin.im> | 2007-09-16 18:05:55 +0000 |
---|---|---|
committer | Richard Laager <rlaager@pidgin.im> | 2007-09-16 18:05:55 +0000 |
commit | 1f6d3b1753ce584eef36f2021c50007d37cc98a6 (patch) | |
tree | dd981dfb8350f1f49fddaf3b9b3bd1533cd141c9 | |
parent | 7b9eb07afd61674aadc02c6a5f4e6574fba4bd28 (diff) | |
parent | 468ed1f81d585d8f83efeaa09e1e980b7c1320ab (diff) | |
download | pidgin-1f6d3b1753ce584eef36f2021c50007d37cc98a6.tar.gz |
explicit merge of '3acb9a4cc48670e13f0995a13284c8f696a5dcbd'
and '7084ffd61bece4cfdb7a3b4756f10964f4d03fca'
24 files changed, 99 insertions, 185 deletions
diff --git a/ChangeLog.API b/ChangeLog.API index a4b0d5f886..92a4572481 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -9,6 +9,15 @@ Version 2.2.0 (??/??/????): * 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 --git a/libpurple/conversation.c b/libpurple/conversation.c index 6b6c8273c3..4cb598c252 100644 --- a/libpurple/conversation.c +++ b/libpurple/conversation.c @@ -39,7 +39,6 @@ static GList *conversations = NULL; 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 @@ static void 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 @@ add_message_to_history(PurpleConversation *conv, const char *who, const char *me 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 @@ purple_conversation_get_extended_menu(PurpleConversation *conv) 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_conversations_init(void) 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 @@ purple_conversations_uninit(void) 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 --git a/libpurple/conversation.h b/libpurple/conversation.h index 3854e8c38a..317f91f6c2 100644 --- a/libpurple/conversation.h +++ b/libpurple/conversation.h @@ -327,7 +327,7 @@ struct _PurpleConversation GHashTable *data; /**< Plugin-specific data. */ PurpleConnectionFlags features; /**< The supported features */ - + GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ }; #ifdef __cplusplus diff --git a/libpurple/dbus-analyze-functions.py b/libpurple/dbus-analyze-functions.py index 2a18f5e5c0..a449b88b6d 100644 --- a/libpurple/dbus-analyze-functions.py +++ b/libpurple/dbus-analyze-functions.py @@ -26,6 +26,11 @@ excluded = [\ "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 --git a/libpurple/protocols/jabber/Makefile.mingw b/libpurple/protocols/jabber/Makefile.mingw index 40709aae7a..e825fd029a 100644 --- a/libpurple/protocols/jabber/Makefile.mingw +++ b/libpurple/protocols/jabber/Makefile.mingw @@ -42,8 +42,11 @@ LIB_PATHS += -L$(GTK_TOP)/lib \ ## ## 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 @@ C_SRC = auth.c \ 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 --git a/libpurple/protocols/jabber/adhoccommands.c b/libpurple/protocols/jabber/adhoccommands.c index dc96d69e9f..ac00639a59 100644 --- a/libpurple/protocols/jabber/adhoccommands.c +++ b/libpurple/protocols/jabber/adhoccommands.c @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "adhoccommands.h" #include <assert.h> #include <string.h> @@ -264,7 +266,7 @@ void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd) { 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 --git a/libpurple/protocols/jabber/caps.c b/libpurple/protocols/jabber/caps.c index f1dd619e2c..e2404be062 100644 --- a/libpurple/protocols/jabber/caps.c +++ b/libpurple/protocols/jabber/caps.c @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "caps.h" #include <string.h> #include "internal.h" @@ -464,19 +466,22 @@ void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, c 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 --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h index 6817337d76..97d762b6e9 100644 --- a/libpurple/protocols/jabber/jabber.h +++ b/libpurple/protocols/jabber/jabber.h @@ -34,7 +34,7 @@ typedef enum { 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 --git a/libpurple/protocols/jabber/message.c b/libpurple/protocols/jabber/message.c index b021ae9487..63bff2a31a 100644 --- a/libpurple/protocols/jabber/message.c +++ b/libpurple/protocols/jabber/message.c @@ -301,7 +301,7 @@ static void handle_buzz(JabberMessage *jm) { 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 --git a/libpurple/protocols/jabber/pep.c b/libpurple/protocols/jabber/pep.c index e82c259c1e..e7d849b184 100644 --- a/libpurple/protocols/jabber/pep.c +++ b/libpurple/protocols/jabber/pep.c @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "pep.h" #include "iq.h" #include <string.h> @@ -107,21 +109,22 @@ void jabber_handle_event(JabberMessage *jm) { 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 --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c index aed27991cb..4cee793623 100644 --- a/libpurple/protocols/jabber/presence.c +++ b/libpurple/protocols/jabber/presence.c @@ -209,9 +209,9 @@ void jabber_presence_send(PurpleAccount *account, PurpleStatus *status) js->old_length = length; js->old_track = g_strdup(track); } - -#undef CHANGED(a,b) - + +#undef CHANGED + jabber_presence_fake_to_self(js, status); } diff --git a/libpurple/protocols/jabber/usermood.c b/libpurple/protocols/jabber/usermood.c index 30f7e09c1e..6dc5f951c2 100644 --- a/libpurple/protocols/jabber/usermood.c +++ b/libpurple/protocols/jabber/usermood.c @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "usermood.h" #include "pep.h" #include <assert.h> @@ -125,18 +127,17 @@ static void jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) { } } 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 --git a/libpurple/protocols/jabber/usernick.c b/libpurple/protocols/jabber/usernick.c index fa8d9bbf57..ea5f7af86e 100644 --- a/libpurple/protocols/jabber/usernick.c +++ b/libpurple/protocols/jabber/usernick.c @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "usernick.h" #include "pep.h" #include <assert.h> diff --git a/libpurple/protocols/jabber/usertune.c b/libpurple/protocols/jabber/usertune.c index 03145e1f60..6b3f72e812 100644 --- a/libpurple/protocols/jabber/usertune.c +++ b/libpurple/protocols/jabber/usertune.c @@ -19,6 +19,8 @@ * */ +#include "internal.h" + #include "usertune.h" #include "pep.h" #include <assert.h> diff --git a/libpurple/protocols/jabber/xdata.c b/libpurple/protocols/jabber/xdata.c index 9ffa071eff..1326611560 100644 --- a/libpurple/protocols/jabber/xdata.c +++ b/libpurple/protocols/jabber/xdata.c @@ -172,8 +172,8 @@ static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, PurpleReque data->values = g_slist_delete_link(data->values, data->values); } if (data->actions) { - hasActions = TRUE; GList *action; + hasActions = TRUE; for(action = data->actions; action; action = g_list_next(action)) { g_free(action->data); } diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c index b2377a8653..80b70208f8 100644 --- a/libpurple/protocols/msn/msn.c +++ b/libpurple/protocols/msn/msn.c @@ -119,7 +119,6 @@ msn_send_attention(PurpleConnection *gc, const char *username, guint type) return TRUE; } -#ifdef MSN_USE_ATTENTION_API static GList * msn_attention_types(PurpleAccount *account) { @@ -128,7 +127,7 @@ msn_attention_types(PurpleAccount *account) 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 @@ msn_attention_types(PurpleAccount *account) return list; } -#endif static PurpleCmdRet @@ -148,14 +146,7 @@ msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar ** 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 @@ static PurplePluginProtocolInfo prpl_info = 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 --git a/libpurple/protocols/msn/msn.h b/libpurple/protocols/msn/msn.h index fac170fc70..80fbaa21b2 100644 --- a/libpurple/protocols/msn/msn.h +++ b/libpurple/protocols/msn/msn.h @@ -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 --git a/libpurple/protocols/msn/switchboard.c b/libpurple/protocols/msn/switchboard.c index 6384917a1b..c2bbde905d 100644 --- a/libpurple/protocols/msn/switchboard.c +++ b/libpurple/protocols/msn/switchboard.c @@ -974,12 +974,7 @@ nudge_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 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 --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c index b6cc75df7b..522c83a855 100644 --- a/libpurple/protocols/myspace/myspace.c +++ b/libpurple/protocols/myspace/myspace.c @@ -2924,14 +2924,9 @@ PurplePluginProtocolInfo prpl_info = { 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 --git a/libpurple/protocols/myspace/myspace.h b/libpurple/protocols/myspace/myspace.h index e2f56af779..1b43c9ea39 100644 --- a/libpurple/protocols/myspace/myspace.h +++ b/libpurple/protocols/myspace/myspace.h @@ -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 --git a/libpurple/protocols/myspace/zap.c b/libpurple/protocols/myspace/zap.c index 29eb4ebfbb..fdd0dd3b42 100644 --- a/libpurple/protocols/myspace/zap.c +++ b/libpurple/protocols/myspace/zap.c @@ -92,36 +92,10 @@ msim_send_zap(MsimSession *session, const gchar *username, guint code) {
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 @@ msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr) 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 @@ msim_blist_node_menu(PurpleBlistNode *node) 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 @@ msim_blist_node_menu(PurpleBlistNode *node) 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 @@ msim_blist_node_menu(PurpleBlistNode *node) MsimAttentionType *attn;
attn = (MsimAttentionType *)types->data;
- zap_names[i] = attn->name;
- ++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),
+ 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)));
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 @@ msim_incoming_zap(MsimSession *session, MsimMessage *msg) {
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 @@ msim_incoming_zap(MsimSession *session, MsimMessage *msg) 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 --git a/libpurple/protocols/yahoo/yahoo.c b/libpurple/protocols/yahoo/yahoo.c index 4b1f410041..2fbe680c1d 100644 --- a/libpurple/protocols/yahoo/yahoo.c +++ b/libpurple/protocols/yahoo/yahoo.c @@ -909,13 +909,8 @@ static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt 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 void yahoo_rename_group(PurpleConnection *gc, const char *old_name, 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 <ding> on account %s to buddy %s.\n", username, c->name); - purple_conv_im_send(PURPLE_CONV_IM(c), "<ding>"); - 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 @@ GList *yahoo_attention_types(PurpleAccount *account) /* 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 @@ static PurplePluginProtocolInfo prpl_info = 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 --git a/libpurple/protocols/yahoo/yahoo.h b/libpurple/protocols/yahoo/yahoo.h index 6ac3177b06..f5009641b9 100644 --- a/libpurple/protocols/yahoo/yahoo.h +++ b/libpurple/protocols/yahoo/yahoo.h @@ -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 --git a/libpurple/server.c b/libpurple/server.c index 8784ead789..31d5f31ed1 100644 --- a/libpurple/server.c +++ b/libpurple/server.c @@ -253,7 +253,7 @@ PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, 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 @@ serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) 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 @@ serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) 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 @@ serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) { PurpleMessageFlags flags; PurpleAttentionType *attn; + PurpleBuddy *buddy; + const char *alias; gchar *description; time_t mtime; @@ -327,10 +335,15 @@ serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) /* 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", |