degesch: clean up irc_handle_irc_isupport()
This commit is contained in:
parent
1ba6db50b6
commit
f57cc7923d
38
degesch.c
38
degesch.c
|
@ -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
|
static void
|
||||||
irc_handle_rpl_isupport (struct server *s, const struct irc_message *msg)
|
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;
|
struct str value_unescaped;
|
||||||
str_init (&value_unescaped);
|
str_init (&value_unescaped);
|
||||||
unescape_isupport_value (value, &value_unescaped);
|
unescape_isupport_value (value, &value_unescaped);
|
||||||
|
dispatch_isupport (s, param, value_unescaped.str);
|
||||||
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
|
|
||||||
|
|
||||||
str_free (&value_unescaped);
|
str_free (&value_unescaped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue