diff options
author | Emmanuel Bouthenot <kolter@openics.org> | 2005-07-31 23:01:14 +0000 |
---|---|---|
committer | Emmanuel Bouthenot <kolter@openics.org> | 2005-07-31 23:01:14 +0000 |
commit | 364667f7885a21d933adfab98e7d266420ffb839 (patch) | |
tree | a0c6b0bf376ef6ae156eca446dc8fdd304085fe9 /src/irc | |
parent | 10d7c6c34aa632ed5403ba87faefbfcf44a78e5a (diff) | |
download | weechat-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.c | 32 |
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; } /* |