Changeset b4dd253
- Timestamp:
- 2009-12-02T18:08:40Z (15 years ago)
- Branches:
- master
- Children:
- 62d2cfb
- Parents:
- 1b221e0
- Location:
- protocols/twitter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.h
r1b221e0 rb4dd253 38 38 char* pass; 39 39 guint64 home_timeline_id; 40 struct groupchat *home_timeline_gc; 40 41 }; 41 42 -
protocols/twitter/twitter_lib.c
r1b221e0 rb4dd253 272 272 struct twitter_xml_list *txl; 273 273 struct twitter_data *td = ic->proto_data; 274 struct groupchat *gc; 274 275 275 276 // Check if the HTTP request went well. … … 293 294 struct twitter_xml_status *status; 294 295 295 imcb_add_buddy( ic, "home_timeline", NULL ); 296 imcb_buddy_status( ic, "home_timeline", OPT_LOGGED_IN, NULL, NULL ); 296 // Create a new groupchat if it does not exsist. 297 if (!td->home_timeline_gc) 298 { 299 td->home_timeline_gc = gc = imcb_chat_new( ic, "home/timeline" ); 300 // Add the current user to the chat... 301 imcb_chat_add_buddy( gc, ic->acc->user ); 302 } 303 else 304 { 305 gc = td->home_timeline_gc; 306 } 297 307 298 308 for ( l = txl->list; l ; l = g_slist_next(l) ) 299 309 { 300 310 status = l->data; 301 imcb_buddy_msg( ic, "home_timeline", status->text, 0, 0 ); 311 // TODO Put the next part in a new function.... 312 313 // Ugly hack, to show current user in chat... 314 if ( g_strcasecmp(status->user->screen_name, ic->acc->user) == 0) 315 { 316 char *tmp = g_strdup_printf ("_%s_", status->user->screen_name); 317 g_free(status->user->screen_name); 318 status->user->screen_name = tmp; 319 } 320 321 // Check if the buddy is allready in the buddy list. 322 if (!user_findhandle( ic, status->user->screen_name )) 323 { 324 // The buddy is not in the list, add the buddy... 325 imcb_add_buddy( ic, status->user->screen_name, NULL ); 326 imcb_buddy_status( ic, status->user->screen_name, OPT_LOGGED_IN, NULL, NULL ); 327 } 328 329 // Say it! 330 imcb_chat_msg (gc, status->user->screen_name, status->text, 0, 0 ); 331 // Update the home_timeline_id to hold the highest id, so that by the next request 332 // we won't pick up the updates allready in the list. 302 333 td->home_timeline_id = td->home_timeline_id < status->id ? status->id : td->home_timeline_id; 303 334 }
Note: See TracChangeset
for help on using the changeset viewer.