Add option ignore_server_capab

This commit is contained in:
Arnaud Cornet 2009-02-08 12:36:49 +01:00
parent b8c740357d
commit 29ff342d93
7 changed files with 27 additions and 5 deletions

View File

@ -290,6 +290,18 @@ kicked.
If set to true, BIP will ignore the nickname sent by the client upon connect.
Further nickname changes will be processed as usual.
.TP
\fBignore_server_capab\fP (default: \fBtrue\fP)
By default bip ignores when a server advertises the CAPAB feature. Servers that
support this can prefix each line with a "+" or a "-" depending if a user is
registered or not. xchat checks if a server has the CAPAB feature and enables
it.
If you have two clients connected to a bip connection, one that supports this
mode and one that does not, you see the plus and the minuses on each line in
the client that does not support CAPAB. To avoid that, when a server advertises
CAPAB bip simply removes it. You can set this option to false to keep using
CAPAB (if you only use clients that support it for instance).
.TP
\fBnetwork\fP
The network name. See the \fBNETWORK SECTION\fP.

View File

@ -197,6 +197,7 @@ user {
#ignore_first_nick = true;
#autojoin_on_kick = false;
#ignore_server_capab = false;
# Autojoined channels:
channel { name = "#bip"; };

View File

@ -557,6 +557,9 @@ static int add_connection(bip_t *bip, struct user *user, list_t *data)
case LEX_IGN_FIRST_NICK:
l->ignore_first_nick = t->ndata;
break;
case LEX_IGNORE_CAPAB:
l->ignore_server_capab = t->ndata;
break;
case LEX_AWAY_NICK:
MOVE_STRING(l->away_nick, t->pdata);
break;

View File

@ -68,7 +68,7 @@ struct tuple *tuple_l_new(int type, void *p)
%}
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB
%union {
int number;
@ -205,6 +205,8 @@ con_command:
LEX_IGN_FIRST_NICK, $3); }
| LEX_AUTOJOIN_ON_KICK LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_AUTOJOIN_ON_KICK, $3); }
| LEX_IGNORE_CAPAB LEX_EQ LEX_BOOL {
$$ = tuple_i_new(LEX_IGNORE_CAPAB, $3); }
| LEX_CHANNEL LEX_LBRA channel LEX_RBRA { $$ = tuple_l_new(
LEX_CHANNEL, $3); }
| LEX_ON_CONNECT_SEND LEX_EQ LEX_STRING { $$ = tuple_s_new(

View File

@ -412,7 +412,8 @@ int irc_dispatch_server(bip_t *bip, struct link_server *server,
} else if (LINK(server)->s_state == IRCS_CONNECTING) {
ret = OK_FORGET;
if (irc_line_elem_equals(line, 0, "005")) {
if (LINK(server)->ignore_server_capab &&
irc_line_elem_equals(line, 0, "005")) {
int i;
for (i = 0; i < irc_line_count(line); i++)
if (irc_line_elem_equals(line, i, "CAPAB"))
@ -2562,6 +2563,7 @@ struct link *irc_link_new()
list_init(&link->chan_infos_order, list_ptr_cmp);
list_init(&link->on_connect_send, list_ptr_cmp);
link->autojoin_on_kick = 1;
link->ignore_server_capab = 1;
return link;
}

View File

@ -129,9 +129,10 @@ struct link {
/** link options */
int follow_nick;
int ignore_first_nick;
int autojoin_on_kick;
int follow_nick:1;
int ignore_first_nick:1;
int autojoin_on_kick:1;
int ignore_server_capab:1;
list_t on_connect_send;
char *no_client_away_msg;
char *away_nick;

View File

@ -107,6 +107,7 @@ list_t *parse_conf(FILE *file, int *err)
"pid_file" { return LEX_PID_FILE; }
"bip_use_notice" { return LEX_BIP_USE_NOTICE; }
"client_side_ssl_pem" { return LEX_CSS_PEM; }
"ignore_server_capab" { return LEX_IGNORE_CAPAB; }
\"[^"]*\" {
size_t len = strlen(yytext) - 2;
yylval.string = bip_malloc(len + 1);