comparison 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
comparison
equal deleted inserted replaced
151:8ba0c0593621 152:588da540685a
50 gint icon_id; /* image id */ 50 gint icon_id; /* image id */
51 gboolean requested; /* TRUE if download icon has been requested */ 51 gboolean requested; /* TRUE if download icon has been requested */
52 GList *request_list; /* marker list */ 52 GList *request_list; /* marker list */
53 PurpleUtilFetchUrlData *fetch_data; /* icon fetch data */ 53 PurpleUtilFetchUrlData *fetch_data; /* icon fetch data */
54 const gchar *img_type; /* image type */ 54 const gchar *img_type; /* image type */
55 gint use_count; /* usage count */
56 time_t mtime; /* mtime of file */
55 } icon_data; 57 } icon_data;
56 58
57 /* used by got_icon_cb */ 59 /* used by got_icon_cb */
58 typedef struct _got_icon_data { 60 typedef struct _got_icon_data {
59 gchar *user_name; 61 gchar *user_name;
108 #define OPT_SCREEN_NAME_WASSR OPT_PIDGINTWITTER "/screen_name_wassr" 110 #define OPT_SCREEN_NAME_WASSR OPT_PIDGINTWITTER "/screen_name_wassr"
109 #define OPT_SCREEN_NAME_IDENTICA OPT_PIDGINTWITTER "/screen_name_identica" 111 #define OPT_SCREEN_NAME_IDENTICA OPT_PIDGINTWITTER "/screen_name_identica"
110 #define OPT_PASSWORD_TWITTER OPT_PIDGINTWITTER "/password_twitter" 112 #define OPT_PASSWORD_TWITTER OPT_PIDGINTWITTER "/password_twitter"
111 #define OPT_SHOW_ICON OPT_PIDGINTWITTER "/show_icon" 113 #define OPT_SHOW_ICON OPT_PIDGINTWITTER "/show_icon"
112 #define OPT_ICON_SIZE OPT_PIDGINTWITTER "/icon_size" 114 #define OPT_ICON_SIZE OPT_PIDGINTWITTER "/icon_size"
115 #define OPT_ICON_MAX_COUNT OPT_PIDGINTWITTER "/icon_max_count"
116 #define OPT_ICON_MAX_DAYS OPT_PIDGINTWITTER "/icon_max_days"
113 #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval" 117 #define OPT_API_BASE_GET_INTERVAL OPT_PIDGINTWITTER "/api_base_get_interval"
114 118
115 /* formats and templates */ 119 /* formats and templates */
116 #define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>" 120 #define RECIPIENT_FORMAT_TWITTER "@<a href='http://twitter.com/%s'>%s</a>"
117 #define SENDER_FORMAT_TWITTER "%s<a href='http://twitter.com/%s'>%s</a>: " 121 #define SENDER_FORMAT_TWITTER "%s<a href='http://twitter.com/%s'>%s</a>: "
155 #define WASSR_POST_LEN (255 * 4) 159 #define WASSR_POST_LEN (255 * 4)
156 #define IDENTICA_POST_LEN (140) 160 #define IDENTICA_POST_LEN (140)
157 161
158 /* misc macros */ 162 /* misc macros */
159 #define DEFAULT_ICON_SIZE (48) 163 #define DEFAULT_ICON_SIZE (48)
164 #define DEFAULT_ICON_MAX_COUNT (5)
165 #define DEFAULT_ICON_MAX_DAYS (1)
166 #define DAYS_TO_SECONDS(d) ((d) * 86400)
160 167
161 /* debug macros */ 168 /* debug macros */
162 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); 169 #define twitter_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__);
163 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__); 170 #define twitter_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, PLUGIN_NAME, "%s():%4d: " fmt, __FUNCTION__, (int)__LINE__, ## __VA_ARGS__);
164 171
186 static void deleting_conv_cb(PurpleConversation *conv); 193 static void deleting_conv_cb(PurpleConversation *conv);
187 static gboolean receiving_im_cb(PurpleAccount *account, char **sender, char **buffer, PurpleConversation *conv, PurpleMessageFlags *flags, void *data); 194 static gboolean receiving_im_cb(PurpleAccount *account, char **sender, char **buffer, PurpleConversation *conv, PurpleMessageFlags *flags, void *data);
188 static void insert_icon_at_mark(GtkTextMark *requested_mark, gpointer user_data); 195 static void insert_icon_at_mark(GtkTextMark *requested_mark, gpointer user_data);
189 static void insert_requested_icon(const gchar *user_name, gint service); 196 static void insert_requested_icon(const gchar *user_name, gint service);
190 static void got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); 197 static void got_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message);
191 static void request_icon(const char *user_name, gint service); 198 static void request_icon(const char *user_name, gint service, gboolean renew);
192 static void mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service); 199 static void mark_icon_for_user(GtkTextMark *mark, const gchar *user_name, gint service);
193 static gboolean displaying_im_cb(PurpleAccount *account, const char *who, char **message, PurpleConversation *conv, PurpleMessageFlags flags, void *data); 200 static gboolean displaying_im_cb(PurpleAccount *account, const char *who, char **message, PurpleConversation *conv, PurpleMessageFlags flags, void *data);
194 static void displayed_im_cb(PurpleAccount *account, const char *who, char *message, PurpleConversation *conv, PurpleMessageFlags flags); 201 static void displayed_im_cb(PurpleAccount *account, const char *who, char *message, PurpleConversation *conv, PurpleMessageFlags flags);
195 static gboolean load_plugin(PurplePlugin *plugin); 202 static gboolean load_plugin(PurplePlugin *plugin);
196 static gboolean unload_plugin(PurplePlugin *plugin); 203 static gboolean unload_plugin(PurplePlugin *plugin);