changeset 202:67d8eaba446d

preliminary identi.ca tag support.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 12 Aug 2008 17:26:40 +0900
parents 0aeeafe37ef7
children 6c6fe6375ce4
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Tue Aug 12 15:20:58 2008 +0900
+++ b/pidgin-twitter.c	Tue Aug 12 17:26:40 2008 +0900
@@ -881,7 +881,7 @@
         g_free(match1);
         g_free(match2);
     }
-    else if(service == wassr_service && which == CHANNEL) {
+    else if(which == CHANNEL && service == wassr_service) {
         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;
@@ -891,6 +891,16 @@
         g_free(match1);
         g_free(match2);
     }
+    else if(which == CHANNEL && service == identica_service) {
+        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_IDENTICA;
+
+        g_snprintf(sub, 128, format, match1 ? match1: "", match2, match2);
+
+        g_free(match1);
+        g_free(match2);
+    }
 
     g_string_append(result, sub);
     twitter_debug("sub = %s\n", sub);
@@ -1021,12 +1031,16 @@
     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);
+    if(service == identica_service &&
+       purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) {
+        translate(buffer, CHANNEL, service);
     }
 
     /* escape pseudo command (to show same result to sending message) */
--- a/pidgin-twitter.h	Tue Aug 12 15:20:58 2008 +0900
+++ b/pidgin-twitter.h	Tue Aug 12 17:26:40 2008 +0900
@@ -128,6 +128,7 @@
 #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 CHANNEL_FORMAT_IDENTICA "%s<a href='http://identi.ca/tag/%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                   ""