Ignore:
Timestamp:
2010-06-01T21:51:27Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
ad404ab
Parents:
3429b58 (diff), ba3233c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging head.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r3429b58 r704dd38  
    2727#include "twitter_http.h"
    2828#include "twitter_lib.h"
     29#include "url.h"
    2930
    3031/**
     
    7071        "http://api.twitter.com/oauth/request_token",
    7172        "http://api.twitter.com/oauth/access_token",
    72         "http://api.twitter.com/oauth/authorize",
     73        "https://api.twitter.com/oauth/authorize",
    7374        .consumer_key = "xsDNKJuNZYkZyMcu914uEA",
    7475        .consumer_secret = "FCxqcr0pXKzsF9ajmP57S3VQ8V6Drk4o2QYtqMcOszo",
     
    160161        set_t *s;
    161162       
     163        s = set_add( &acc->set, "base_url", TWITTER_API_URL, NULL, acc );
     164        s->flags |= ACC_SET_OFFLINE_ONLY;
     165       
    162166        s = set_add( &acc->set, "message_length", "140", set_eval_int, acc );
    163167       
     
    175179{
    176180        struct im_connection *ic = imcb_new( acc );
    177         struct twitter_data *td = g_new0( struct twitter_data, 1 );
     181        struct twitter_data *td;
    178182        char name[strlen(acc->user)+9];
    179 
     183        url_t url;
     184
     185        if( !url_set( &url, set_getstr( &ic->acc->set, "base_url" ) ) ||
     186            ( url.proto != PROTO_HTTP && url.proto != PROTO_HTTPS ) )
     187        {
     188                imcb_error( ic, "Incorrect API base URL: %s", set_getstr( &ic->acc->set, "base_url" ) );
     189                imc_logout( ic, FALSE );
     190                return;
     191        }
     192       
    180193        twitter_connections = g_slist_append( twitter_connections, ic );
     194        td = g_new0( struct twitter_data, 1 );
    181195        ic->proto_data = td;
    182         ic->flags |= OPT_DOES_HTML;
     196       
     197        td->url_ssl = url.proto == PROTO_HTTPS;
     198        td->url_port = url.port;
     199        td->url_host = g_strdup( url.host );
     200        if( strcmp( url.file, "/" ) != 0 )
     201                td->url_path = g_strdup( url.file );
     202        else
     203                td->url_path = g_strdup( "" );
    183204       
    184205        td->user = acc->user;
    185         if( !set_getbool( &acc->set, "oauth" ) )
    186                 td->pass = g_strdup( acc->pass );
    187         else if( strstr( acc->pass, "oauth_token=" ) )
     206        if( strstr( acc->pass, "oauth_token=" ) )
    188207                td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth );
    189         td->home_timeline_id = 0;
    190208       
    191209        sprintf( name, "twitter_%s", acc->user );
     
    193211        imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL );
    194212       
    195         if( td->pass || td->oauth_info )
     213        if( td->oauth_info || !set_getbool( &acc->set, "oauth" ) )
    196214                twitter_main_loop_start( ic );
    197215        else
     
    268286static void twitter_add_buddy( struct im_connection *ic, char *who, char *group )
    269287{
     288        twitter_friendships_create_destroy(ic, who, 1);
    270289}
    271290
    272291static void twitter_remove_buddy( struct im_connection *ic, char *who, char *group )
    273292{
     293        twitter_friendships_create_destroy(ic, who, 0);
    274294}
    275295
Note: See TracChangeset for help on using the changeset viewer.