changeset 259:d45dd3589560

little clean up
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 03 Dec 2008 01:18:19 +0900
parents 2145f975ef69
children d973f9debe86
files icon.c main.c
diffstat 2 files changed, 26 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/icon.c	Wed Nov 26 14:32:09 2008 +0900
+++ b/icon.c	Wed Dec 03 01:18:19 2008 +0900
@@ -1,5 +1,4 @@
 #include "pidgin-twitter.h"
-#include "icon.h"
 
 extern GHashTable *icon_hash[];
 extern GRegex *regp[];
@@ -390,7 +389,7 @@
         data->requested = FALSE;
         data->fetch_data = NULL;
 
-        /* return if user's icon had been downloaded */
+        /* return if user's icon has been downloaded */
         if(data->pixbuf) {
             twitter_debug("%s's icon has already been downloaded\n",
                           user_name);
@@ -474,7 +473,7 @@
     twitter_debug("Downloading %s's icon has been complete.\n",
         user_name);
 
-    /* Insert the icon to messages that had been received. */
+    /* Insert the icon to messages that has been received. */
     insert_requested_icon(user_name, service);
 
 fin_got_icon_cb:
@@ -503,12 +502,12 @@
         suffix = "wassr";
         break;
     case identica_service:
+        hash = icon_hash[identica_service];
         suffix = "identica";
-        hash = icon_hash[identica_service];
         break;
     case jisko_service:
+        hash = icon_hash[jisko_service];
         suffix = "jisko";
-        hash = icon_hash[jisko_service];
         break;
     default:
         twitter_debug("unknown service\n");
@@ -522,7 +521,7 @@
      * must exist here. */
     data = (icon_data *)g_hash_table_lookup(hash, user_name);
 
-    /* if img has been registerd, just return */
+    /* if the image is in a hash, just return */
     if(data && data->pixbuf && !renew)
         return;
 
--- a/main.c	Wed Nov 26 14:32:09 2008 +0900
+++ b/main.c	Wed Dec 03 01:18:19 2008 +0900
@@ -19,7 +19,6 @@
 #define PURPLE_PLUGINS 1
 
 #include "pidgin-twitter.h"
-#include "main.h"
 
 /***********/
 /* globals */
@@ -37,13 +36,10 @@
 
 source_t source;
 
-#ifndef _WIN32
-extern gchar *sanitize_utf(const gchar *msg, gsize len, gsize *newlen) __attribute__ ((weak));
-#endif
-
+/**************/
 /* prototypes */
+/**************/
 static void cleanup_hash_entry_func(gpointer key, gpointer value, gpointer user_data);
-
 static void init_plugin(PurplePlugin *plugin);
 static gboolean load_plugin(PurplePlugin *plugin);
 static gboolean unload_plugin(PurplePlugin *plugin);
@@ -57,18 +53,17 @@
 static void detach_from_conv(PurpleConversation *conv, gpointer null);
 static void delete_requested_icon_marks(PidginConversation *gtkconv, GHashTable *table);
 static void attach_to_conv(PurpleConversation *conv, gpointer null);
-
-
 static void conv_created_cb(PurpleConversation *conv, gpointer null);
 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 remove_marks_func(gpointer key, gpointer value, gpointer user_data);
 static void cancel_fetch_func(gpointer key, gpointer value, gpointer user_data);
-
 static gboolean displaying_im_cb(PurpleAccount *account, const char *who, char **message, PurpleConversation *conv, PurpleMessageFlags flags, void *data);
 static void displayed_im_cb(PurpleAccount *account, const char *who, char *message, PurpleConversation *conv, PurpleMessageFlags flags);
 
+#ifndef _WIN32
+extern gchar *sanitize_utf(const gchar *msg, gsize len, gsize *newlen) __attribute__ ((weak));
+#endif
 
 
 /*************/
@@ -1048,8 +1043,8 @@
     if(data) {
         /* check validity of icon */
         int count_thres = purple_prefs_get_int(OPT_ICON_MAX_COUNT);
-        int days_thres = DAYS_TO_SECONDS(
-            purple_prefs_get_int(OPT_ICON_MAX_DAYS));
+        int days_thres =
+            DAYS_TO_SECONDS(purple_prefs_get_int(OPT_ICON_MAX_DAYS));
 
         if(data->use_count > count_thres ||
            (data->mtime && ((time(NULL) - data->mtime)) > days_thres)) {
@@ -1073,7 +1068,7 @@
         return;
     }
 
-    /* if we have icon for this user, insert icon immediately */
+    /* if we have the icon for this user, insert the icon immediately */
     if(purple_prefs_get_bool(OPT_SHOW_ICON)) {
         gtk_text_buffer_insert_pixbuf(text_buffer,
                                       &insertion_point,
@@ -1091,24 +1086,30 @@
     int i;
 
     /* connect to signal */
-    purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg",
+    purple_signal_connect(purple_conversations_get_handle(),
+                          "writing-im-msg",
                           plugin, PURPLE_CALLBACK(writing_im_cb), NULL);
-    purple_signal_connect(purple_conversations_get_handle(), "sending-im-msg",
+    purple_signal_connect(purple_conversations_get_handle(),
+                          "sending-im-msg",
                           plugin, PURPLE_CALLBACK(sending_im_cb), NULL);
     purple_signal_connect(purple_conversations_get_handle(),
                           "conversation-created",
                           plugin, PURPLE_CALLBACK(conv_created_cb), NULL);
-    purple_signal_connect(purple_conversations_get_handle(), "receiving-im-msg",
+    purple_signal_connect(purple_conversations_get_handle(),
+                          "receiving-im-msg",
                           plugin, PURPLE_CALLBACK(receiving_im_cb), NULL);
-    purple_signal_connect(pidgin_conversations_get_handle(), "displaying-im-msg",
+    purple_signal_connect(pidgin_conversations_get_handle(),
+                          "displaying-im-msg",
                           plugin, PURPLE_CALLBACK(displaying_im_cb), NULL);
 
-    purple_signal_connect(pidgin_conversations_get_handle(), "displayed-im-msg",
+    purple_signal_connect(pidgin_conversations_get_handle(),
+                          "displayed-im-msg",
                           plugin, PURPLE_CALLBACK(displayed_im_cb), NULL);
     purple_signal_connect(purple_conversations_get_handle(),
                           "deleting-conversation",
                            plugin, PURPLE_CALLBACK(deleting_conv_cb), NULL);
-    purple_signal_connect(purple_connections_get_handle(), "signed-on",
+    purple_signal_connect(purple_connections_get_handle(),
+                          "signed-on",
                           plugin, PURPLE_CALLBACK(signed_on_cb), NULL);
 
 
@@ -1200,7 +1201,7 @@
     purple_signal_disconnect(purple_conversations_get_handle(),
                              "deleting-conversation",
                              plugin, PURPLE_CALLBACK(deleting_conv_cb));
-    purple_signal_disconnect(purple_connections_get_handle(), 
+    purple_signal_disconnect(purple_connections_get_handle(),
                              "signed-on",
                              plugin, PURPLE_CALLBACK(signed_on_cb));