aboutsummaryrefslogtreecommitdiff
path: root/idalius.pl
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-13 18:42:44 +1200
committerDavid Phillips <david@sighup.nz>2018-09-13 18:45:27 +1200
commite857c1e04913b4a21871956b3d27e07a730da919 (patch)
tree00386f9649f625b52d7acc67e92ddda75d7da625 /idalius.pl
parentaa09f5f1ccf65007a73da3da5b5b62a78bc42f74 (diff)
downloadidalius-e857c1e04913b4a21871956b3d27e07a730da919.tar.xz
Allow modules to handle for ignored nicks
Diffstat (limited to 'idalius.pl')
-rwxr-xr-xidalius.pl17
1 files changed, 12 insertions, 5 deletions
diff --git a/idalius.pl b/idalius.pl
index f773a4f..0bf2e5f 100755
--- a/idalius.pl
+++ b/idalius.pl
@@ -201,14 +201,11 @@ sub handle_common {
my $channel = $where->[0];
my $output;
- # Return early if should ignore
- return if should_ignore($nick);
-
$what =~ s/^\s+|\s+$//g;
my $stripped_what = strip_color(strip_formatting($what));
my $no_prefix_what = $stripped_what;
- if ($config{prefix_nick} && $no_prefix_what =~ s/^\Q$current_nick\E[:,]\s+//g ||
+ if (!should_ignore($nick) && $config{prefix_nick} && $no_prefix_what =~ s/^\Q$current_nick\E[:,]\s+//g ||
$no_prefix_what =~ s/^$config{prefix}//) {
$output = run_command($no_prefix_what, $who, $where);
$irc->yield(privmsg => $where => $output) if $output;
@@ -217,8 +214,18 @@ sub handle_common {
# handler names are defined as being prefixed with on_
$message_type = "on_$message_type";
+ my $ignore_suffix = "_yes_really_even_from_ignored_nicks";
for my $module (@{$config{plugins}}) {
- if (module_is_enabled($module) && $module->can($message_type)) {
+ if (module_is_enabled($module)) {
+ if (!should_ignore($nick) and $module->can($message_type)) {
+ # Leave message type unchanged
+ } elsif ($module->can($message_type.$ignore_suffix)) {
+ # Handler for non-ignored and ignored exists
+ $message_type = $message_type.$ignore_suffix;
+ } else {
+ # No handler
+ next;
+ }
$output = $module->$message_type(\&log_info, $irc->nick_name, $who, $where, $what, $stripped_what, $irc);
$irc->yield(privmsg => $where => $output) if $output;
strike_add($nick, $channel) if $output;