- Timestamp:
- 2010-04-07T00:27:51Z (15 years ago)
- Branches:
- master
- Children:
- 1014cab
- Parents:
- 0519b0a
- Location:
- protocols/twitter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r0519b0a rd569019 36 36 // Check if we are still logged in... 37 37 // We are logged in if the flag says so and the connection is still in the connections list. 38 if ( (ic->flags & OPT_LOGGED_IN) != OPT_LOGGED_IN39 && !g_slist_find( twitter_connections, ic ))38 if (!g_slist_find( twitter_connections, ic ) || 39 (ic->flags & OPT_LOGGED_IN) != OPT_LOGGED_IN) 40 40 return 0; 41 41 … … 69 69 struct twitter_data *td = g_new0( struct twitter_data, 1 ); 70 70 71 twitter_connections = g_slist_append( twitter_connections, ic ); 72 71 73 td->user = acc->user; 72 74 td->pass = acc->pass; … … 75 77 ic->proto_data = td; 76 78 77 imcb_log( ic, "Connecting to twitter" );79 imcb_log( ic, "Connecting to Twitter" ); 78 80 imcb_connected(ic); 79 81 … … 84 86 // Save the return value, so we can remove the timeout on logout. 85 87 td->main_loop_id = b_timeout_add(60000, twitter_main_loop, ic); 86 87 twitter_connections = g_slist_append( twitter_connections, ic );88 88 } 89 89 -
protocols/twitter/twitter_lib.c
r0519b0a rd569019 37 37 #define TXL_ID 3 38 38 39 static void twitter_imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at );40 41 39 struct twitter_xml_list { 42 40 int type; … … 101 99 { 102 100 // Check if the buddy is allready in the buddy list. 103 if (! user_findhandle( ic, name ))101 if (!imcb_find_buddy( ic, name )) 104 102 { 105 103 // The buddy is not in the list, add the buddy and set the status to logged in. … … 409 407 status = l->data; 410 408 twitter_add_buddy(ic, status->user->screen_name); 409 411 410 // Say it! 412 twitter_imcb_chat_msg (gc, status->user->screen_name, status->text, 0, 0 ); 411 if (g_strcasecmp(td->user, status->user->screen_name) == 0) 412 imcb_chat_log (gc, "Your Tweet: %s", status->text); 413 else 414 imcb_chat_msg (gc, status->user->screen_name, status->text, 0, 0 ); 415 413 416 // Update the home_timeline_id to hold the highest id, so that by the next request 414 417 // we won't pick up the updates allready in the list. … … 597 600 // g_free(args[3]); 598 601 } 599 600 601 /**602 * This function "overwrites" the imcb_chat_msg function. Because in the original the logged in user is filtered out.603 */604 static void twitter_imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at )605 {606 struct im_connection *ic = c->ic;607 char *wrapped;608 user_t *u;609 610 u = user_findhandle( ic, who );611 if( ( g_strcasecmp( set_getstr( &ic->irc->set, "strip_html" ), "always" ) == 0 )612 || ( ( ic->flags & OPT_DOES_HTML ) && set_getbool( &ic->irc->set, "strip_html" ) ) )613 strip_html( msg );614 615 wrapped = word_wrap( msg, 425 );616 if( c && u )617 {618 irc_privmsg( ic->irc, u, "PRIVMSG", c->channel, "", wrapped );619 }620 else621 {622 imcb_log( ic, "Message from/to conversation %s@%p (unknown conv/user): %s", who, c, wrapped );623 }624 g_free( wrapped );625 }626
Note: See TracChangeset
for help on using the changeset viewer.