From 9c4112cda7e3b7cfd161d1cd71aa0a16dc06105d Mon Sep 17 00:00:00 2001 From: TingPing Date: Mon, 23 Sep 2013 17:17:35 -0400 Subject: [PATCH] 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 --- src/common/outbound.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/common/outbound.c b/src/common/outbound.c index 42e2eeee..936e0ede 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -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; }