From ee85c330349621320c97acd53bc9c42d7ceaad45 Mon Sep 17 00:00:00 2001 From: Summertime Date: Thu, 30 Aug 2018 21:24:24 +0930 Subject: 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 --- lib/IRC/Client.pm6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } } -- cgit v1.1