summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-10 20:03:43 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-10 20:03:43 +0000
commitbdb70fe464b1be056ac9f8ff92611861a9dc2562 (patch)
tree1d0c604eac9f9a6dd10d4124c060d629faf2a1c7 /src
parentc1b73039cd9e53275f89bf27d35af520b3d5f4db (diff)
downloadirssi-bdb70fe464b1be056ac9f8ff92611861a9dc2562.zip
/JOIN -<server tag> #channel joins to channel in specified server.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@314 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/irc/core/irc-commands.c21
1 files changed, 18 insertions, 3 deletions
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)