# HG changeset patch # User Yoshiki Yazawa # Date 1210681547 -32400 # Node ID 42869098eda350fecba808be46e3583dc5086800 # Parent 6774859df10b1d0212433922891bc3e1224034fa adapted for msn style option (or new line plugin). diff -r 6774859df10b -r 42869098eda3 pidgin-twitter.c --- a/pidgin-twitter.c Tue May 13 18:30:19 2008 +0900 +++ b/pidgin-twitter.c Tue May 13 21:25:47 2008 +0900 @@ -55,13 +55,13 @@ /* formats and templates */ #define RECIPIENT_FORMAT "@%s" -#define SENDER_FORMAT "%s: " +#define SENDER_FORMAT "%s%s: " #define DEFAULT_LIST "(list of users: separated with ' ,:;')" #define OOPS_MESSAGE "Oops! Your update was over 140 characters. We sent the short version to your friends (they can view the entire update on the web).
" /* patterns */ #define P_RECIPIENT "@([A-Za-z0-9_]+)" -#define P_SENDER "^([A-Za-z0-9_]+): " +#define P_SENDER "^(\\r?\\n?)([A-Za-z0-9_]+): " #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)" @@ -345,16 +345,27 @@ static gboolean eval(const GMatchInfo *match_info, GString *result, gpointer user_data) { + int which = *(int *)user_data; gchar sub[128]; - gchar *match = g_match_info_fetch(match_info, 1); - int which = *(int *)user_data; + if(which == RECIPIENT) { + gchar *match = g_match_info_fetch(match_info, 1); - snprintf(sub, 128, which ? SENDER_FORMAT : RECIPIENT_FORMAT, - match, match); + snprintf(sub, 128, RECIPIENT_FORMAT, match, match); + g_free(match); + } + else if(which == SENDER) { + gchar *match1 = g_match_info_fetch(match_info, 1); //preceding CR|LF + gchar *match2 = g_match_info_fetch(match_info, 2); //sender + + snprintf(sub, 128, SENDER_FORMAT, match1 ? match1: "", + match2, match2); + g_free(match1); + g_free(match2); + } + + g_string_append(result, sub); twitter_debug("sub = %s\n", sub); - g_string_append(result, sub); - g_free(match); return FALSE; }