Ignore:
Timestamp:
2010-04-26T00:42:37Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
acba168
Parents:
b2bc25c
Message:

Successfully posted a tweet!

Twitter's tricky. It returns vars (user_id, screen_name) in the access token
that, the way I read the spec, should be included in all subsequent queries.
However, stuff only started to work when I dropped those vars.

This code's definitely not pretty ATM. Need to clean up now that it actually
works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter_http.c

    rb2bc25c r508c340  
    3535#include "misc.h"
    3636#include "base64.h"
     37#include "oauth.h"
    3738#include <ctype.h>
    3839#include <errno.h>
     
    4546 * This is actually pretty generic function... Perhaps it should move to the lib/http_client.c
    4647 */
    47 void *twitter_http(char *url_string, http_input_function func, gpointer data, int is_post, char* user, char* pass, char** arguments, int arguments_len)
     48void *twitter_http(char *url_string, http_input_function func, gpointer data, int is_post, char* user, char* pass, char* oauth_token, char** arguments, int arguments_len)
    4849{
    4950        url_t *url = g_new0( url_t, 1 );
     
    110111
    111112        // If a pass and user are given we append them to the request.
    112         if (userpass_base64)
     113        if (oauth_token)
     114        {
     115                char *full_header;
     116               
     117                full_header = oauth_http_header(oauth_token,
     118                                                is_post ? "POST" : "GET",
     119                                                url_string, url_arguments);
     120               
     121                tmp = g_strdup_printf("%sAuthorization: %s\r\n", request, full_header);
     122                g_free(request);
     123                g_free(full_header);
     124                request = tmp;
     125        }
     126        else if (userpass_base64)
    113127        {
    114128                tmp = g_strdup_printf("%sAuthorization: Basic %s\r\n", request, userpass_base64);
Note: See TracChangeset for help on using the changeset viewer.