changeset 299:d68ed289ef69

#tag should be interpreted as search tag only if it appears in the beginning of line or it is separated by white space.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 25 Apr 2009 22:27:13 +0900
parents fd0948c7078e
children 42cdddf0f747
files main.c pidgin-twitter.h
diffstat 2 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Sun Apr 19 13:52:03 2009 +0900
+++ b/main.c	Sat Apr 25 22:27:13 2009 +0900
@@ -217,11 +217,12 @@
         g_free(match2);
     }
     else if(which == TAG_TWITTER && service == twitter_service) {
-        gchar *match = g_match_info_fetch(match_info, 1);
-        gchar *link = g_ascii_strdown(match, -1);
-        g_snprintf(sub, SUBST_BUF_SIZE, TAG_FORMAT_TWITTER, link, match);
-        g_free(match);
-        g_free(link);
+        gchar *match1 = g_match_info_fetch(match_info, 1); /* white space */
+        gchar *match2 = g_match_info_fetch(match_info, 2); /* search tag */
+        const gchar *format = TAG_FORMAT_TWITTER;
+        g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2);
+        g_free(match1);
+        g_free(match2);
     }
     else if(which == TAG_IDENTICA && service == identica_service) {
         gchar *match = g_match_info_fetch(match_info, 1);
@@ -1286,7 +1287,7 @@
     PURPLE_PRIORITY_DEFAULT,    /**< priority	*/
     PLUGIN_ID,                  /**< id     */
     "Pidgin-Twitter",           /**< name	*/
-    "0.8.3",                    /**< version	*/
+    "0.8.4d1",                    /**< version	*/
     "provides useful features for twitter", /**  summary	*/
     "provides useful features for twitter", /**  desc	*/
     "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, \nmojin, umq, \nthe pidging-twitter team",     /**< author	*/
--- a/pidgin-twitter.h	Sun Apr 19 13:52:03 2009 +0900
+++ b/pidgin-twitter.h	Sat Apr 25 22:27:13 2009 +0900
@@ -160,7 +160,7 @@
 #define SENDER_FORMAT_JISKO     "%s<a href='http://jisko.net/%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 TAG_FORMAT_TWITTER      "<a href='http://twitter.com/search?q=%%23%s'>#%s</a>"
+#define TAG_FORMAT_TWITTER      "%s<a href='http://twitter.com/search?q=%%23%s'>#%s</a>"
 #define TAG_FORMAT_IDENTICA     "#<a href='http://identi.ca/tag/%s'>%s</a>"
 #define GROUP_FORMAT_IDENTICA   "!<a href='http://identi.ca/group/%s'>%s</a>"
 
@@ -175,10 +175,10 @@
 #define P_PSEUDO            "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)"
 #define P_USER              "^.*?(?:<a .+?>)?([-A-Za-z0-9_]+)(?:</a>)?:"
 #define P_CHANNEL           "^(.*?(?:<a .+?>)?[-A-Za-z0-9_]+(?:</a>)?: \\r?\\n?#)([A-Za-z0-9_]+) "
-#define P_TAG_TWITTER       "#([-A-Za-z0-9_]+)"
+#define P_TAG_TWITTER       "(^|\\s+)#([-A-Za-z0-9_]+)"
 #define P_TAG_IDENTICA      "#([-A-Za-z0-9_]+)"
 #define P_GROUP_IDENTICA    "!([-A-Za-z0-9_]+)"
-#define P_IMAGE_TWITTER   "<img .*=\"profile-(?:image|img)\".*src=\"(https?://.+?)\".*/>"
+#define P_IMAGE_TWITTER     "<img .*=\"profile-(?:image|img)\".*src=\"(https?://.+?)\".*/>"
 #define P_IMAGE_WASSR       "<div class=\"image\"><a href=\".+\"><img src=\"(.+)\" width=\".+?\" /></a></div>"
 #define P_IMAGE_IDENTICA    "<img src=\"(https?://.+.identi.ca/.+)\" class=\"avatar profile photo\" width=\"96\" height=\"96\" alt=\"[A-Za-z0-9_]+\"/>"
 #define P_IMAGE_JISKO       "<img src=\"(https?://jisko.net/users/.+/img/avatar/thumb_side\\..+)\" alt=\"Avatar\" />"