Mercurial > pidgin-twitter
comparison twitter_api.c @ 305:227e59f017f2
status id now exceeds int32 limit.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 13 Jun 2009 17:54:39 +0900 |
parents | 6c8942296a47 |
children | 18d3e7c582de |
comparison
equal
deleted
inserted
replaced
304:6c8942296a47 | 305:227e59f017f2 |
---|---|
7 static void parse_user(xmlNode *user, status_t *st); | 7 static void parse_user(xmlNode *user, status_t *st); |
8 static void read_timestamp(const char *str, struct tm *res); | 8 static void read_timestamp(const char *str, struct tm *res); |
9 static void parse_status(xmlNode *status, status_t *st); | 9 static void parse_status(xmlNode *status, status_t *st); |
10 | 10 |
11 static void free_status(status_t *st); | 11 static void free_status(status_t *st); |
12 static gboolean is_posted_message(status_t *status, guint lastid); | 12 static gboolean is_posted_message(status_t *status, guint64 lastid); |
13 static void get_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); | 13 static void get_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
14 static void post_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); | 14 static void post_status_with_api_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
15 | 15 |
16 #ifdef _WIN32 | 16 #ifdef _WIN32 |
17 extern gboolean blink_state; | 17 extern gboolean blink_state; |
30 for(nptr = user->children; nptr != NULL; nptr = nptr->next) { | 30 for(nptr = user->children; nptr != NULL; nptr = nptr->next) { |
31 if(nptr->type == XML_ELEMENT_NODE) { | 31 if(nptr->type == XML_ELEMENT_NODE) { |
32 if(!xmlStrcmp(nptr->name, (xmlChar *)"screen_name")) { | 32 if(!xmlStrcmp(nptr->name, (xmlChar *)"screen_name")) { |
33 gchar *str = (gchar *)xmlNodeGetContent(nptr); | 33 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
34 st->screen_name = g_strdup(str); | 34 st->screen_name = g_strdup(str); |
35 twitter_debug("screen_name=%s\n", st->screen_name); | |
35 xmlFree(str); | 36 xmlFree(str); |
36 } | 37 } |
37 else if(!xmlStrcmp(nptr->name, (xmlChar *)"profile_image_url")) { | 38 else if(!xmlStrcmp(nptr->name, (xmlChar *)"profile_image_url")) { |
38 gchar *str = (gchar *)xmlNodeGetContent(nptr); | 39 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
39 st->profile_image_url = g_strdup(str); | 40 st->profile_image_url = g_strdup(str); |
134 | 135 |
135 xmlFree(str); | 136 xmlFree(str); |
136 } | 137 } |
137 else if(!xmlStrcmp(nptr->name, (xmlChar *)"id")) { | 138 else if(!xmlStrcmp(nptr->name, (xmlChar *)"id")) { |
138 gchar *str = (gchar *)xmlNodeGetContent(nptr); | 139 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
139 st->id = atoi(str); | 140 st->id = atoll(str); |
141 twitter_debug("id=%lld\n", st->id); | |
140 xmlFree(str); | 142 xmlFree(str); |
141 } | 143 } |
142 else if(!xmlStrcmp(nptr->name, (xmlChar *)"text")) { | 144 else if(!xmlStrcmp(nptr->name, (xmlChar *)"text")) { |
143 gchar *str = (gchar *)xmlNodeGetContent(nptr); | 145 gchar *str = (gchar *)xmlNodeGetContent(nptr); |
144 st->text = g_strdup(str); | 146 st->text = g_strdup(str); |
159 g_free(st->screen_name); | 161 g_free(st->screen_name); |
160 g_free(st->profile_image_url); | 162 g_free(st->profile_image_url); |
161 } | 163 } |
162 | 164 |
163 static gboolean | 165 static gboolean |
164 is_posted_message(status_t *status, guint lastid) | 166 is_posted_message(status_t *status, guint64 lastid) |
165 { | 167 { |
166 GList *pp = g_list_first(postedlist); | 168 GList *pp = g_list_first(postedlist); |
167 gboolean rv = FALSE; | 169 gboolean rv = FALSE; |
168 | 170 |
169 while(pp) { | 171 while(pp) { |
194 const gchar *error_message) | 196 const gchar *error_message) |
195 | 197 |
196 { | 198 { |
197 xmlDocPtr doc; | 199 xmlDocPtr doc; |
198 xmlNode *nptr, *nptr2; | 200 xmlNode *nptr, *nptr2; |
199 static guint lastid = 0; | 201 static guint64 lastid = 0; |
200 PurpleConversation *conv; | 202 PurpleConversation *conv; |
201 GList *stp; | 203 GList *stp; |
202 const gchar *start; | 204 const gchar *start; |
203 | 205 |
204 g_return_if_fail(url_text != NULL); | 206 g_return_if_fail(url_text != NULL); |
259 | 261 |
260 PurpleMessageFlags flag = PURPLE_MESSAGE_RECV; | 262 PurpleMessageFlags flag = PURPLE_MESSAGE_RECV; |
261 | 263 |
262 msg = g_strdup_printf("%s: %s", st->screen_name, st->text); | 264 msg = g_strdup_printf("%s: %s", st->screen_name, st->text); |
263 | 265 |
264 /* apply filter*/ | 266 /* apply filter */ |
265 if(purple_prefs_get_bool(OPT_FILTER)) { | 267 if(purple_prefs_get_bool(OPT_FILTER)) { |
266 apply_filter(&sender, &msg, &flag, twitter_service); | 268 apply_filter(&sender, &msg, &flag, twitter_service); |
267 } | 269 } |
268 if(sender && msg) { | 270 if(sender && msg) { |
269 purple_conv_im_write(conv->u.im, | 271 purple_conv_im_write(conv->u.im, |