summaryrefslogtreecommitdiffstats
path: root/config-default
diff options
context:
space:
mode:
authorLibravatarJanik Kleinhoff <ilbelkyr@shalture.org>2015-11-06 21:56:42 +0000
committerLibravatarJanik Kleinhoff <ilbelkyr@shalture.org>2015-11-06 21:56:42 +0000
commitb42684900a0f2c00fdcf88d31a142ee5b5ddd361 (patch)
treefd534f33a0152aa06320716ae023d568a8575c83 /config-default
parentd65a352e918425b79f5bf0394072e303c6d1817b (diff)
;hilight: detect bad argument order
Diffstat (limited to 'config-default')
-rw-r--r--config-default/commands.xml12
1 files changed, 11 insertions, 1 deletions
diff --git a/config-default/commands.xml b/config-default/commands.xml
index 6e12076..e43f9a4 100644
--- a/config-default/commands.xml
+++ b/config-default/commands.xml
@@ -431,7 +431,8 @@
<command cmd="^;hilight (\S+) (\S+) ?(\S*)$" flag="h">
<![CDATA[
my $chan = $1;
- my @nicks = split(/,/,$2);
+ my $nick_str = $2;
+ my @nicks = split(/,/, $nick_str);
my $level= $3;
if ($level eq '') { $level = 'info'; }
$level = lc $level;
@@ -444,6 +445,15 @@
$conn->privmsg($event->replyto, "Error: $chan is linked to $link - use $link instead.");
return;
}
+ my $chan_regex = qr/^#|^default$|^master$/;
+ if ( $chan !~ $chan_regex ) {
+ my $msg = "Error: '$chan' doesn't look like a channel to me.";
+ if ( $nick_str =~ $chan_regex ) {
+ $msg .= ' (Maybe you just specified nick and channel in the wrong order?)';
+ }
+ $conn->privmsg($event->replyto, $msg);
+ return;
+ }
unless (defined($::channels->{channel}->{$chan}->{hilights})) {
$::channels->{channel}->{$chan}->{hilights} = {};
}