aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-17 17:50:53 +1200
committerDavid Phillips <david@sighup.nz>2018-09-17 17:51:02 +1200
commit0168a87290dccb8548b4943aca6a43b1a2567a96 (patch)
tree59f657c45c3e0aeca7586c07808a67430e499b66 /Plugin
parentacc3dd54a4c861e2cb02f0c3cb29ea40ce16f706 (diff)
downloadidalius-0168a87290dccb8548b4943aca6a43b1a2567a96.tar.xz
Add must_id functionality back
Fixes regression in acc3dd54a4c861e2cb02f0c3cb29ea40ce16f706
Diffstat (limited to 'Plugin')
-rw-r--r--Plugin/Admin.pm58
-rw-r--r--Plugin/DevNull.pm4
-rw-r--r--Plugin/Echo.pm2
-rw-r--r--Plugin/Introspect.pm2
-rw-r--r--Plugin/Map.pm4
-rw-r--r--Plugin/Ping.pm2
-rw-r--r--Plugin/Random.pm4
-rw-r--r--Plugin/Source.pm2
-rw-r--r--Plugin/Thanks.pm2
-rw-r--r--Plugin/Timezone.pm2
10 files changed, 43 insertions, 39 deletions
diff --git a/Plugin/Admin.pm b/Plugin/Admin.pm
index 3e600fb..622f772 100644
--- a/Plugin/Admin.pm
+++ b/Plugin/Admin.pm
@@ -31,28 +31,31 @@ sub configure {
}
sub is_admin {
- my $who = shift;
+ my ($logger, $who, $ided) = @_;
+ if ($config->{must_id} and not $ided) {
+ $logger->("$who hasn't identified, but tried to use a command");
+ return 0;
+ }
my $is_admin = grep {$_ eq $who} @{$config->{admins}};
if (!$is_admin) {
- # FIXME log this rather than print
- print "$who isn't an admin, but tried to use a command\n";
+ $logger->("$who isn't an admin, but tried to use a command");
}
return $is_admin;
}
sub nick {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: nick <new nick>" unless @arguments == 1;
$irc->yield(nick => $arguments[0]);
}
sub say {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: say <channel> <msg>" unless @arguments >= 2;
# Strip nick/channel from message
@@ -62,9 +65,9 @@ sub say {
}
sub do_action {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: action <channel> <action text>" unless @arguments >= 2;
# Strip nick/channel from message
@@ -74,18 +77,18 @@ sub do_action {
}
sub join_channel {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: join <channel1> [channel2 ...]" unless @arguments >= 1;
$irc->yield(join => $_) for @arguments;
}
sub part {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: part <channel1> [channel2 ...] [partmsg]" unless @arguments >= 1;
my $nick = (split /!/, $who)[0];
@@ -96,9 +99,9 @@ sub part {
}
sub mode {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: mode <everything>" unless @arguments > 0;
# FIXME should use $where if it's a channel (?)
@@ -106,9 +109,9 @@ sub mode {
}
sub kick {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: kick <channel> <nick> [reason]" unless @arguments >= 2;
# FIXME should use $where if it's a channel (?)
@@ -121,9 +124,9 @@ sub kick {
}
sub topic {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: topic <new topic>" unless @arguments >= 2;
# Strip nick/channel from message
@@ -134,18 +137,18 @@ sub topic {
}
sub reconnect {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
my $reason = $rest;
$irc->yield(quit => $reason);
}
sub ignore {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: ignore <nick>" unless @arguments == 1;
push @{$config->{ignore}}, $arguments[0];
@@ -154,9 +157,9 @@ sub ignore {
}
sub do_not_ignore {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- return unless is_admin($who);
+ return unless is_admin($logger, $who, $ided);
return "Syntax: don't ignore <nick>" unless @arguments == 1;
my $target = $arguments[0];
@@ -170,7 +173,7 @@ sub do_not_ignore {
}
sub dump_ignore {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
return "Syntax: who are you ignoring?" unless @arguments == 0;
@@ -179,8 +182,9 @@ sub dump_ignore {
}
sub exit {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
+ return unless is_admin($logger, $who, $ided);
return "Syntax: exit" unless @arguments == 0;
exit;
diff --git a/Plugin/DevNull.pm b/Plugin/DevNull.pm
index 0565aec..b1087f1 100644
--- a/Plugin/DevNull.pm
+++ b/Plugin/DevNull.pm
@@ -17,9 +17,9 @@ sub configure {
}
sub hush {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
- $run_command->($rest, $who, $where);
+ $run_command->($rest, $who, $where, $ided);
return;
}
diff --git a/Plugin/Echo.pm b/Plugin/Echo.pm
index 2cd59fc..ba66c48 100644
--- a/Plugin/Echo.pm
+++ b/Plugin/Echo.pm
@@ -13,7 +13,7 @@ sub configure {
}
sub echo {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
return $rest;
}
diff --git a/Plugin/Introspect.pm b/Plugin/Introspect.pm
index 4c53984..05f338a 100644
--- a/Plugin/Introspect.pm
+++ b/Plugin/Introspect.pm
@@ -18,7 +18,7 @@ sub configure {
}
sub dump_plugins {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
return "Plugins: " . join ", ", $root_config->{plugins};
}
1;
diff --git a/Plugin/Map.pm b/Plugin/Map.pm
index 1e24f9c..42856eb 100644
--- a/Plugin/Map.pm
+++ b/Plugin/Map.pm
@@ -19,7 +19,7 @@ sub configure {
sub map {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
my ($command, $subjects_raw) = ($rest =~ /^(.+)\s+(\[.*\])$/);
return "Syntax: map command [item1, item2, ...]" unless $command and $subjects_raw;
@@ -27,7 +27,7 @@ sub map {
my ($e, @subjects) = ListParser::parse_list($subjects_raw);
return $e if $e;
- my @results = map { $run_command->("$command $_", $who, $where) } @subjects;
+ my @results = map { $run_command->("$command $_", $who, $where, $ided) } @subjects;
return "[" . (join ", ", @results). "]";
}
1;
diff --git a/Plugin/Ping.pm b/Plugin/Ping.pm
index 43e42b6..efb55ce 100644
--- a/Plugin/Ping.pm
+++ b/Plugin/Ping.pm
@@ -15,7 +15,7 @@ sub configure {
}
sub ping {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
my $nick = (split /!/, $who)[0];
return "$nick: pong";
}
diff --git a/Plugin/Random.pm b/Plugin/Random.pm
index 27332f8..cea65fb 100644
--- a/Plugin/Random.pm
+++ b/Plugin/Random.pm
@@ -16,13 +16,13 @@ sub configure {
}
sub shuffle {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
return join " ", List::Util::shuffle(@arguments);
}
sub choose {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
return (List::Util::shuffle(@arguments))[0];
}
1;
diff --git a/Plugin/Source.pm b/Plugin/Source.pm
index e3774e9..6b93979 100644
--- a/Plugin/Source.pm
+++ b/Plugin/Source.pm
@@ -12,7 +12,7 @@ sub configure {
}
sub source {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
my @urls = (
"https://git.nah.nz/idalius/",
"https://gitlab.com/dphillips/idalius");
diff --git a/Plugin/Thanks.pm b/Plugin/Thanks.pm
index e40e3ef..01c52ac 100644
--- a/Plugin/Thanks.pm
+++ b/Plugin/Thanks.pm
@@ -16,7 +16,7 @@ sub configure {
}
sub thanks {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
my $nick = (split /!/, $who)[0];
my @responses = (
"No problem",
diff --git a/Plugin/Timezone.pm b/Plugin/Timezone.pm
index 90db1fb..c679340 100644
--- a/Plugin/Timezone.pm
+++ b/Plugin/Timezone.pm
@@ -19,7 +19,7 @@ sub configure {
}
sub time {
- my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+ my ($self, $irc, $logger, $who, $where, $ided, $rest, @arguments) = @_;
my $requester = (split /!/, $who)[0];
my @known_zones = (keys %{$config->{timezone}});