aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSummertime <Summertime@users.noreply.github.com>2018-08-30 21:24:24 +0930
committerZoffix Znet <zoffixznet@users.noreply.github.com>2018-08-30 07:54:24 -0400
commitee85c330349621320c97acd53bc9c42d7ceaad45 (patch)
treea788518ff0ab1acd683f091413f53436a7a3ded2
parent2ccaaa2534449b54a48b7eef27a3f5f26d75d66d (diff)
send-cmd should prepend last arg with : only if /\s/ (#58)
* send-cmd should prepend last arg with : only if /\s/ ideally according to the IRC specifications, `:` is optional if the last argument to a command has no whitespace This is to help alleviate some difficulties in zoffixznet/perl6-banbot#2 I am not completely sure all servers agree with the IRC specification on `:` however! Hopefully this is safe enough change to make * send-cmd should prepend : if last arg has ^':' * changing last-arg of send-cmd handling to support RFC situations where a colon `:` needs to proceed the last argument: * the last argument is the empty string `''` * the last argument has a space `' '` in it * the last argument begins with a colon `:` Otherwise, other than PRIVMSG | NOTICE, some servers expect there to not be a colon to denote the last argument in some commands
-rw-r--r--lib/IRC/Client.pm62
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index c94fbff..46832af 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -357,7 +357,7 @@ method send-cmd ($cmd, *@args is copy, :$prefix = '', :$server) {
}
}
else {
- @args[*-1] = ':' ~ @args[*-1] if @args;
+ @args[*-1] = ':' ~ @args[*-1] if @args && @args[*-1] ~~ / ^':' | ' ' | ^$ /;
self!ssay: :$server, join ' ', $cmd, @args;
}
}