From bdb70fe464b1be056ac9f8ff92611861a9dc2562 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 10 Jun 2000 20:03:43 +0000 Subject: /JOIN - #channel joins to channel in specified server. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@314 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/irc-commands.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/irc') diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 77e678e9..8df2c1bf 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -280,11 +280,26 @@ static void cmd_nctcp(const char *data, IRC_SERVER_REC *server) static void cmd_join(const char *data, IRC_SERVER_REC *server) { - if (*data == '\0' || g_strncasecmp(data, "-invite", 7) == 0) { + char *params, *args, *channels; + + g_return_if_fail(data != NULL); + if (server == NULL || !server->connected || !irc_server_check(server)) + cmd_return_error(CMDERR_NOT_CONNECTED); + + params = cmd_get_params(data, 2 | PARAM_FLAG_OPTARGS | PARAM_FLAG_GETREST, &args, &channels); + + if (stristr(args, "-invite")) { if (server->last_invite != NULL) channels_join(server, server->last_invite, FALSE); - } else - channels_join(server, data, FALSE); + } else { + if (*args != '\0') { + server = (IRC_SERVER_REC *) server_find_tag(args+1); + if (server == NULL) cmd_param_error(CMDERR_NOT_CONNECTED); + } + channels_join(server, channels, FALSE); + } + + g_free(params); } static void cmd_part(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *item) -- cgit v1.2.3