aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-09 09:26:57 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-09 09:26:57 +0200
commit2c24f714b6627fd38e97f296eb37d2ae5443c9b8 (patch)
treeb21a2297674853018d49232e2f5df4e1e1c36880
parent5e26dd726cdfcaa01ad7c3a95c17c83fbcc73031 (diff)
downloadxK-2c24f714b6627fd38e97f296eb37d2ae5443c9b8.tar.gz
xK-2c24f714b6627fd38e97f296eb37d2ae5443c9b8.tar.xz
xK-2c24f714b6627fd38e97f296eb37d2ae5443c9b8.zip
kike: fix INVITE
Didn't allow ban circumvention.
-rw-r--r--kike.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/kike.c b/kike.c
index d5136d7..45dd02b 100644
--- a/kike.c
+++ b/kike.c
@@ -2322,14 +2322,10 @@ irc_handle_invite (const struct irc_message *msg, struct client *c)
if (channel_get_user (chan, client))
RETURN_WITH_REPLY (c, IRC_ERR_USERONCHANNEL, target, channel_name);
- if ((chan->modes & IRC_CHAN_MODE_INVITE_ONLY))
- {
- if (!(inviting_user->modes & IRC_CHAN_MODE_OPERATOR))
- RETURN_WITH_REPLY (c, IRC_ERR_CHANOPRIVSNEEDED, channel_name);
-
- // Only storing the invite if it makes sense
+ if ((inviting_user->modes & IRC_CHAN_MODE_OPERATOR))
str_map_set (&client->invites, channel_name, (void *) 1);
- }
+ else if ((chan->modes & IRC_CHAN_MODE_INVITE_ONLY))
+ RETURN_WITH_REPLY (c, IRC_ERR_CHANOPRIVSNEEDED, channel_name);
}
client_send (client, ":%s!%s@%s INVITE %s %s",
@@ -2355,10 +2351,10 @@ irc_try_join (struct client *c, const char *channel_name, const char *key)
else if (channel_get_user (chan, c))
return;
- bool invited = str_map_find (&c->invites, channel_name);
+ bool invited_by_chanop = str_map_find (&c->invites, channel_name);
if ((chan->modes & IRC_CHAN_MODE_INVITE_ONLY)
&& !client_in_mask_list (c, &chan->invite_list)
- && !invited)
+ && !invited_by_chanop)
RETURN_WITH_REPLY (c, IRC_ERR_INVITEONLYCHAN, channel_name);
if (chan->key && (!key || strcmp (key, chan->key)))
RETURN_WITH_REPLY (c, IRC_ERR_BADCHANNELKEY, channel_name);
@@ -2367,7 +2363,7 @@ irc_try_join (struct client *c, const char *channel_name, const char *key)
RETURN_WITH_REPLY (c, IRC_ERR_CHANNELISFULL, channel_name);
if (client_in_mask_list (c, &chan->ban_list)
&& !client_in_mask_list (c, &chan->exception_list)
- && !invited)
+ && !invited_by_chanop)
RETURN_WITH_REPLY (c, IRC_ERR_BANNEDFROMCHAN, channel_name);
// Destroy any invitation as there's no other way to get rid of it