changeset 98:e460e1978ca3

- fixed a bug introduced in r97. - trimmed unnecessary debug messages.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 10 Jul 2008 20:26:22 +0900
parents 24ad534e438e
children f207cc8da6cd 86772af940ce
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Thu Jul 10 19:41:26 2008 +0900
+++ b/pidgin-twitter.c	Thu Jul 10 20:26:22 2008 +0900
@@ -557,12 +557,14 @@
         g_free(match2);
     }
     else if(service == wassr_service && which == CHANNEL) {
-        gchar *match = g_match_info_fetch(match_info, 1);
+        gchar *match1 = g_match_info_fetch(match_info, 1); //before channel
+        gchar *match2 = g_match_info_fetch(match_info, 2); //channel
         const gchar *format = CHANNEL_FORMAT_WASSR;
 
-        snprintf(sub, 128, format, match, match);
+        snprintf(sub, 128, format, match1 ? match1: "", match2, match2);
 
-        g_free(match);
+        g_free(match1);
+        g_free(match2);
     }
 
     g_string_append(result, sub);
@@ -665,7 +667,7 @@
     }
 
     /* strip all markups */
-    strip_markup(buffer); // this causes missing of strings surrounded by <>
+    strip_markup(buffer); // it causes missing of strings surrounded by <>
 
     /* playsound */
     if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) {
@@ -679,13 +681,13 @@
     if(purple_prefs_get_bool(OPT_TRANSLATE_SENDER)) {
         translate(buffer, SENDER, service);
     }
-    if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) {
-        translate(buffer, RECIPIENT, service);
-    }
     if(service == wassr_service &&
        purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) {
         translate(buffer, CHANNEL, service);
     }
+    if(purple_prefs_get_bool(OPT_TRANSLATE_RECIPIENT)) {
+        translate(buffer, RECIPIENT, service);
+    }
 
     /* escape pseudo command (to show same result to sending message) */
     if(is_twitter_conv(conv) && purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) {
@@ -970,8 +972,6 @@
 {
     const gchar *proto = purple_account_get_protocol_id(account);
 
-    twitter_debug("name  = %s proto = %s\n", name, proto);
-
     if(g_strstr_len(name,  19, "twitter@twitter.com") &&
        g_strstr_len(proto, 11, "prpl-jabber")) {
         return TRUE;
@@ -996,8 +996,6 @@
 {
     const gchar *proto = purple_account_get_protocol_id(account);
 
-    twitter_debug("name  = %s proto = %s\n", name, proto);
-
     if(g_strstr_len(name,  18, "wassr-bot@wassr.jp") &&
        g_strstr_len(proto, 11, "prpl-jabber")) {
         return TRUE;
@@ -1022,8 +1020,6 @@
 {
     const gchar *proto = purple_account_get_protocol_id(account);
 
-    twitter_debug("name  = %s proto = %s\n", name, proto);
-
     if(g_strstr_len(name,  16, "update@identi.ca") &&
        g_strstr_len(proto, 11, "prpl-jabber")) {
         return TRUE;
--- a/pidgin-twitter.h	Thu Jul 10 19:41:26 2008 +0900
+++ b/pidgin-twitter.h	Thu Jul 10 20:26:22 2008 +0900
@@ -56,10 +56,10 @@
 #define SENDER_FORMAT_WASSR     "%s<a href='http://wassr.jp/user/%s'>%s</a>: "
 #define RECIPIENT_FORMAT_IDENTICA "@<a href='http://identi.ca/%s'>%s</a>"
 #define SENDER_FORMAT_IDENTICA  "%s<a href='http://identi.ca/%s'>%s</a>: "
+#define CHANNEL_FORMAT_WASSR    "%s<a href='http://wassr.jp/channel/%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 EMPTY                   ""
-#define CHANNEL_FORMAT_WASSR    "#<a href='http://wassr.jp/channel/%s'>%s</a> "
 
 /* patterns */
 #define P_RECIPIENT        "@([A-Za-z0-9_]+)"
@@ -69,7 +69,7 @@
 #define P_USER             "^\\(.+?\\)\\s*([A-Za-z0-9_]+):"
 #define P_USER_FIRST_LINE  "^\\(.+?\\)\\s*.+:\\s*([A-Za-z0-9_]+):"
 #define P_USER_FORMATTED   "^.*?<a .+?>([A-Za-z0-9_]+)</a>:"
-#define P_CHANNEL          "^.*?<a .+?>(?:[A-Za-z0-9_]+)</a>: #([A-Za-z0-9_]+) "
+#define P_CHANNEL          "^(.*?<a .+?>[A-Za-z0-9_]+</a>: #)([A-Za-z0-9_]+) "
 
 /* debug macros */
 #define twitter_debug(fmt, ...)	purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__);