# HG changeset patch # User Yoshiki Yazawa # Date 1214587205 -32400 # Node ID 6b9593d1ffed4e6a40ebc4f03bccd5979b1abc0f # Parent 08bd4abdfd3df91dae205c67f4f7486f274eff6a quick hack to suppress annoying completion message from wassr. diff -r 08bd4abdfd3d -r 6b9593d1ffed pidgin-twitter.c --- a/pidgin-twitter.c Sat Jun 28 00:08:57 2008 +0900 +++ b/pidgin-twitter.c Sat Jun 28 02:20:05 2008 +0900 @@ -462,7 +462,7 @@ } return FALSE; } - + /* try to suppress oops message */ utflen = g_utf8_strlen(*buffer, -1); bytes = strlen(*buffer); @@ -820,6 +820,30 @@ return is_twitter_account(account, name); } +static gboolean +is_wassr_account(PurpleAccount *account, const char *name) +{ + const gchar *proto = purple_account_get_protocol_id(account); + + twitter_debug("name = %s proto = %s\n", name, proto); + + if(!strcmp(name, "wassr-bot@wassr.jp/bot") && + !strcmp(proto, "prpl-jabber")) { + return TRUE; + } + + return FALSE; +} + +static gboolean +is_wassr_conv(PurpleConversation *conv) +{ + const char *name = purple_conversation_get_name(conv); + PurpleAccount *account = purple_conversation_get_account(conv); + + return is_wassr_account(account, name); +} + static void conv_created_cb(PurpleConversation *conv, gpointer null) { @@ -852,6 +876,16 @@ /* Check if the conv is not NULL to avoid a clash. * conv is null when the conversation window has not opened yet. * And if check is a twitter conv. */ + + /* quick hack to suppress annoying completion message from wassr */ + if(conv && is_wassr_conv(conv)) { + if(strstr(*buffer, "投稿完了:")) { + twitter_debug("clearing sender and buffer\n"); + g_free(*sender); *sender = NULL; + g_free(*buffer); *buffer = NULL; + } + } + if(!(conv && is_twitter_conv(conv))) { return FALSE; } diff -r 08bd4abdfd3d -r 6b9593d1ffed pidgin-twitter.h --- a/pidgin-twitter.h Sat Jun 28 00:08:57 2008 +0900 +++ b/pidgin-twitter.h Sat Jun 28 02:20:05 2008 +0900 @@ -83,6 +83,8 @@ static void attach_to_gtkconv(PidginConversation *gtkconv, gpointer null); static gboolean is_twitter_account(PurpleAccount *account, const char *name); static gboolean is_twitter_conv(PurpleConversation *conv); +static gboolean is_wassr_account(PurpleAccount *account, const char *name); +static gboolean is_wassr_conv(PurpleConversation *conv); static void conv_created_cb(PurpleConversation *conv, gpointer null); static void deleting_conv_cb(PurpleConversation *conv); static gboolean receiving_im_cb(PurpleAccount *account, char **sender, char **buffer, PurpleConversation *conv, PurpleMessageFlags *flags, void *data);