Mercurial > pidgin-twitter
changeset 226:8da85ae0aa2c
tweaked user pattern and channel pattern so that they can be matched regardless of surrounding anchor markups.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 13 Sep 2008 01:20:13 +0900 |
parents | 1ef5aa4883a1 |
children | ed227c5765a2 |
files | pidgin-twitter.c pidgin-twitter.h |
diffstat | 2 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin-twitter.c Tue Sep 09 18:53:36 2008 +0900 +++ b/pidgin-twitter.c Sat Sep 13 01:20:13 2008 +0900 @@ -24,7 +24,7 @@ /***********/ /* globals */ /***********/ -#define NUM_REGPS 13 +#define NUM_REGPS 11 #define NUM_SERVICES 3 /* twitter, wassr, identica. */ static GRegex *regp[NUM_REGPS]; static gboolean suppress_oops = FALSE; @@ -2423,7 +2423,7 @@ } /* get user's name */ - g_regex_match(regp[USER_FORMATTED], message, 0, &match_info); + g_regex_match(regp[USER], message, 0, &match_info); if(!g_match_info_matches(match_info)) { twitter_debug("message was not matched : %s\n", message); g_match_info_free(match_info); @@ -2595,8 +2595,6 @@ regp[COMMAND] = g_regex_new(P_COMMAND, G_REGEX_RAW, 0, NULL); regp[PSEUDO] = g_regex_new(P_PSEUDO, G_REGEX_RAW, 0, NULL); regp[USER] = g_regex_new(P_USER, 0, 0, NULL); - regp[USER_FIRST_LINE] = g_regex_new(P_USER_FIRST_LINE, 0, 0, NULL); - regp[USER_FORMATTED] = g_regex_new(P_USER_FORMATTED, G_REGEX_RAW, 0, NULL); regp[CHANNEL_WASSR] = g_regex_new(P_CHANNEL, 0, 0, NULL); regp[IMAGE_TWITTER] = g_regex_new(P_IMAGE_TWITTER, 0, 0, NULL); regp[IMAGE_WASSR] = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL);
--- a/pidgin-twitter.h Tue Sep 09 18:53:36 2008 +0900 +++ b/pidgin-twitter.h Sat Sep 13 01:20:13 2008 +0900 @@ -31,8 +31,6 @@ COMMAND, PSEUDO, USER, - USER_FIRST_LINE, - USER_FORMATTED, CHANNEL_WASSR, IMAGE_TWITTER, IMAGE_WASSR, @@ -151,10 +149,8 @@ #define P_SENDER "^(\\r?\\n?)\\s*([-A-Za-z0-9_]+)(?:\\s*\\(.+\\))?: " #define P_COMMAND "^(?:\\s*)([dDfFgGlLmMnNtTwW]{1}\\s+[A-Za-z0-9_]+)(?:\\s*\\Z)" #define P_PSEUDO "^\\s*(?:[\"#$%&'()*+,\\-./:;<=>?\\[\\\\\\]_`{|}~]|[^\\s\\x21-\\x7E])*([dDfFgGlLmMnNtTwW]{1})(?:\\Z|\\s+|[^\\x21-\\x7E]+\\Z)" -#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>: \\r?\\n?#)([A-Za-z0-9_]+) " +#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_IMAGE_TWITTER "<a href=\"/account/profile_image/.+?\"><img .+? id=\"profile-image\".*src=\"(http://.+)\" .+?/>" #define P_IMAGE_WASSR "<div class=\"image\"><a href=\".+\"><img src=\"(.+)\" width=\".+?\" /></a></div>" #define P_IMAGE_IDENTICA "<img src=\"(http://.+.identi.ca/.+)\" class=\"avatar profile\" width=\"96\" height=\"96\" alt=\"[A-Za-z0-0_]+\"/>"