# HG changeset patch # User Yoshiki Yazawa # Date 1255840248 -32400 # Node ID 6ee1ed15688c84ca30871369d9080683f7a6d051 # Parent cdcfdf6a15fb71c4ba3bd8c3bcc0a77858f0ecba twitter markups tags like "#2.0" as "#2" but those tags only be matched with the query of "#2.0". so, we should handle a punctuation within a string as a normal letter and should strip it only if it is followed by white space. diff -r cdcfdf6a15fb -r 6ee1ed15688c main.c --- a/main.c Sun Oct 18 03:49:46 2009 +0900 +++ b/main.c Sun Oct 18 13:30:48 2009 +0900 @@ -228,10 +228,8 @@ else if(which == SENDER_FFEED) { gchar *match1 = g_match_info_fetch(match_info, 1); /* preceding CR|LF */ gchar *match2 = g_match_info_fetch(match_info, 2); /* sender */ - const gchar *format = NULL; - format = SENDER_FORMAT_FFEED; - g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2); + g_snprintf(sub, SUBST_BUF_SIZE, SENDER_FORMAT_FFEED, match1 ? match1: "", match2, match2); g_free(match1); g_free(match2); @@ -239,9 +237,8 @@ else if(which == CHANNEL_WASSR && 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; - g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2); + g_snprintf(sub, SUBST_BUF_SIZE, CHANNEL_FORMAT_WASSR, match1 ? match1: "", match2, match2); g_free(match1); g_free(match2); @@ -249,8 +246,14 @@ else if(which == TAG_TWITTER && service == twitter_service) { 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); + + /* search tag ambiguity hack */ + gchar *last; + last = match2 + strlen(match2) - 1; + if(g_ascii_ispunct(*last)) + *last = '\0'; + + g_snprintf(sub, SUBST_BUF_SIZE, TAG_FORMAT_TWITTER, match1 ? match1: "", match2, match2); g_free(match1); g_free(match2); } diff -r cdcfdf6a15fb -r 6ee1ed15688c pidgin-twitter.h --- a/pidgin-twitter.h Sun Oct 18 03:49:46 2009 +0900 +++ b/pidgin-twitter.h Sun Oct 18 13:30:48 2009 +0900 @@ -186,7 +186,7 @@ #define P_PSEUDO "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)" #define P_USER "^.*?(?:)?([-A-Za-z0-9_]+)(?:)?:" #define P_CHANNEL "^(.*?(?:)?[-A-Za-z0-9_]+(?:)?: \\r?\\n?#)([A-Za-z0-9_]+) " -#define P_TAG_TWITTER "(^|\\s+)#([^-A-Za-z0-9_]*[-A-Za-z0-9_]+[^\\s[:punct:]]*)" +#define P_TAG_TWITTER "(^|\\s+)#([^-A-Za-z0-9_]*[-A-Za-z0-9_]+\\S*)" #define P_TAG_IDENTICA "#([-A-Za-z0-9_]+)" #define P_GROUP_IDENTICA "!([-A-Za-z0-9_]+)" #define P_IMAGE_TWITTER "(https?://.+?)"