summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorEmmanuel Bouthenot <kolter@openics.org>2005-07-31 23:01:14 +0000
committerEmmanuel Bouthenot <kolter@openics.org>2005-07-31 23:01:14 +0000
commit364667f7885a21d933adfab98e7d266420ffb839 (patch)
treea0c6b0bf376ef6ae156eca446dc8fdd304085fe9 /src/irc
parent10d7c6c34aa632ed5403ba87faefbfcf44a78e5a (diff)
downloadweechat-364667f7885a21d933adfab98e7d266420ffb839.zip
improve support of keys when joining channel and with server autojoin
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc-send.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index fa1a1bb92..9b0b79f5a 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -678,11 +678,35 @@ irc_cmd_send_ison (t_irc_server *server, char *arguments)
int
irc_cmd_send_join (t_irc_server *server, char *arguments)
{
- if (string_is_channel (arguments))
- server_sendf (server, "JOIN %s\r\n", arguments);
- else
- server_sendf (server, "JOIN #%s\r\n", arguments);
+ char *p, *buffer;
+
+ buffer = (char *) malloc( (strlen(arguments) + 1) * sizeof (*buffer));
+ if (!buffer)
return 0;
+
+ while(arguments != NULL)
+ {
+ p = strchr(arguments, ',');
+ if (!p)
+ {
+ strcpy(buffer, arguments);
+ }
+ else
+ {
+ memcpy(buffer, arguments, p - arguments);
+ buffer[p - arguments] = '\0';
+ arguments = ++p;
+ }
+
+ if (string_is_channel (arguments))
+ server_sendf (server, "JOIN %s\r\n", arguments);
+ else
+ server_sendf (server, "JOIN #%s\r\n", arguments);
+
+ if (!p) break;
+ }
+
+ return 0;
}
/*