diff options
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1073,6 +1073,8 @@ struct server char *irc_chanuser_prefixes; ///< Channel user prefixes char *irc_chanuser_modes; ///< Channel user modes + unsigned irc_max_modes; ///< Max parametrized modes per command + // Events: struct poller_timer ping_tmr; ///< We should send a ping @@ -1111,6 +1113,8 @@ server_init (struct server *self, struct poller *poller) self->irc_chanuser_prefixes = xstrdup ("@+"); self->irc_chanuser_modes = xstrdup ("ov"); + self->irc_max_modes = 3; + str_map_init (&self->irc_users); self->irc_users.key_xfrm = irc_strxfrm; str_map_init (&self->irc_channels); @@ -5128,6 +5132,16 @@ irc_handle_isupport_chanmodes (struct server *s, char *value) } static void +irc_handle_isupport_modes (struct server *s, char *value) +{ + unsigned long modes; + if (!*value) + s->irc_max_modes = UINT_MAX; + else if (xstrtoul (&modes, value, 10) && modes && modes <= UINT_MAX) + s->irc_max_modes = modes; +} + +static void unescape_isupport_value (const char *value, struct str *output) { const char *alphabet = "0123456789abcdef", *a, *b; @@ -5175,8 +5189,10 @@ irc_handle_rpl_isupport (struct server *s, const struct irc_message *msg) irc_handle_isupport_statusmsg (s, value_unescaped.str); else if (!strcmp (param, "CHANMODES")) irc_handle_isupport_chanmodes (s, value_unescaped.str); + else if (!strcmp (param, "MODES")) + irc_handle_isupport_modes (s, value_unescaped.str); - // TODO: also parse MODES, TARGMAX and make use of them + // TODO: also parse TARGMAX and make use of it // to split client commands as necessary str_free (&value_unescaped); |