aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Plugin/Admin.pm25
-rwxr-xr-xidalius.pl2
2 files changed, 26 insertions, 1 deletions
diff --git a/Plugin/Admin.pm b/Plugin/Admin.pm
index ff8b646..404dbf4 100644
--- a/Plugin/Admin.pm
+++ b/Plugin/Admin.pm
@@ -34,6 +34,9 @@ sub configure {
$cmdref->($self, "ignore", sub { $self->ignore(@_); } );
$cmdref->($self, "don't ignore", sub { $self->do_not_ignore(@_); } );
$cmdref->($self, "who are you ignoring?", sub { $self->dump_ignore(@_); } );
+ $cmdref->($self, "prefix rm", sub { $self->prefix_rm(@_); } );
+ $cmdref->($self, "prefix del", sub { $self->prefix_rm(@_); } );
+ $cmdref->($self, "prefix set", sub { $self->prefix_set(@_); } );
$cmdref->($self, "exit", sub { $self->exit(@_); } );
@@ -41,6 +44,7 @@ sub configure {
$cmdref->($self, "load", sub { $self->load_plugin(@_); } );
$cmdref->($self, "unload", sub { $self->unload_plugin(@_); } );
+
return $self;
}
@@ -221,6 +225,27 @@ sub dump_ignore {
return "I am ignoring: " . join ", ", @{$root_config->{ignore}};
}
+sub prefix_rm {
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
+
+ return "Syntax: prefix rm" unless @arguments == 0;
+
+ my $old = $root_config->{prefix};
+ $root_config->{prefix} = undef;
+
+ return "Prefix removed (used to be $old)" if $old;
+ return "Prefix was already removed";
+}
+
+sub prefix_set {
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
+
+ return "Syntax: prefix set <new prefix>" unless @arguments > 0;
+
+ $root_config->{prefix} = $rest;
+ return "Prefix set to $root_config->{prefix}";
+}
+
sub exit {
my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
diff --git a/idalius.pl b/idalius.pl
index 1565bdb..acd63d2 100755
--- a/idalius.pl
+++ b/idalius.pl
@@ -222,7 +222,7 @@ sub handle_common {
my $stripped_what = strip_color(strip_formatting($what));
my $no_prefix_what = $stripped_what;
if (!should_ignore($nick) && ($config->{_}->{prefix_nick} && $no_prefix_what =~ s/^\Q$config->{_}->{current_nick}\E[:,]\s+//g ||
- $no_prefix_what =~ s/^$config->{_}->{prefix}//)) {
+ ($config->{_}->{prefix} && $no_prefix_what =~ s/^\Q$config->{_}->{prefix}//))) {
$output = run_command($no_prefix_what, $who, $where, $ided);
$irc->yield(privmsg => $where => $output) if $output;
strike_add($nick, $channel) if $output;