Mercurial > pidgin
changeset 19463:3f6f84d11ce2
Change serv_send_attention() to call prpl_info->send_attention(), and
other minor improvements. Update msimprpl with attention changes.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Mon, 27 Aug 2007 05:37:40 +0000 |
parents | 105305518622 |
children | ca45543c11a3 |
files | libpurple/protocols/myspace/zap.c libpurple/prpl.h libpurple/server.c |
diffstat | 3 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/zap.c Mon Aug 27 02:29:15 2007 +0000 +++ b/libpurple/protocols/myspace/zap.c Mon Aug 27 05:37:40 2007 +0000 @@ -81,9 +81,7 @@ return FALSE; } - /* TODO: make use of the MsimAttentionType we found, instead of - * doing it all over in msim_send_zap_from_menu. */ - msim_send_zap_from_menu(&buddy->node, GUINT_TO_POINTER(code)); + msim_send_zap(session, username, code); return TRUE; } @@ -105,7 +103,7 @@ #ifdef MSIM_USE_ATTENTION_API - serv_send_attention(session->gc, username, code); + /* serv_send_attention(session->gc, username, code); */ #else types = msim_attention_types(session->account); @@ -167,7 +165,11 @@ 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. */
--- a/libpurple/prpl.h Mon Aug 27 02:29:15 2007 +0000 +++ b/libpurple/prpl.h Mon Aug 27 05:37:40 2007 +0000 @@ -348,9 +348,9 @@ char *(*roomlist_room_serialize)(PurpleRoomlistRoom *room); /* Attention API for sending & receiving zaps/nudges/buzzes etc. */ - gboolean (*send_attention)(PurpleConnection *gc, - const char *username, guint type); + gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); GList *(*attention_types)(PurpleAccount *acct); + void (*_purple_reserved3)(void); void (*_purple_reserved4)(void); };
--- a/libpurple/server.c Mon Aug 27 02:29:15 2007 +0000 +++ b/libpurple/server.c Mon Aug 27 05:37:40 2007 +0000 @@ -246,18 +246,18 @@ { PurplePlugin *prpl; PurpleAttentionType* attn; - GList *(*function)(PurpleAccount *); + GList *(*get_attention_types)(PurpleAccount *); g_return_val_if_fail(account != NULL, NULL); prpl = purple_find_prpl(purple_account_get_protocol_id(account)); /* Lookup the attention type in the protocol's attention_types list, if any. */ - function = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->attention_types; - if (function) { + get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->attention_types; + if (get_attention_types) { GList *attention_types; - attention_types = function(account); + attention_types = get_attention_types(account); attn = (PurpleAttentionType *)g_list_nth_data(attention_types, type_code); } else { attn = NULL; @@ -271,12 +271,19 @@ { PurpleAttentionType *attn; PurpleMessageFlags flags; + PurplePlugin *prpl; + gboolean (*send_attention)(PurpleConnection *, const char *, guint); + gchar *description; time_t mtime; g_return_if_fail(gc != NULL); g_return_if_fail(who != NULL); + prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); + send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; + g_return_if_fail(send_attention != NULL); + mtime = time(NULL); attn = purple_get_attention_type_from_code(gc->account, type_code); @@ -289,8 +296,13 @@ flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; + purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", + description, who); + + if (!send_attention(gc, who, type_code)) + return; + /* TODO: icons, sound, shaking... same as serv_got_attention(). */ - serv_got_im(gc, who, description, flags, mtime); g_free(description); @@ -320,6 +332,9 @@ description = g_strdup(_("Attention!")); } + purple_debug_info("server", "serv_got_attention: got '%s' from %s\n", + description, who); + serv_got_im(gc, who, description, flags, mtime); /* TODO: sounds (depending on PurpleAttentionType), shaking, etc. */