Changeset f2d8aa2 for protocols


Ignore:
Timestamp:
2013-06-01T00:09:52Z (12 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
aed00f8
Parents:
420ddc00
Message:

Emit a warning when the user wants to do OAuth with a non-Twitter/identi.ca
service, and string handling fix when pretending to do this anyway.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    r420ddc00 rf2d8aa2  
    158158{
    159159        struct twitter_data *td = ic->proto_data;
     160        const char *url = set_getstr(&ic->acc->set, "base_url");
    160161
    161162        imcb_log(ic, "Requesting OAuth request token");
     163       
     164        if (!strstr(url, "twitter.com") && !strstr(url, "identi.ca"))
     165                imcb_log(ic, "Warning: OAuth only works with identi.ca and "
     166                             "Twitter.");
    162167
    163168        td->oauth_info = oauth_request_token(get_oauth_service(ic), twitter_oauth_callback, ic);
     
    178183        td = ic->proto_data;
    179184        if (info->stage == OAUTH_REQUEST_TOKEN) {
    180                 char name[strlen(ic->acc->user) + 9], *msg;
     185                char *name, *msg;
    181186
    182187                if (info->request_token == NULL) {
     
    186191                }
    187192
    188                 sprintf(name, "%s_%s", td->prefix, ic->acc->user);
     193                name = g_strdup_printf("%s_%s", td->prefix, ic->acc->user);
    189194                msg = g_strdup_printf("To finish OAuth authentication, please visit "
    190195                                      "%s and respond with the resulting PIN code.",
    191196                                      info->auth_url);
    192197                imcb_buddy_msg(ic, name, msg, 0, 0);
     198                g_free(name);
    193199                g_free(msg);
    194200        } else if (info->stage == OAUTH_ACCESS_TOKEN) {
Note: See TracChangeset for help on using the changeset viewer.