From 455e4146fb2d22abf1b8f007fccf211caf45447e Mon Sep 17 00:00:00 2001 From: pdbogen Date: Mon, 12 Dec 2011 16:06:40 +0000 Subject: [PATCH] Allow random to accept comma-delimited lists, but retain old behavior in case of spaces-only. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@121 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/commands.yaml b/commands.yaml index be831e0..0b9bf10 100644 --- a/commands.yaml +++ b/commands.yaml @@ -732,7 +732,12 @@ ADVERTISE: |- RANDOM: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; - my @opts = split( / /, $what ); + my @opts; + if( $what =~ m/,/ ) { + @opts = split( /\s*,\s*/, $what ); + } else { + @opts = split( / /, $what ); + } if( $#opts >= 0 ) { $kernel->post( $src, $replypath, $opts[ int( rand( $#opts+1 ) ) ], $dest ); } -- 2.11.0