changeset 122:a37dd74c8355

- adapted to identi.ca changes. - try to get rid of variable 'timezone'.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 18 Jul 2008 18:19:58 +0900
parents 8b58990f5ee9
children 76012df4e194
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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 <stdio.h>
 #include <stdlib.h>
@@ -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_]+):"