# HG changeset patch # User Yoshiki Yazawa # Date 1216372798 -32400 # Node ID a37dd74c8355ce3ba5c1a0a7e949586b8191685b # Parent 8b58990f5ee969354ac49a897648c0c5240629c1 - adapted to identi.ca changes. - try to get rid of variable 'timezone'. diff -r 8b58990f5ee9 -r a37dd74c8355 pidgin-twitter.c --- a/pidgin-twitter.c Fri Jul 18 07:47:30 2008 +0900 +++ b/pidgin-twitter.c Fri Jul 18 18:19:58 2008 +0900 @@ -23,7 +23,8 @@ /***********/ /* globals */ /***********/ -static GRegex *regp[9]; +#define NUM_REGP 9 +static GRegex *regp[NUM_REGP]; static gboolean suppress_oops = FALSE; static GHashTable *icon_data_by_user = NULL; // twitter static GHashTable *icon_data_by_user2 = NULL; // wassr @@ -313,7 +314,7 @@ memset(&res, 0x00, sizeof(struct tm)); strptime(str, "%a %b %d %T %z %Y", &res); tzset(); - st->time = mktime(&res) - timezone; + st->time = mktime(&res) - res.tm_gmtoff; /* restore locale */ setlocale(LC_TIME, lc_time); @@ -791,11 +792,13 @@ { gchar *newstr; eval_data *data = g_new0(eval_data, 1); + gint regp_id; data->which = which; data->service = service; - newstr = g_regex_replace_eval(regp[which], // compiled regex + regp_id = which; /* for future use --yaz */ + newstr = g_regex_replace_eval(regp[regp_id], // compiled regex *str, // subject string -1, // length of the subject string 0, // start position @@ -893,7 +896,7 @@ } /* strip all markups */ - strip_markup(buffer); // it causes missing of strings surrounded by <> + strip_markup(buffer); //it causes missing of strings surrounded by <> /* playsound */ if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) { @@ -2253,15 +2256,10 @@ plugin, PURPLE_CALLBACK(signed_on_cb)); /* unreference regp */ - g_regex_unref(regp[RECIPIENT]); - g_regex_unref(regp[SENDER]); - g_regex_unref(regp[COMMAND]); - g_regex_unref(regp[PSEUDO]); - g_regex_unref(regp[USER]); - g_regex_unref(regp[USER_FIRST_LINE]); - g_regex_unref(regp[USER_FORMATTED]); - g_regex_unref(regp[CHANNEL]); - g_regex_unref(regp[IMAGE_IDENTICA]); + int i; + for(i = 0; i < NUM_REGP; i++) { + g_regex_unref(regp[i]); + } /* remove mark list in each hash entry */ g_hash_table_foreach(icon_data_by_user, (GHFunc)remove_marks_func, NULL); diff -r 8b58990f5ee9 -r a37dd74c8355 pidgin-twitter.h --- a/pidgin-twitter.h Fri Jul 18 07:47:30 2008 +0900 +++ b/pidgin-twitter.h Fri Jul 18 18:19:58 2008 +0900 @@ -1,6 +1,7 @@ #ifndef _PIDGIN_TWITTER_H_ #define _PIDGIN_TWITTER_H_ +#define _BSD_SOURCE #define _XOPEN_SOURCE 600 #include #include @@ -122,7 +123,7 @@ /* patterns */ #define P_RECIPIENT "@([A-Za-z0-9_]+)" -#define P_SENDER "^(\\r?\\n?)([A-Za-z0-9_]+): " +#define P_SENDER "^(\\r?\\n?)\\s*([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)" #define P_USER "^\\(.+?\\)\\s*([A-Za-z0-9_]+):"