Fix /cycle command

- Uses the correct channelkey when called from another tab
- Allows it to be used from any tab in the same server
- Verifies it's a channel you are in
This commit is contained in:
TingPing 2013-09-23 17:17:35 -04:00
parent 04dbcdffc0
commit 9c4112cda7

View File

@ -742,15 +742,25 @@ cmd_country (struct session *sess, char *tbuf, char *word[], char *word_eol[])
static int
cmd_cycle (struct session *sess, char *tbuf, char *word[], char *word_eol[])
{
char *key = sess->channelkey;
char *key = NULL;
char *chan = word[2];
session *chan_sess;
if (!*chan)
chan = sess->channel;
if (*chan && sess->type == SESS_CHANNEL)
if (chan)
{
sess->server->p_cycle (sess->server, chan, key);
return TRUE;
chan_sess = find_channel (sess->server, chan);
if (chan_sess && chan_sess->type == SESS_CHANNEL)
{
key = chan_sess->channelkey;
sess->server->p_cycle (sess->server, chan, key);
return TRUE;
}
}
return FALSE;
}