degesch: clean up irc_handle_irc_isupport()

This commit is contained in:
Přemysl Eric Janouch 2015-07-09 01:28:52 +02:00
parent 1ba6db50b6
commit f57cc7923d
1 changed files with 19 additions and 19 deletions

View File

@ -5763,6 +5763,24 @@ unescape_isupport_value (const char *value, struct str *output)
}
}
static void
dispatch_isupport (struct server *s, const char *name, char *value)
{
#define MATCH(from, to) if (!strcmp (name, (from))) { (to) (s, value); return; }
// TODO: also make use of TARGMAX to split client commands as necessary
MATCH ("PREFIX", irc_handle_isupport_prefix);
MATCH ("CASEMAPPING", irc_handle_isupport_casemapping);
MATCH ("CHANTYPES", irc_handle_isupport_chantypes);
MATCH ("IDCHAN", irc_handle_isupport_idchan);
MATCH ("STATUSMSG", irc_handle_isupport_statusmsg);
MATCH ("CHANMODES", irc_handle_isupport_chanmodes);
MATCH ("MODES", irc_handle_isupport_modes);
#undef MATCH
}
static void
irc_handle_rpl_isupport (struct server *s, const struct irc_message *msg)
{
@ -5779,25 +5797,7 @@ irc_handle_rpl_isupport (struct server *s, const struct irc_message *msg)
struct str value_unescaped;
str_init (&value_unescaped);
unescape_isupport_value (value, &value_unescaped);
if (!strcmp (param, "PREFIX"))
irc_handle_isupport_prefix (s, value_unescaped.str);
else if (!strcmp (param, "CASEMAPPING"))
irc_handle_isupport_casemapping (s, value_unescaped.str);
else if (!strcmp (param, "CHANTYPES"))
irc_handle_isupport_chantypes (s, value_unescaped.str);
else if (!strcmp (param, "IDCHAN"))
irc_handle_isupport_idchan (s, value_unescaped.str);
else if (!strcmp (param, "STATUSMSG"))
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 TARGMAX and make use of it
// to split client commands as necessary
dispatch_isupport (s, param, value_unescaped.str);
str_free (&value_unescaped);
}
}