Mercurial > pidgin-twitter
changeset 37:bafe2abf2d3b
- made suppress oops configurable
- restored accidentally truncated twitter_error macro
- fixed typos
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Sun, 11 May 2008 15:24:53 +0900 |
parents | ae1d059fa6fe |
children | 625e385036c3 |
files | pidgin-twitter.c |
diffstat | 1 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin-twitter.c Sun May 11 03:52:06 2008 +0900 +++ b/pidgin-twitter.c Sun May 11 15:24:53 2008 +0900 @@ -51,15 +51,15 @@ #define OPT_USERLIST_RECIPIENT OPT_PIDGINTWITTER "/userlist_recipient" #define OPT_USERLIST_SENDER OPT_PIDGINTWITTER "/userlist_sender" #define OPT_COUNTER OPT_PIDGINTWITTER "/counter" +#define OPT_SUPPRESS_OOPS OPT_PIDGINTWITTER "/suppress_oops" #define RECIPIENT_FORMAT "@<a href='http://twitter.com/%s'>%s</a>" #define SENDER_FORMAT "<a href='http://twitter.com/%s'>%s</a>: " #define DEFAULT_LIST "(list of users: separated with ' ,:;')" #define OOPS_MESSAGE "<body>Oops! Your update was over 140 characters. We sent the short version to your friends (they can view the entire update on the web).<BR></body>" -#define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, \ - fmt, ## __VA_ARGS__); -#define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, \ +#define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, fmt, ## __VA_ARGS__); +#define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, fmt, ## __VA_ARGS__); /* globals */ static GRegex *regp[5]; @@ -368,6 +368,7 @@ g_object_set_data(G_OBJECT(box), PLUGIN_ID "-counter", NULL); } + /* remove separator */ sep = g_object_get_data(G_OBJECT(box), PLUGIN_ID "-sep"); if (sep) { @@ -468,9 +469,9 @@ PurpleConversation *conv, PurpleMessageFlags *flags, void *data) { twitter_debug("receiving_im_cb: buffer = %s\n", *buffer); + twitter_debug("receiving_im_cb: suppress_oops = %d\n", suppress_oops); - twitter_debug("receiving_im_cb: suppress_oops = %d\n", suppress_oops); - if(!suppress_oops) + if(!suppress_oops || !purple_prefs_get_bool(OPT_SUPPRESS_OOPS)) return FALSE; if(strstr(*buffer, OOPS_MESSAGE)) { @@ -508,7 +509,7 @@ regp[SENDER_WITH_LINK] = g_regex_new( "@(?:<font .+?>)?<a href=.+?>([A-Za-z0-9_]+?)</a>(?:</font>)?", 0, 0, NULL); - /* attach counter to the existing twitter window*/ + /* attach counter to the existing twitter window */ gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); if(enabled) { attach_to_window(); @@ -555,7 +556,7 @@ { gboolean enabled = purple_prefs_get_bool(OPT_COUNTER); if(enabled) { - attach_to_window(); //xxx shoud check whether already attached or not. + attach_to_window(); //xxx should check whether already attached or not? } else { detach_from_window(); @@ -599,7 +600,7 @@ "Escape pseudo command string"); purple_plugin_pref_frame_add(frame, pref); - /* comaescape pseudo command setting */ + /* show text counter */ pref = purple_plugin_pref_new_with_name_and_label( OPT_COUNTER, "Show text counter"); @@ -608,6 +609,13 @@ purple_prefs_connect_callback(plugin, OPT_COUNTER, counter_prefs_cb, NULL); + /* suppress oops message */ + pref = purple_plugin_pref_new_with_name_and_label( + OPT_SUPPRESS_OOPS, + "Suppress oops message"); + purple_plugin_pref_frame_add(frame, pref); + + /*****************/ /* sound heading */ /*****************/ @@ -725,6 +733,7 @@ purple_prefs_add_string(OPT_USERLIST_SENDER, DEFAULT_LIST); purple_prefs_add_bool(OPT_COUNTER, TRUE); + purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE); } PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)