Mercurial > pidgin-twitter
changeset 341:b41f1bf69cba
- twitter still requires preceding white space on a hash tag in almost all case.
- include zenkaku-space in UTF-8 encoding to the preceding white space. it deviates from twitter specification but convenient to Asian users.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sun, 18 Oct 2009 17:38:40 +0900 |
parents | 2b79bad516e6 |
children | 941f848b61c9 |
files | main.c pidgin-twitter.h |
diffstat | 2 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Sun Oct 18 16:55:57 2009 +0900 +++ b/main.c Sun Oct 18 17:38:40 2009 +0900 @@ -242,9 +242,12 @@ g_free(match2); } else if(which == TAG_TWITTER && service == twitter_service) { - gchar *match = g_match_info_fetch(match_info, 1); /* search tag */ - g_snprintf(sub, SUBST_BUF_SIZE, TAG_FORMAT_TWITTER, match, match); - g_free(match); + gchar *match1 = g_match_info_fetch(match_info, 1); /* white space */ + gchar *match2 = g_match_info_fetch(match_info, 2); /* search tag */ + g_snprintf(sub, SUBST_BUF_SIZE, TAG_FORMAT_TWITTER, + 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);
--- a/pidgin-twitter.h Sun Oct 18 16:55:57 2009 +0900 +++ b/pidgin-twitter.h Sun Oct 18 17:38:40 2009 +0900 @@ -169,7 +169,7 @@ #define SENDER_FORMAT_FFEED "%s<a href='http://friendfeed.com/%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>" #define LINK_FORMAT_TWITTER " <a href='PT://reply-twitter/?id=%s&user=%s'>R</a> <a href='PT://fav-twitter/?id=%s'>F</a> <a href='PT://retweet-twitter/?id=%s&user=%s&msg=%s'>RT</a>" @@ -186,7 +186,7 @@ #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_]*[-A-Za-z0-9_]+[^\\s[:punct:]]*)" +#define P_TAG_TWITTER "(^|\\s+|\xe3\x80\x80)#([^-A-Za-z0-9_]*[-A-Za-z0-9_]+[^\\s[:punct:]]*)" #define P_TAG_IDENTICA "#([-A-Za-z0-9_]+)" #define P_GROUP_IDENTICA "!([-A-Za-z0-9_]+)" #define P_IMAGE_TWITTER "<profile_image_url>(https?://.+?)</profile_image_url>"