diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-06-17 21:19:09 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-06-17 21:34:56 +0200 |
commit | 178c1b072ad41f7d67ee14be924c45c7d23f5fc5 (patch) | |
tree | c20dd3d71cc9874edbc63b7f313d908833220562 /degesch.c | |
parent | e2a3b481147625979c886bd697617766d0f0a15d (diff) | |
download | xK-178c1b072ad41f7d67ee14be924c45c7d23f5fc5.tar.gz xK-178c1b072ad41f7d67ee14be924c45c7d23f5fc5.tar.xz xK-178c1b072ad41f7d67ee14be924c45c7d23f5fc5.zip |
degesch: parse MODES from RPL_ISUPPORT
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); |