Ticket #648: kensanata.2.diff

File kensanata.2.diff, 3.3 KB (added by Alex Schroeder <kensanata@…>, at 2010-07-15T01:26:23Z)

twitter.com uses twitter, identi.ca stays identi.ca

  • protocols/twitter/Makefile

    === modified file 'protocols/twitter/Makefile'
     
    2323lcov: check
    2424gcov:
    2525        gcov *.c
    26        
     26
    2727.PHONY: all clean distclean
    2828
    2929clean:
     
    4242twitter_mod.o: $(objects)
    4343        @echo '*' Linking twitter_mod.o
    4444        @$(LD) $(LFLAGS) $(objects) -o twitter_mod.o
    45        
    46 
  • protocols/twitter/twitter.c

    === modified file 'protocols/twitter/twitter.c'
     
    118118                        return FALSE;
    119119                }
    120120               
    121                 sprintf( name, "twitter_%s", ic->acc->user );
     121                sprintf( name, "%s_%s", td->host, ic->acc->user );
    122122                msg = g_strdup_printf( "To finish OAuth authentication, please visit "
    123123                                       "%s and respond with the resulting PIN code.",
    124124                                       info->auth_url );
     
    213213                td->url_path = g_strdup( url.file );
    214214        else
    215215                td->url_path = g_strdup( "" );
     216        if( g_str_has_suffix( url.host, ".com" ) )
     217                td->host = g_strndup ( url.host, strlen( url.host ) - 4 );
     218        else
     219                td->host = g_strdup ( url.host );
    216220       
    217221        td->user = acc->user;
    218222        if( strstr( acc->pass, "oauth_token=" ) )
    219223                td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth );
    220224       
    221         sprintf( name, "twitter_%s", acc->user );
     225        sprintf( name, "%s_%s", td->host, acc->user );
    222226        imcb_add_buddy( ic, name, NULL );
    223227        imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL );
    224228       
     
    246250        if( td )
    247251        {
    248252                oauth_info_free( td->oauth_info );
     253                g_free( td->host );
    249254                g_free( td->url_host );
    250255                g_free( td->url_path );
    251256                g_free( td->pass );
     
    261266static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message, int away )
    262267{
    263268        struct twitter_data *td = ic->proto_data;
    264        
    265         if (g_strncasecmp(who, "twitter_", 8) == 0 &&
    266             g_strcasecmp(who + 8, ic->acc->user) == 0)
     269        gchar** s = g_strsplit(who, "_", 2); /* who has a value of "twitter.com_nick" */
     270        if (NULL != s &&
     271            g_strcasecmp(s[0], td->host) == 0 &&
     272            g_strcasecmp(s[1], ic->acc->user) == 0)
    267273        {
    268274                if( set_getbool( &ic->acc->set, "oauth" ) &&
    269275                    td->oauth_info && td->oauth_info->token == NULL )
  • protocols/twitter/twitter.h

    === modified file 'protocols/twitter/twitter.h'
     
    5252        int url_port;
    5353        char *url_host;
    5454        char *url_path;
     55        char *host;
    5556};
    5657
    5758/**
  • protocols/twitter/twitter_lib.c

    === modified file 'protocols/twitter/twitter_lib.c'
     
    446446       
    447447        td->home_timeline_gc = gc = imcb_chat_new( ic, "home/timeline" );
    448448       
    449         name_hint = g_strdup_printf( "Twitter_%s", ic->acc->user );
     449        name_hint = g_strdup_printf( "%s_%s", td->host, ic->acc->user );
    450450        imcb_chat_name_hint( gc, name_hint );
    451451        g_free( name_hint );
    452452}
     
    503503
    504504        if( mode_one )
    505505        {
    506                 g_snprintf( from, sizeof( from ) - 1, "twitter_%s", ic->acc->user );
     506                g_snprintf( from, sizeof( from ) - 1, "%s_%s", td->host, ic->acc->user );
    507507                from[MAX_STRING-1] = '\0';
    508508        }
    509509       
     
    735735        args[0] = "screen_name";
    736736        args[1] = who;
    737737        twitter_http(ic, create ? TWITTER_FRIENDSHIPS_CREATE_URL : TWITTER_FRIENDSHIPS_DESTROY_URL, twitter_http_post, ic, 1, args, 2);
    738 }
    739  No newline at end of file
     738}