aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-05 23:18:52 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-05 23:24:26 +0200
commit05c6bf63bb08799ebbff76b73c50abb399e3a1e0 (patch)
tree9a0769a57dc94eb13b192cc29b15e122b57bc646
parent1a7ac7b3ca12f1e41be05b376a6cae2b2e56a236 (diff)
downloadxK-05c6bf63bb08799ebbff76b73c50abb399e3a1e0.tar.gz
xK-05c6bf63bb08799ebbff76b73c50abb399e3a1e0.tar.xz
xK-05c6bf63bb08799ebbff76b73c50abb399e3a1e0.zip
kike: actually use irc_is_valid_key()
-rw-r--r--kike.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kike.c b/kike.c
index c5c36da..2c911dc 100644
--- a/kike.c
+++ b/kike.c
@@ -1856,16 +1856,16 @@ mode_processor_do_key (struct mode_processor *self)
free (self->channel->key);
self->channel->key = NULL;
}
+ else if (!irc_is_valid_key (target))
+ // TODO: we should notify the user somehow
+ return;
+ else if (self->channel->key)
+ irc_send_reply (self->c, IRC_ERR_KEYSET, self->channel->name);
else
{
- if (self->channel->key)
- irc_send_reply (self->c, IRC_ERR_KEYSET, self->channel->name);
- else
- {
- self->channel->key = xstrdup (target);
- str_append_c (&self->added, self->mode_char);
- str_vector_add (&self->added_params, self->channel->key);
- }
+ self->channel->key = xstrdup (target);
+ str_append_c (&self->added, self->mode_char);
+ str_vector_add (&self->added_params, self->channel->key);
}
}