diff options
author | TingPing <TingPing@users.noreply.github.com> | 2013-09-23 17:17:35 -0400 |
---|---|---|
committer | TingPing <TingPing@users.noreply.github.com> | 2013-09-23 17:17:35 -0400 |
commit | 9c4112cda7e3b7cfd161d1cd71aa0a16dc06105d (patch) | |
tree | 2d223378202e0d6e6770faad38bc550e41ba6197 | |
parent | 04dbcdffc04496ad2d39c8d3895c69cd1f905f9b (diff) |
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
-rw-r--r-- | src/common/outbound.c | 18 |
1 files 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; } |