Ignore:
Timestamp:
2010-03-25T21:31:27Z (14 years ago)
Author:
Geert Mulders <g.c.w.m.mulders@…>
Branches:
master
Children:
2abceca
Parents:
b4dd253
Message:

Added option to get tweeds either through groupchat or privmes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    rb4dd253 r62d2cfb  
    2929
    3030/**
    31  *  * Main loop function
    32  *   */
     31 * Main loop function
     32 */
    3333gboolean twitter_main_loop(gpointer data, gint fd, b_input_condition cond)
    3434{
     
    3838                return 0;
    3939
     40        // If the user uses multiple private message windows we need to get the
     41        // users buddies.
     42        if (!set_getbool( &ic->acc->set, "use_groupchat" ))
     43                twitter_get_statuses_friends(ic, -1);
     44
    4045        // Do stuff..
    4146        twitter_get_home_timeline(ic, -1);
     
    4853static void twitter_init( account_t *acc )
    4954{
     55        set_t *s;
     56        s = set_add( &acc->set, "use_groupchat", "false", set_eval_bool, acc );
    5057}
    5158
     
    5865        struct im_connection *ic = imcb_new( acc );
    5966        struct twitter_data *td = g_new0( struct twitter_data, 1 );
    60        
     67
    6168        td->user = acc->user;
    6269        td->pass = acc->pass;
     
    6875        ic->flags = OPT_LOGGED_IN;
    6976
    70         // Try to get the buddies...
    71         //twitter_get_friends_ids(ic, -1);
    72 
    73         //twitter_get_home_timeline(ic, -1);
    74 
    7577        // Run this once. After this queue the main loop function.
    7678        twitter_main_loop(ic, -1, 0);
     
    8183        imcb_log( ic, "Connecting to twitter" );
    8284        imcb_connected(ic);
     85
     86        twitter_connections = g_slist_append( twitter_connections, ic );
    8387}
    8488
     
    97101                g_free( td );
    98102        }
     103
     104        twitter_connections = g_slist_remove( twitter_connections, ic );
    99105}
    100106
     
    104110static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message, int away )
    105111{
    106         imcb_log( ic, "In twitter_buddy_msg...");
    107         twitter_post_status(ic, message);
     112        // Let's just update the status.
     113//      if ( g_strcasecmp(who, ic->acc->user) == 0 )
     114                twitter_post_status(ic, message);
     115//      else
     116//              twitter_direct_messages_new(ic, who, message);
    108117        return( 0 );
    109118}
     
    124133static void twitter_set_my_name( struct im_connection *ic, char *info )
    125134{
    126         imcb_log( ic, "In twitter_set_my_name..." );
    127 //      char * aap = twitter_http("http://gertje.org", NULL, ic, 1, "geert", "poep", NULL, 0);
    128 
    129 //      imcb_log( ic, aap );
    130 //      g_free(aap);
    131135}
    132136
     
    218222
    219223        register_protocol(ret);
    220 }
    221 
     224
     225        // Initialise the twitter_connections GSList.
     226        twitter_connections = NULL;
     227}
     228
Note: See TracChangeset for help on using the changeset viewer.