Changeset d569019


Ignore:
Timestamp:
2010-04-07T00:27:51Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1014cab
Parents:
0519b0a
Message:

A little more cleanup.

Location:
protocols/twitter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r0519b0a rd569019  
    3636        // Check if we are still logged in...
    3737        // 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_IN
    39                         && !g_slist_find( twitter_connections, ic ))
     38        if (!g_slist_find( twitter_connections, ic ) ||
     39            (ic->flags & OPT_LOGGED_IN) != OPT_LOGGED_IN)
    4040                return 0;
    4141
     
    6969        struct twitter_data *td = g_new0( struct twitter_data, 1 );
    7070
     71        twitter_connections = g_slist_append( twitter_connections, ic );
     72
    7173        td->user = acc->user;
    7274        td->pass = acc->pass;
     
    7577        ic->proto_data = td;
    7678
    77         imcb_log( ic, "Connecting to twitter" );
     79        imcb_log( ic, "Connecting to Twitter" );
    7880        imcb_connected(ic);
    7981
     
    8486        // Save the return value, so we can remove the timeout on logout.
    8587        td->main_loop_id = b_timeout_add(60000, twitter_main_loop, ic);
    86 
    87         twitter_connections = g_slist_append( twitter_connections, ic );
    8888}
    8989
  • protocols/twitter/twitter_lib.c

    r0519b0a rd569019  
    3737#define TXL_ID 3
    3838
    39 static void twitter_imcb_chat_msg( struct groupchat *c, char *who, char *msg, uint32_t flags, time_t sent_at );
    40 
    4139struct twitter_xml_list {
    4240        int type;
     
    10199{
    102100        // Check if the buddy is allready in the buddy list.
    103         if (!user_findhandle( ic, name ))
     101        if (!imcb_find_buddy( ic, name ))
    104102        {
    105103                // The buddy is not in the list, add the buddy and set the status to logged in.
     
    409407                status = l->data;
    410408                twitter_add_buddy(ic, status->user->screen_name);
     409               
    411410                // 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               
    413416                // Update the home_timeline_id to hold the highest id, so that by the next request
    414417                // we won't pick up the updates allready in the list.
     
    597600//      g_free(args[3]);
    598601}
    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         else
    621         {   
    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.