From ef0e67039258b7db11838496c61dbdec0be97f60 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 23 Aug 2021 16:34:13 +0100 Subject: Remove some weird guesswork on the 004 numeric. (#2621) Bahamut and ircu both send 005 MODES and ELIST so this is entirely unnecessary. The other IRCd checked for here is for a dead network. While we're editing this code fix HexChat on servers that can only support one mode at a time (these are mostly gateway servers). --- src/common/modes.c | 4 ++-- src/common/proto-irc.c | 16 ---------------- src/common/server.c | 2 ++ 3 files changed, 4 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/common/modes.c b/src/common/modes.c index 17f9ce99..188d2197 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -67,8 +67,8 @@ send_channel_modes (session *sess, char *tbuf, char *word[], int wpos, int usable_modes, orig_len, len, wlen, i, max; server *serv = sess->server; - /* sanity check. IRC RFC says three per line. */ - if (serv->modes_per_line < 3) + /* sanity check. IRC RFC says three per line but some servers may support less. */ + if (serv->modes_per_line < 1) serv->modes_per_line = 3; if (modes_per_line < 1) modes_per_line = serv->modes_per_line; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 501bf5a0..49017506 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -503,22 +503,6 @@ process_numeric (session * sess, int n, goto def; - case 4: /* check the ircd type */ - serv->use_listargs = FALSE; - serv->modes_per_line = 3; /* default to IRC RFC */ - if (strncmp (word[5], "bahamut", 7) == 0) /* DALNet */ - { - serv->use_listargs = TRUE; /* use the /list args */ - } else if (strncmp (word[5], "u2.10.", 6) == 0) /* Undernet */ - { - serv->use_listargs = TRUE; /* use the /list args */ - serv->modes_per_line = 6; /* allow 6 modes per line */ - } else if (strncmp (word[5], "glx2", 4) == 0) - { - serv->use_listargs = TRUE; /* use the /list args */ - } - goto def; - case 5: inbound_005 (serv, word, tags_data); goto def; diff --git a/src/common/server.c b/src/common/server.c index 4f809fa8..0c0306d5 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1770,6 +1770,7 @@ server_set_defaults (server *serv) serv->chanmodes = g_strdup ("beI,k,l"); serv->nick_prefixes = g_strdup ("@%+"); serv->nick_modes = g_strdup ("ohv"); + serv->modes_per_line = 3; /* https://datatracker.ietf.org/doc/html/rfc1459#section-4.2.3.1 */ serv->sasl_mech = MECH_PLAIN; if (!serv->encoding) @@ -1778,6 +1779,7 @@ server_set_defaults (server *serv) serv->nickcount = 1; serv->end_of_motd = FALSE; serv->sent_capend = FALSE; + serv->use_listargs = FALSE; serv->is_away = FALSE; serv->supports_watch = FALSE; serv->supports_monitor = FALSE; -- cgit 1.4.1