changeset 92:7f20a61e98ad

merged
author Konosuke Watanabe <sasugaanija@gmail.com>
date Sun, 06 Jul 2008 18:17:54 +0900
parents 2b7ef3538cd3 (current diff) 2a14fe9f6030 (diff)
children 7219f7dee52f
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 28 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Sun Jul 06 17:43:44 2008 +0900
+++ b/pidgin-twitter.c	Sun Jul 06 18:17:54 2008 +0900
@@ -453,24 +453,28 @@
               void *data)
 {
     int utflen, bytes;
-
+    gboolean twitter_ac = FALSE, wassr_ac = FALSE;
     twitter_debug("called\n");
 
-    if(is_wassr_account(account, recipient)) {
+    twitter_ac = is_twitter_account(account, recipient);
+    wassr_ac   = is_wassr_account(account, recipient);
+
+    if(wassr_ac) {
         /* store sending message to address parrot problem */
         g_strlcpy(wassr_post, *buffer, WASSR_POST_LEN);
         twitter_debug("parrot pushed:%s\n", *buffer);
     }
 
-    /* check if the message is from twitter */
-    if(!is_twitter_account(account, recipient))
+    /* strip all markups */
+    if(twitter_ac || wassr_ac)
+        strip_markup(buffer);
+
+    /* return here if the message is not to twitter */
+    if(!twitter_ac)
         return FALSE;
 
-    /* strip all markups */
-    strip_markup(buffer);
-
     /* escape pseudo command */
-    if(is_twitter_account(account, recipient) &&
+    if(twitter_ac &&
        purple_prefs_get_bool(OPT_ESCAPE_PSEUDO)) {
         escape(buffer);
     }
@@ -644,7 +648,7 @@
     }
 
     /* strip all markups */
-    strip_markup(buffer);
+    strip_markup(buffer); // this causes missing of strings surrounded by <>
 
     /* playsound */
     if(purple_prefs_get_bool(OPT_PLAYSOUND_SENDER)) {
@@ -1095,13 +1099,13 @@
     got_icon_data *gotdata = (got_icon_data *)user_data;
 
     gchar *user_name = gotdata->user_name;
-    int service = gotdata->service;
+    gint service = gotdata->service;
 
     GList *win_list;
     GtkIMHtml *target_imhtml = NULL;
     GtkTextBuffer *target_buffer = NULL;
     GtkTextIter inserting_point;
-    int icon_id;
+    gint icon_id;
     icon_data *data = NULL;
 
     twitter_debug("called: service = %d\n", service);
@@ -1169,7 +1173,7 @@
 }
 
 static void
-insert_requested_icon(const gchar *user_name, int service)
+insert_requested_icon(const gchar *user_name, gint service)
 {
     icon_data *data = NULL;
     GList *mark_list = NULL;
@@ -1211,9 +1215,9 @@
 {
     got_icon_data *gotdata = (got_icon_data *)user_data;
     gchar *user_name = gotdata->user_name;
-    int service = gotdata->service;
+    gint service = gotdata->service;
 
-    int icon_id;
+    gint icon_id;
     icon_data *data = NULL;
 
     twitter_debug("called: service = %d\n", service);
@@ -1234,7 +1238,7 @@
     }
 
     /* Return if user's icon had already been downloaded or
-     * the download is failure. */
+     * the download failed. */
     if((data && data->icon_id) || !url_text) { //xxx
         if(!url_text) {
             twitter_debug("downloading %s's icon failed : %s\n",
@@ -1247,7 +1251,6 @@
         data->requested = FALSE;
 
         g_free(user_name);
-        g_free(data);
         return;
     }
 
@@ -1317,7 +1320,7 @@
 }
 
 static void
-request_icon(const char *user_name, int service)
+request_icon(const char *user_name, gint service)
 {
     gchar *url = NULL;
 
@@ -1451,7 +1454,7 @@
 }
 
 static void
-mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, int service)
+mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service)
 {
     icon_data *data = NULL;
 
@@ -1498,8 +1501,8 @@
     GtkIMHtml *imhtml;
     GtkTextBuffer *text_buffer;
     GtkTextIter inserting_point;
-    int icon_id;
-    int service = get_service_type(conv);
+    gint icon_id;
+    gint service = get_service_type(conv);
     icon_data *data = NULL;
 
     twitter_debug("called\n");
--- a/pidgin-twitter.h	Sun Jul 06 17:43:44 2008 +0900
+++ b/pidgin-twitter.h	Sun Jul 06 18:17:54 2008 +0900
@@ -73,8 +73,8 @@
 static void escape(gchar **str);
 static gboolean sending_im_cb(PurpleAccount *account, char *recipient, char **buffer, void *data);
 static gboolean eval(const GMatchInfo *match_info, GString *result, gpointer user_data);
-static void translate(gchar **str, int which, int service);
-static void playsound(gchar **str, int which);
+static void translate(gchar **str, gint which, gint service);
+static void playsound(gchar **str, gint which);
 static gboolean writing_im_cb(PurpleAccount *account, char *sender, char **buffer, PurpleConversation *conv, int flags, void *data);
 static void insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, gchar *new_text, gint new_text_length, gpointer user_data);
 static void delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, GtkTextIter *end_pos, gpointer user_data);
@@ -91,10 +91,10 @@
 static void deleting_conv_cb(PurpleConversation *conv);
 static gboolean receiving_im_cb(PurpleAccount *account, char **sender, char **buffer, PurpleConversation *conv, PurpleMessageFlags *flags, void *data);
 static void insert_icon_at_mark(GtkTextMark *requested_mark, gpointer user_data);
-static void insert_requested_icon(const gchar *user_name, int service);
+static void insert_requested_icon(const gchar *user_name, gint service);
 static void got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message);
-static void request_icon(const char *user_name, int service);
-static void mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, int service);
+static void request_icon(const char *user_name, gint service);
+static void mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service);
 static void displayed_im_cb(PurpleAccount *account, const char *who, char *message, PurpleConversation *conv, PurpleMessageFlags flags);
 static gboolean load_plugin(PurplePlugin *plugin);
 static gboolean unload_plugin(PurplePlugin *plugin);