comparison twitter_api.c @ 284:2d559555875f

now message count can be specified in twitter API access.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 12 Jan 2009 00:59:41 +0900
parents d973f9debe86
children 4a7f4ba199cc
comparison
equal deleted inserted replaced
282:ba00b20d968b 284:2d559555875f
288 288
289 /* status fetching function. it will be called periodically. */ 289 /* status fetching function. it will be called periodically. */
290 gboolean 290 gboolean
291 get_status_with_api(gpointer data) 291 get_status_with_api(gpointer data)
292 { 292 {
293 twitter_debug("called\n");
294
293 /* fetch friends time line */ 295 /* fetch friends time line */
294 char *request, *header; 296 char *request, *header;
295 char *basic_auth, *basic_auth_encoded; 297 char *basic_auth, *basic_auth_encoded;
296 298 gint count = purple_prefs_get_int(OPT_RETRIEVE_COUNT);
297 twitter_debug("called\n"); 299
300 if(count < TWITTER_DEFAULT_RETRIEVE_COUNT)
301 count = TWITTER_DEFAULT_RETRIEVE_COUNT;
298 302
299 /* if disabled, just return */ 303 /* if disabled, just return */
300 if(!purple_prefs_get_bool(OPT_API_BASE_POST)) 304 if(!purple_prefs_get_bool(OPT_API_BASE_POST))
301 return TRUE; 305 return TRUE;
302 306
315 basic_auth_encoded = purple_base64_encode((unsigned char *)basic_auth, 319 basic_auth_encoded = purple_base64_encode((unsigned char *)basic_auth,
316 strlen(basic_auth)); 320 strlen(basic_auth));
317 g_free(basic_auth); 321 g_free(basic_auth);
318 322
319 /* header */ 323 /* header */
320 header = g_strdup_printf(TWITTER_STATUS_GET, basic_auth_encoded); 324
325 header = g_strdup_printf(TWITTER_STATUS_GET, count, basic_auth_encoded);
321 request = g_strconcat(header, "\r\n", NULL); 326 request = g_strconcat(header, "\r\n", NULL);
322 327
323 /* invoke fetch */ 328 /* invoke fetch */
324 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE, 329 purple_util_fetch_url_request(TWITTER_BASE_URL, FALSE,
325 NULL, TRUE, request, TRUE, 330 NULL, TRUE, request, TRUE,