Changeset 3353b5e


Ignore:
Timestamp:
2010-06-30T23:56:46Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e1f3f94
Parents:
52a2521 (diff), 8203da9 (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:

A few Twitter fixes from mainline.

Location:
protocols/twitter
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r52a2521 r3353b5e  
    269269                    td->oauth_info && td->oauth_info->token == NULL )
    270270                {
    271                         if( !oauth_access_token( message, td->oauth_info ) )
     271                        char pin[strlen(message)+1], *s;
     272                       
     273                        strcpy( pin, message );
     274                        for( s = pin + sizeof( pin ) - 2; s > pin && isspace( *s ); s -- )
     275                                *s = '\0';
     276                        for( s = pin; *s && isspace( *s ); s ++ ) {}
     277                       
     278                        if( !oauth_access_token( s, td->oauth_info ) )
    272279                        {
    273280                                imcb_error( ic, "OAuth error: %s", "Failed to send access token request" );
  • protocols/twitter/twitter_lib.c

    r52a2521 r3353b5e  
    4242struct twitter_xml_list {
    4343        int type;
    44         int next_cursor;
     44        gint64 next_cursor;
    4545        GSList *list;
    4646        gpointer data;
     
    155155 * Get the friends ids.
    156156 */
    157 void twitter_get_friends_ids(struct im_connection *ic, int next_cursor)
     157void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor)
    158158{
    159159        // Primitive, but hey! It works...     
    160160        char* args[2];
    161161        args[0] = "cursor";
    162         args[1] = g_strdup_printf ("%d", next_cursor);
     162        args[1] = g_strdup_printf ("%lld", (long long) next_cursor);
    163163        twitter_http(ic, TWITTER_FRIENDS_IDS_URL, twitter_http_get_friends_ids, ic, 0, args, 2);
    164164
     
    171171static xt_status twitter_xt_next_cursor( struct xt_node *node, struct twitter_xml_list *txl )
    172172{
    173         // Do something with the cursor.
    174         txl->next_cursor = node->text != NULL ? atoi(node->text) : -1;
     173        char *end = NULL;
     174       
     175        if( node->text )
     176                txl->next_cursor = g_ascii_strtoll( node->text, &end, 10 );
     177        if( end == NULL )
     178                txl->next_cursor = -1;
    175179
    176180        return XT_HANDLED;
     
    415419 * Get the timeline.
    416420 */
    417 void twitter_get_home_timeline(struct im_connection *ic, int next_cursor)
     421void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor)
    418422{
    419423        struct twitter_data *td = ic->proto_data;
     
    421425        char* args[4];
    422426        args[0] = "cursor";
    423         args[1] = g_strdup_printf ("%d", next_cursor);
     427        args[1] = g_strdup_printf ("%lld", (long long) next_cursor);
    424428        if (td->home_timeline_id) {
    425429                args[2] = "since_id";
     
    667671 * Get the friends.
    668672 */
    669 void twitter_get_statuses_friends(struct im_connection *ic, int next_cursor)
     673void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor)
    670674{
    671675        char* args[2];
    672676        args[0] = "cursor";
    673         args[1] = g_strdup_printf ("%d", next_cursor);
     677        args[1] = g_strdup_printf ("%lld", (long long) next_cursor);
    674678
    675679        twitter_http(ic, TWITTER_SHOW_FRIENDS_URL, twitter_http_get_statuses_friends, ic, 0, args, 2);
  • protocols/twitter/twitter_lib.h

    r52a2521 r3353b5e  
    7676#define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/"
    7777
    78 void twitter_get_friends_ids(struct im_connection *ic, int next_cursor);
    79 void twitter_get_home_timeline(struct im_connection *ic, int next_cursor);
    80 void twitter_get_statuses_friends(struct im_connection *ic, int next_cursor);
     78void twitter_get_friends_ids(struct im_connection *ic, gint64 next_cursor);
     79void twitter_get_home_timeline(struct im_connection *ic, gint64 next_cursor);
     80void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor);
    8181
    8282void twitter_post_status(struct im_connection *ic, char *msg);
Note: See TracChangeset for help on using the changeset viewer.