diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/jabber/jabber.c | 5 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 1 | ||||
-rw-r--r-- | protocols/jabber/sasl.c | 10 |
3 files changed, 9 insertions, 7 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 92256a71..41ce509b 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -89,7 +89,7 @@ static void jabber_init( account_t *acc ) s = set_add( &acc->set, "tls_verify", "true", set_eval_bool, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; - + s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); @@ -336,7 +336,8 @@ static int jabber_buddy_msg( struct im_connection *ic, char *who, char *message, if( g_strcasecmp( who, JABBER_XMLCONSOLE_HANDLE ) == 0 ) return jabber_write( ic, message, strlen( message ) ); - if( g_strcasecmp( who, "jabber_oauth" ) == 0 ) + if( g_strcasecmp( who, JABBER_OAUTH_HANDLE ) == 0 && + !( jd->flags & OPT_LOGGED_IN ) && jd->fd == -1 ) { if( sasl_oauth2_get_refresh_token( ic, message ) ) { diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 76546bde..046741a3 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -193,6 +193,7 @@ struct jabber_transfer }; #define JABBER_XMLCONSOLE_HANDLE "xmlconsole" +#define JABBER_OAUTH_HANDLE "jabber_oauth" /* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the first one should be used, but when storing a packet in the cache, a diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index 2f45eb20..b4eb4eb8 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -461,12 +461,12 @@ void sasl_oauth2_init( struct im_connection *ic ) imcb_log( ic, "Starting OAuth authentication" ); /* Temporary contact, just used to receive the OAuth response. */ - imcb_add_buddy( ic, "jabber_oauth", NULL ); + imcb_add_buddy( ic, JABBER_OAUTH_HANDLE, NULL ); url = oauth2_url( jd->oauth2_service ); msg = g_strdup_printf( "Open this URL in your browser to authenticate: %s", url ); - imcb_buddy_msg( ic, "jabber_oauth", msg, 0, 0 ); - imcb_buddy_msg( ic, "jabber_oauth", "Respond to this message with the returned " - "authorization token.", 0, 0 ); + imcb_buddy_msg( ic, JABBER_OAUTH_HANDLE, msg, 0, 0 ); + imcb_buddy_msg( ic, JABBER_OAUTH_HANDLE, "Respond to this message with the returned " + "authorization token.", 0, 0 ); g_free( msg ); g_free( url ); @@ -476,7 +476,7 @@ static gboolean sasl_oauth2_remove_contact( gpointer data, gint fd, b_input_cond { struct im_connection *ic = data; if( g_slist_find( jabber_connections, ic ) ) - imcb_remove_buddy( ic, "jabber_oauth", NULL ); + imcb_remove_buddy( ic, JABBER_OAUTH_HANDLE, NULL ); return FALSE; } |