summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Coekaerts <coekie@irssi.org>2004-09-13 16:54:28 +0000
committercoekie <coekie@dbcabf3a-b0e7-0310-adc4-f8d773084564>2004-09-13 16:54:28 +0000
commit2f81d1f160ee6ffd18aa3c7731633057eb07d0e8 (patch)
tree116a1facd51073e300c7b4a466e1c9eb89f75e6f
parentf84f03706c2f26536ae51227d7d5bb978018853c (diff)
downloadirssi-2f81d1f160ee6ffd18aa3c7731633057eb07d0e8.zip
Make /JOIN -tag #channel and /JOIN #channel<space> switch to that channel (Bugs 13 and 93)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3292 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/core/fe-channels.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/fe-common/core/fe-channels.c b/src/fe-common/core/fe-channels.c
index 397706ac..78ffa2b1 100644
--- a/src/fe-common/core/fe-channels.c
+++ b/src/fe-common/core/fe-channels.c
@@ -132,20 +132,28 @@ static void cmd_join(const char *data, SERVER_REC *server)
{
WINDOW_REC *window;
CHANNEL_REC *channel;
+ GHashTable *optlist;
+ char *channelname;
+ void *free_arg;
- if (strchr(data, ' ') != NULL || strchr(data, ',') != NULL)
- return;
-
- channel = channel_find(server, data);
- if (channel == NULL)
+ if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS |
+ PARAM_FLAG_UNKNOWN_OPTIONS,
+ "join", &optlist, &channelname))
return;
- /* already joined to channel, set it active */
- window = window_item_window(channel);
- if (window != active_win)
- window_set_active(window);
-
- window_item_set_active(active_win, (WI_ITEM_REC *) channel);
+ /* -<server tag> */
+ server = cmd_options_get_server("join", optlist, server);
+
+ channel = channel_find(server, channelname);
+ if (channel != NULL) {
+ /* already joined to channel, set it active */
+ window = window_item_window(channel);
+ if (window != active_win)
+ window_set_active(window);
+
+ window_item_set_active(active_win, (WI_ITEM_REC *) channel);
+ }
+ cmd_params_free(free_arg);
}
static void cmd_wjoin_post(const char *data)