summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/degesch.c b/degesch.c
index fdfab28..556c149 100644
--- a/degesch.c
+++ b/degesch.c
@@ -5764,6 +5764,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)
{
if (msg->params.len < 2)
@@ -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);
}
}