Mercurial > pidgin-twitter
changeset 223:c3efae72f72a
tweaked the recipient pattern to allow mail addresses or some special strings such as "idolm@ster."
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 06 Sep 2008 18:37:30 +0900 |
parents | b168502b73c3 |
children | 1fcd0e589b9e |
files | pidgin-twitter.c pidgin-twitter.h |
diffstat | 2 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin-twitter.c Wed Sep 03 18:39:39 2008 +0900 +++ b/pidgin-twitter.c Sat Sep 06 18:37:30 2008 +0900 @@ -893,8 +893,10 @@ twitter_debug("which = %d service = %d\n", which, service); if(which == RECIPIENT) { - gchar *match = g_match_info_fetch(match_info, 1); + gchar *match1 = g_match_info_fetch(match_info, 1); /* preceding \s */ + gchar *match2 = g_match_info_fetch(match_info, 2); /* recipient */ const gchar *format = NULL; + switch(service) { case twitter_service: format = RECIPIENT_FORMAT_TWITTER; @@ -909,8 +911,9 @@ twitter_debug("unknown service\n"); break; } - g_snprintf(sub, SUBST_BUF_SIZE, format, match, match); - g_free(match); + g_snprintf(sub, SUBST_BUF_SIZE, format, match1 ? match1: "", match2, match2); + g_free(match1); + g_free(match2); } else if(which == SENDER) { gchar *match1 = g_match_info_fetch(match_info, 1); /*preceding CR|LF*/
--- a/pidgin-twitter.h Wed Sep 03 18:39:39 2008 +0900 +++ b/pidgin-twitter.h Sat Sep 06 18:37:30 2008 +0900 @@ -132,11 +132,11 @@ #endif /* formats and templates */ -#define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>" +#define RECIPIENT_FORMAT_TWITTER "%s@<a href='http://twitter.com/%s'>%s</a>" #define SENDER_FORMAT_TWITTER "%s<a href='http://twitter.com/%s'>%s</a>: " -#define RECIPIENT_FORMAT_WASSR "@<a href='http://wassr.jp/user/%s'>%s</a>" +#define RECIPIENT_FORMAT_WASSR "%s@<a href='http://wassr.jp/user/%s'>%s</a>" #define SENDER_FORMAT_WASSR "%s<a href='http://wassr.jp/user/%s'>%s</a>: " -#define RECIPIENT_FORMAT_IDENTICA "@<a href='http://identi.ca/%s'>%s</a>" +#define RECIPIENT_FORMAT_IDENTICA "%s@<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> " @@ -147,7 +147,7 @@ #define EMPTY "" /* patterns */ -#define P_RECIPIENT "@([A-Za-z0-9_]+)" +#define P_RECIPIENT "(^|\\s+)@([A-Za-z0-9_]+)" #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)"