diff pidgin-twitter.h @ 152:588da540685a

work in progress icon update feature. the default thresholds have been set to 5 times or 1 day for testing.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 25 Jul 2008 07:05:04 +0900
parents 4e9d0fd93fb6
children 07cedffb1c63
line wrap: on
line diff
--- a/pidgin-twitter.h	Thu Jul 24 21:49:20 2008 +0900
+++ b/pidgin-twitter.h	Fri Jul 25 07:05:04 2008 +0900
@@ -52,6 +52,8 @@
     GList *request_list;    /* marker list */
     PurpleUtilFetchUrlData *fetch_data; /* icon fetch data */
     const gchar *img_type;  /* image type */
+    gint use_count;         /* usage count */
+    time_t mtime;           /* mtime of file */
 } icon_data;
 
 /* used by got_icon_cb */
@@ -110,6 +112,8 @@
 #define OPT_PASSWORD_TWITTER    OPT_PIDGINTWITTER "/password_twitter"
 #define OPT_SHOW_ICON           OPT_PIDGINTWITTER "/show_icon"
 #define OPT_ICON_SIZE           OPT_PIDGINTWITTER "/icon_size"
+#define OPT_ICON_MAX_COUNT      OPT_PIDGINTWITTER "/icon_max_count"
+#define OPT_ICON_MAX_DAYS       OPT_PIDGINTWITTER "/icon_max_days"
 #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval"
 
 /* formats and templates */
@@ -157,6 +161,9 @@
 
 /* misc macros */
 #define DEFAULT_ICON_SIZE (48)
+#define DEFAULT_ICON_MAX_COUNT (5)
+#define DEFAULT_ICON_MAX_DAYS (1)
+#define DAYS_TO_SECONDS(d) ((d) * 86400)
 
 /* debug macros */
 #define twitter_debug(fmt, ...)	purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d:  " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__);
@@ -188,7 +195,7 @@
 static void insert_icon_at_mark(GtkTextMark *requested_mark, gpointer user_data);
 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, gint service);
+static void request_icon(const char *user_name, gint service, gboolean renew);
 static void mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service);
 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);