Mercurial > pidgin-twitter
changeset 286:6d0bb66fedc7
added group support for identi.ca.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 28 Jan 2009 23:17:40 +0900 |
parents | 15b8e403c7e1 |
children | 4a7f4ba199cc |
files | main.c pidgin-twitter.h |
diffstat | 2 files changed, 20 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Mon Jan 12 01:09:30 2009 +0900 +++ b/main.c Wed Jan 28 23:17:40 2009 +0900 @@ -208,7 +208,7 @@ g_free(match2); } else if(which == CHANNEL_WASSR && service == wassr_service) { - gchar *match1 = g_match_info_fetch(match_info, 1); /*before channel*/ + 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; @@ -222,8 +222,16 @@ gchar *link = g_ascii_strdown(match, -1); purple_str_strip_char(link, '-'); purple_str_strip_char(link, '_'); - const gchar *format = TAG_FORMAT_IDENTICA; - g_snprintf(sub, SUBST_BUF_SIZE, format, link, match); + g_snprintf(sub, SUBST_BUF_SIZE, TAG_FORMAT_IDENTICA, link, match); + g_free(match); + g_free(link); + } + else if(which == GROUP_IDENTICA && service == identica_service) { + gchar *match = g_match_info_fetch(match_info, 1); + gchar *link = g_ascii_strdown(match, -1); + purple_str_strip_char(link, '-'); + purple_str_strip_char(link, '_'); + g_snprintf(sub, SUBST_BUF_SIZE, GROUP_FORMAT_IDENTICA, link, match); g_free(match); g_free(link); } @@ -372,6 +380,10 @@ purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) { translate(buffer, TAG_IDENTICA, service); } + if(service == identica_service && + purple_prefs_get_bool(OPT_TRANSLATE_CHANNEL)) { + translate(buffer, GROUP_IDENTICA, service); + } /* escape pseudo command (to show the same result as sending message) */ if(service == twitter_service && @@ -1105,6 +1117,7 @@ regp[USER] = g_regex_new(P_USER, 0, 0, NULL); regp[CHANNEL_WASSR] = g_regex_new(P_CHANNEL, 0, 0, NULL); regp[TAG_IDENTICA] = g_regex_new(P_TAG_IDENTICA, 0, 0, NULL); + regp[GROUP_IDENTICA] = g_regex_new(P_GROUP_IDENTICA, 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); regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL);
--- a/pidgin-twitter.h Mon Jan 12 01:09:30 2009 +0900 +++ b/pidgin-twitter.h Wed Jan 28 23:17:40 2009 +0900 @@ -39,6 +39,7 @@ USER, CHANNEL_WASSR, TAG_IDENTICA, + GROUP_IDENTICA, IMAGE_TWITTER, IMAGE_WASSR, IMAGE_IDENTICA, @@ -159,6 +160,7 @@ #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_IDENTICA "#<a href='http://identi.ca/tag/%s'>%s</a>" +#define GROUP_FORMAT_IDENTICA "!<a href='http://identi.ca/group/%s'>%s</a>" #define DEFAULT_LIST "(list of users: separated with ' ,:;')" #define OOPS_MESSAGE "<body>Oops! Your update was over 140 characters. We sent the short version to your friends (they can view the entire update on the web).<BR></body>" @@ -172,6 +174,7 @@ #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_IDENTICA "#([-A-Za-z0-9_]+)" +#define P_GROUP_IDENTICA "!([-A-Za-z0-9_]+)" #define P_IMAGE_TWITTER "<img .*=\"profile-(?:image|img)\".*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 photo\" width=\"96\" height=\"96\" alt=\"[A-Za-z0-9_]+\"/>" @@ -213,7 +216,7 @@ #define DEFAULT_ICON_MAX_COUNT (50) #define DEFAULT_ICON_MAX_DAYS (7) #define DAYS_TO_SECONDS(d) ((d) * 86400) -#define NUM_REGPS (13) +#define NUM_REGPS (14) #define NUM_SERVICES (4) /* twitter, wassr, identica, jisko. */ /* debug macros */