diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2011-03-27 15:09:55 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2011-03-27 15:09:55 +0100 | 
| commit | ce617f0a445df1201808a9cd29722a9cf6c96b95 (patch) | |
| tree | 6ac7212932eca89a84bb311345c40149f7a2dde1 /protocols | |
| parent | ff9456329255ef8b227f9322ca8d25ef6c790e7e (diff) | |
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.
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/twitter/twitter.c | 26 | 
1 files changed, 24 insertions, 2 deletions
| diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index dbe9b984..63f648df 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -98,15 +98,37 @@ static const struct oauth_service twitter_oauth =  	.consumer_secret = "FCxqcr0pXKzsF9ajmP57S3VQ8V6Drk4o2QYtqMcOszo",  }; +static const struct oauth_service identica_oauth = +{ +	"http://identi.ca/api/oauth/request_token", +	"http://identi.ca/api/oauth/access_token", +	"https://identi.ca/api/oauth/authorize", +	.consumer_key = "e147ff789fcbd8a5a07963afbb43f9da", +	.consumer_secret = "c596267f277457ec0ce1ab7bb788d828", +}; +  static gboolean twitter_oauth_callback( struct oauth_info *info ); +static const struct oauth_service *get_oauth_service( struct im_connection *ic ) +{ +	struct twitter_data *td = ic->proto_data; +	 +	if( strstr( td->url_host, "identi.ca" ) ) +		return &identica_oauth; +	else +		return &twitter_oauth; +	 +	/* Could add more services, or allow configuring your own base URL + +	   API keys. */ +} +  static void twitter_oauth_start( struct im_connection *ic )  {  	struct twitter_data *td = ic->proto_data;  	imcb_log( ic, "Requesting OAuth request token" ); -	td->oauth_info = oauth_request_token( &twitter_oauth, twitter_oauth_callback, ic ); +	td->oauth_info = oauth_request_token( get_oauth_service( ic ), twitter_oauth_callback, ic );  	/* We need help from the user to complete OAuth login, so don't time  	   out on this login. */ @@ -262,7 +284,7 @@ static void twitter_login( account_t *acc )  	td->user = acc->user;  	if( strstr( acc->pass, "oauth_token=" ) ) -		td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth ); +		td->oauth_info = oauth_from_string( acc->pass, get_oauth_service( ic ) );  	sprintf( name, "%s_%s", td->prefix, acc->user );  	imcb_add_buddy( ic, name, NULL ); | 
