From 29ff342d93ba4f5c253702468c3c951a9e61eb91 Mon Sep 17 00:00:00 2001 From: Arnaud Cornet Date: Sun, 8 Feb 2009 12:36:49 +0100 Subject: [PATCH] Add option ignore_server_capab --- bip.conf.5 | 12 ++++++++++++ samples/bip.conf | 1 + src/bip.c | 3 +++ src/conf.y | 4 +++- src/irc.c | 4 +++- src/irc.h | 7 ++++--- src/lex.l | 1 + 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bip.conf.5 b/bip.conf.5 index 06194ad..991eecc 100644 --- a/bip.conf.5 +++ b/bip.conf.5 @@ -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. diff --git a/samples/bip.conf b/samples/bip.conf index 41b21c2..7988650 100644 --- a/samples/bip.conf +++ b/samples/bip.conf @@ -197,6 +197,7 @@ user { #ignore_first_nick = true; #autojoin_on_kick = false; + #ignore_server_capab = false; # Autojoined channels: channel { name = "#bip"; }; diff --git a/src/bip.c b/src/bip.c index ef136b1..0302a1e 100644 --- a/src/bip.c +++ b/src/bip.c @@ -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; diff --git a/src/conf.y b/src/conf.y index ec417c5..1a9a176 100644 --- a/src/conf.y +++ b/src/conf.y @@ -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( diff --git a/src/irc.c b/src/irc.c index 61adeb7..cfc8bd7 100644 --- a/src/irc.c +++ b/src/irc.c @@ -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; } diff --git a/src/irc.h b/src/irc.h index 0edec39..c0c3373 100644 --- a/src/irc.h +++ b/src/irc.h @@ -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; diff --git a/src/lex.l b/src/lex.l index 08a2517..fc3186b 100644 --- a/src/lex.l +++ b/src/lex.l @@ -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);