Changeset 34ded90


Ignore:
Timestamp:
2011-12-24T18:09:05Z (7 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9a1c14d
Parents:
164352e
Message:

Slight cleanup: Use a constant instead of just "jabber_oauth" everywhere,
and added some safeguards to keep the user from messaging it when we're
not actually doing OAuth setup.

Location:
protocols/jabber
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r164352e r34ded90  
    9090        s = set_add( &acc->set, "tls_verify", "true", set_eval_bool, acc );
    9191        s->flags |= ACC_SET_OFFLINE_ONLY;
    92        
     92
    9393        s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc );
    9494       
     
    337337                return jabber_write( ic, message, strlen( message ) );
    338338       
    339         if( g_strcasecmp( who, "jabber_oauth" ) == 0 )
     339        if( g_strcasecmp( who, JABBER_OAUTH_HANDLE ) == 0 &&
     340            !( jd->flags & OPT_LOGGED_IN ) && jd->fd == -1 )
    340341        {
    341342                if( sasl_oauth2_get_refresh_token( ic, message ) )
  • protocols/jabber/jabber.h

    r164352e r34ded90  
    194194
    195195#define JABBER_XMLCONSOLE_HANDLE "xmlconsole"
     196#define JABBER_OAUTH_HANDLE "jabber_oauth"
    196197
    197198/* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the
  • protocols/jabber/sasl.c

    r164352e r34ded90  
    462462       
    463463        /* Temporary contact, just used to receive the OAuth response. */
    464         imcb_add_buddy( ic, "jabber_oauth", NULL );
     464        imcb_add_buddy( ic, JABBER_OAUTH_HANDLE, NULL );
    465465        url = oauth2_url( jd->oauth2_service );
    466466        msg = g_strdup_printf( "Open this URL in your browser to authenticate: %s", url );
    467         imcb_buddy_msg( ic, "jabber_oauth", msg, 0, 0 );
    468         imcb_buddy_msg( ic, "jabber_oauth", "Respond to this message with the returned "
    469                                             "authorization token.", 0, 0 );
     467        imcb_buddy_msg( ic, JABBER_OAUTH_HANDLE, msg, 0, 0 );
     468        imcb_buddy_msg( ic, JABBER_OAUTH_HANDLE, "Respond to this message with the returned "
     469                                                 "authorization token.", 0, 0 );
    470470       
    471471        g_free( msg );
     
    477477        struct im_connection *ic = data;
    478478        if( g_slist_find( jabber_connections, ic ) )
    479                 imcb_remove_buddy( ic, "jabber_oauth", NULL );
     479                imcb_remove_buddy( ic, JABBER_OAUTH_HANDLE, NULL );
    480480        return FALSE;
    481481}
Note: See TracChangeset for help on using the changeset viewer.