Changeset ce617f0 for protocols


Ignore:
Timestamp:
2011-03-27T14:09:55Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
f01bc6f
Parents:
ff94563
Message:

Tweaks to allow authenticating to identi.ca with OAuth. Doesn't seem to work
completely for whatever the reason may be (invalid signature). I give up for
now. Stuff does actually work if you generate access tokens using different
software so BitlBee's definitely able to generate good signatures.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    rff94563 rce617f0  
    9999};
    100100
     101static const struct oauth_service identica_oauth =
     102{
     103        "http://identi.ca/api/oauth/request_token",
     104        "http://identi.ca/api/oauth/access_token",
     105        "https://identi.ca/api/oauth/authorize",
     106        .consumer_key = "e147ff789fcbd8a5a07963afbb43f9da",
     107        .consumer_secret = "c596267f277457ec0ce1ab7bb788d828",
     108};
     109
    101110static gboolean twitter_oauth_callback( struct oauth_info *info );
    102111
     112static const struct oauth_service *get_oauth_service( struct im_connection *ic )
     113{
     114        struct twitter_data *td = ic->proto_data;
     115       
     116        if( strstr( td->url_host, "identi.ca" ) )
     117                return &identica_oauth;
     118        else
     119                return &twitter_oauth;
     120       
     121        /* Could add more services, or allow configuring your own base URL +
     122           API keys. */
     123}
     124
    103125static void twitter_oauth_start( struct im_connection *ic )
    104126{
     
    107129        imcb_log( ic, "Requesting OAuth request token" );
    108130
    109         td->oauth_info = oauth_request_token( &twitter_oauth, twitter_oauth_callback, ic );
     131        td->oauth_info = oauth_request_token( get_oauth_service( ic ), twitter_oauth_callback, ic );
    110132       
    111133        /* We need help from the user to complete OAuth login, so don't time
     
    263285        td->user = acc->user;
    264286        if( strstr( acc->pass, "oauth_token=" ) )
    265                 td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth );
     287                td->oauth_info = oauth_from_string( acc->pass, get_oauth_service( ic ) );
    266288       
    267289        sprintf( name, "%s_%s", td->prefix, acc->user );
Note: See TracChangeset for help on using the changeset viewer.