summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/degesch.c b/degesch.c
index 1c6e530..d1c5058 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1055,6 +1055,11 @@ struct server
char *irc_idchan_prefixes; ///< Prefixes for "safe channels"
char *irc_statusmsg; ///< Prefixes for channel targets
+ char *irc_chanmodes_list; ///< Channel modes for lists
+ char *irc_chanmodes_param_always; ///< Channel modes with mandatory param
+ char *irc_chanmodes_param_when_set; ///< Channel modes with param when set
+ char *irc_chanmodes_param_never; ///< Channel modes without param
+
char *irc_chanuser_prefixes; ///< Channel user prefixes
char *irc_chanuser_modes; ///< Channel user modes
@@ -1078,7 +1083,7 @@ server_init (struct server *self, struct poller *poller)
str_init (&self->read_buffer);
self->state = IRC_DISCONNECTED;
- // Defaults as per the RPL_ISUPPORT draft
+ // Defaults as per the RPL_ISUPPORT drafts, or RFC 1459
self->irc_tolower = irc_tolower;
self->irc_strxfrm = irc_strxfrm;
@@ -1086,6 +1091,11 @@ server_init (struct server *self, struct poller *poller)
self->irc_idchan_prefixes = xstrdup ("");
self->irc_statusmsg = xstrdup ("");
+ self->irc_chanmodes_list = xstrdup ("b");
+ self->irc_chanmodes_param_always = xstrdup ("k");
+ self->irc_chanmodes_param_when_set = xstrdup ("l");
+ self->irc_chanmodes_param_never = xstrdup ("imnpst");
+
self->irc_chanuser_prefixes = xstrdup ("@+");
self->irc_chanuser_modes = xstrdup ("ov");
@@ -1140,6 +1150,11 @@ server_free (struct server *self)
free (self->irc_idchan_prefixes);
free (self->irc_statusmsg);
+ free (self->irc_chanmodes_list);
+ free (self->irc_chanmodes_param_always);
+ free (self->irc_chanmodes_param_when_set);
+ free (self->irc_chanmodes_param_never);
+
free (self->irc_chanuser_prefixes);
free (self->irc_chanuser_modes);
@@ -4644,6 +4659,26 @@ irc_handle_isupport_statusmsg (struct server *s, char *value)
}
static void
+irc_handle_isupport_chanmodes (struct server *s, char *value)
+{
+ struct str_vector v;
+ str_vector_init (&v);
+ split_str_ignore_empty (value, ',', &v);
+ if (v.len >= 4)
+ {
+ free (s->irc_chanmodes_list);
+ s->irc_chanmodes_list = xstrdup (v.vector[0]);
+ free (s->irc_chanmodes_param_always);
+ s->irc_chanmodes_param_always = xstrdup (v.vector[1]);
+ free (s->irc_chanmodes_param_when_set);
+ s->irc_chanmodes_param_when_set = xstrdup (v.vector[2]);
+ free (s->irc_chanmodes_param_never);
+ s->irc_chanmodes_param_never = xstrdup (v.vector[3]);
+ }
+ str_vector_free (&v);
+}
+
+static void
unescape_isupport_value (const char *value, struct str *output)
{
const char *alphabet = "0123456789abcdef", *a, *b;
@@ -4689,8 +4724,10 @@ irc_handle_rpl_isupport (struct server *s, const struct irc_message *msg)
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);
- // TODO: also parse MODES, TARGMAX, CHANMODES and make use of them
+ // TODO: also parse MODES, TARGMAX and make use of them
// to split client commands as necessary
str_free (&value_unescaped);