diff options
-rw-r--r-- | protocols/jabber/io.c | 4 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 3 | ||||
-rw-r--r-- | root_commands.c | 2 | ||||
-rw-r--r-- | set.c | 8 | ||||
-rw-r--r-- | set.h | 4 |
5 files changed, 18 insertions, 3 deletions
diff --git a/protocols/jabber/io.c b/protocols/jabber/io.c index ef7d5c13..a28eea90 100644 --- a/protocols/jabber/io.c +++ b/protocols/jabber/io.c @@ -211,7 +211,7 @@ static gboolean jabber_read_callback( gpointer data, gint fd, b_input_condition /* If there's no version attribute, assume this is an old server that can't do SASL authentication. */ - if( !sasl_supported( ic ) ) + if( !set_getbool( &ic->acc->set, "sasl") || !sasl_supported( ic ) ) { /* If there's no version= tag, we suppose this server does NOT implement: XMPP 1.0, @@ -374,7 +374,7 @@ static xt_status jabber_pkt_features( struct xt_node *node, gpointer data ) support it after all, we should try to do authentication the other way. jabber.com doesn't seem to do SASL while it pretends to be XMPP 1.0 compliant! */ - else if( !( jd->flags & JFLAG_AUTHENTICATED ) && sasl_supported( ic ) ) + else if( !( jd->flags & JFLAG_AUTHENTICATED ) && set_getbool( &ic->acc->set, "sasl") && sasl_supported( ic ) ) { if( !jabber_init_iq_auth( ic ) ) return XT_ABORT; diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 802158c1..7d9547ab 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -81,6 +81,9 @@ static void jabber_init( account_t *acc ) s = set_add( &acc->set, "tls", "try", set_eval_tls, acc ); s->flags |= ACC_SET_OFFLINE_ONLY; + s = set_add( &acc->set, "sasl", "true", set_eval_bool, acc ); + s->flags |= ACC_SET_OFFLINE_ONLY | SET_HIDDEN_DEFAULT; + s = set_add( &acc->set, "user_agent", "BitlBee", NULL, acc ); s = set_add( &acc->set, "xmlconsole", "false", set_eval_bool, acc ); diff --git a/root_commands.c b/root_commands.c index ce412b80..6924fd13 100644 --- a/root_commands.c +++ b/root_commands.c @@ -361,7 +361,7 @@ static int cmd_set_real( irc_t *irc, char **cmd, set_t **head, cmd_set_checkflag set_t *s = *head; while( s ) { - if( !( s->flags & SET_HIDDEN ) ) + if( set_isvisible( s ) ) cmd_showset( irc, &s, s->key ); s = s->next; } @@ -111,6 +111,14 @@ int set_getbool( set_t **head, const char *key ) return bool2int( s ); } +int set_isvisible( set_t *set ) +{ + /* the default value is not stored in value, only in def */ + return !( ( set->flags & SET_HIDDEN ) || + ( ( set->flags & SET_HIDDEN_DEFAULT ) && + ( set->value == NULL ) ) ); +} + int set_setstr( set_t **head, const char *key, char *value ) { set_t *s = set_find( head, key ); @@ -48,6 +48,7 @@ typedef enum SET_NULL_OK = 0x0100, SET_HIDDEN = 0x0200, SET_PASSWORD = 0x0400, + SET_HIDDEN_DEFAULT = 0x0800, } set_flags_t; typedef struct set @@ -97,6 +98,9 @@ int set_setint( set_t **head, const char *key, int value ); void set_del( set_t **head, const char *key ); int set_reset( set_t **head, const char *key ); +/* returns true if a setting shall be shown to the user */ +int set_isvisible( set_t *set ); + /* Two very useful generic evaluators. */ char *set_eval_int( set_t *set, char *value ); char *set_eval_bool( set_t *set, char *value ); |