From f16a784ddffd165e72cff2356bd74c6a8eb71a05 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 3 Jan 2018 20:51:28 +1300 Subject: Add on-the-fly ignore/unignore commands --- idalius.pl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/idalius.pl b/idalius.pl index 85fad47..5c13c24 100755 --- a/idalius.pl +++ b/idalius.pl @@ -174,6 +174,28 @@ sub irc_msg { $irc->yield(privmsg => $nick => "Syntax: nick "); } } + if ($what =~ /^ignore\s/) { + my ($target) = $what =~ /^ignore\s+(\S+)$/; + if ($target) { + push @{$config{ignore}}, $target; + $irc->yield(privmsg => $nick => "Ignoring $target."); + } else { + $irc->yield(privmsg => $nick => "Syntax: ignore "); + } + } + if ($what =~ /^don't ignore\s/) { + my ($target) = $what =~ /^don't ignore\s+(\S+)$/; + if ($target) { + if (grep { $_ eq $target} @{$config{ignore}}) { + @{$config{ignore}} = grep { $_ ne $target } @{$config{ignore}}; + $irc->yield(privmsg => $nick => "No longer ignoring $target."); + } else { + $irc->yield(privmsg => $nick => "I wasn't ignoring $target anyway."); + } + } else { + $irc->yield(privmsg => $nick => "Syntax: don't ignore "); + } + } if ($what =~ /^part\s/) { my $message; if ($what =~ /^part(\s+(\S+))+$/m) { -- cgit v1.1