aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'Plugin')
-rw-r--r--Plugin/Antiflood.pm2
-rw-r--r--Plugin/Greet.pm4
-rw-r--r--Plugin/Hmm.pm2
-rw-r--r--Plugin/Jinx.pm6
-rw-r--r--Plugin/Log.pm60
-rw-r--r--Plugin/Men.pm2
-rw-r--r--Plugin/Natural.pm4
-rw-r--r--Plugin/Rejoin.pm34
-rw-r--r--Plugin/Titillate.pm2
-rw-r--r--Plugin/URL_Title.pm2
10 files changed, 106 insertions, 12 deletions
diff --git a/Plugin/Antiflood.pm b/Plugin/Antiflood.pm
index 77d7f17..37e2199 100644
--- a/Plugin/Antiflood.pm
+++ b/Plugin/Antiflood.pm
@@ -16,7 +16,7 @@ sub configure {
}
sub on_message {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $channel = $where->[0];
my $nick = (split /!/, $who)[0];
diff --git a/Plugin/Greet.pm b/Plugin/Greet.pm
index e66c91a..e28ff26 100644
--- a/Plugin/Greet.pm
+++ b/Plugin/Greet.pm
@@ -54,10 +54,10 @@ my @own_responses = (
);
sub on_join {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $irc) = @_;
my $nick = (split /!/, $who)[0];
my $response;
- if ($nick eq $root_config->{current_nick}) {
+ if ($nick eq $irc->nick_name()) {
return unless self_odds();
$response = some @own_responses;
} else {
diff --git a/Plugin/Hmm.pm b/Plugin/Hmm.pm
index 9c426b8..e3909a0 100644
--- a/Plugin/Hmm.pm
+++ b/Plugin/Hmm.pm
@@ -27,7 +27,7 @@ sub some {
}
sub on_message {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $nick = (split /!/, $who)[0];
# Don't perform this in q to users
diff --git a/Plugin/Jinx.pm b/Plugin/Jinx.pm
index f1e712b..733291f 100644
--- a/Plugin/Jinx.pm
+++ b/Plugin/Jinx.pm
@@ -19,7 +19,7 @@ sub configure {
}
sub on_message {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $channel = $where->[0];
return if $last_response{$channel} and lc $what eq lc $last_response{$channel};
@@ -35,7 +35,7 @@ sub on_message {
}
sub on_action {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $channel = $where->[0];
return if $last_response{$channel} and lc $what eq lc $last_response{$channel};
@@ -53,7 +53,7 @@ sub on_action {
# Even ignored nicks should be allowed to break a streak
sub on_message_yes_really_even_from_ignored_nicks {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $channel = $where->[0];
return if $last{$channel} and lc $last{$channel} eq lc $what;
diff --git a/Plugin/Log.pm b/Plugin/Log.pm
new file mode 100644
index 0000000..8f9982f
--- /dev/null
+++ b/Plugin/Log.pm
@@ -0,0 +1,60 @@
+package Plugin::Log;
+
+use strict;
+use warnings;
+
+my $config;
+my $root_config;
+
+sub configure {
+ my $self = shift;
+ shift; # cmdref
+ shift; # run_command
+ $config = shift;
+ $root_config = shift;
+
+ return $self;
+}
+
+sub on_message {
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
+ $logger->("[$where->[0]] $who: $raw_what");
+ return;
+}
+
+sub on_action {
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
+ $logger->("[$where->[0]] * $who $raw_what");
+ return;
+}
+
+sub on_part {
+ my ($self, $logger, $who, $where, $why, $irc) = @_;
+ $logger->("[$where] --- $who left ($why)");
+ return;
+}
+
+sub on_join {
+ my ($self, $logger, $who, $where, $irc) = @_;
+ $logger->("[$where] --- $who joined");
+ return;
+}
+
+sub on_kick {
+ my ($self, $logger, $kicker, $where, $kickee, $why, $irc) = @_;
+ $logger->("[$where] !!! $kicker kicked $kickee ($why)");
+ return;
+}
+
+sub on_nick {
+ my ($self, $logger, $who, $new_nick, $irc) = @_;
+ $logger->("$who changed nick to $new_nick");
+ return;
+}
+
+sub on_invite {
+ my ($self, $logger, $who, $where, $irc) = @_;
+ $logger->("$who invited me to join $where");
+ return;
+}
+1;
diff --git a/Plugin/Men.pm b/Plugin/Men.pm
index 7a53a71..265cc87 100644
--- a/Plugin/Men.pm
+++ b/Plugin/Men.pm
@@ -24,7 +24,7 @@ sub configure {
}
sub on_message {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
return unless rand(100) < $config->{chance};
diff --git a/Plugin/Natural.pm b/Plugin/Natural.pm
index 2d13070..501bf11 100644
--- a/Plugin/Natural.pm
+++ b/Plugin/Natural.pm
@@ -86,7 +86,7 @@ sub choose_normal_response {
}
sub on_message {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $nick = (split /!/, $who)[0];
if (ref($where) eq "ARRAY") {
@@ -94,7 +94,7 @@ sub on_message {
}
my $response;
- if ($what =~ /\b\Q$root_config->{current_nick}\E\b/) {
+ if ($what =~ /\b\Q$irc->nick_name()\E\b/) {
return unless mention_odds();
$response = choose_mention_response($what, $nick);
} else {
diff --git a/Plugin/Rejoin.pm b/Plugin/Rejoin.pm
new file mode 100644
index 0000000..127f5bc
--- /dev/null
+++ b/Plugin/Rejoin.pm
@@ -0,0 +1,34 @@
+package Plugin::Rejoin;
+
+use strict;
+use warnings;
+
+my $config;
+my $root_config;
+
+sub configure {
+ my $self = shift;
+ shift; # cmdref
+ shift; # run_command
+ $config = shift;
+ $root_config = shift;
+
+ return $self;
+}
+
+sub on_kick {
+ my ($self, $logger, $kicker, $where, $kickee, $why, $irc) = @_;
+ if ($kickee eq $irc->nick_name) {
+ $logger->("I was kicked from $where. Rejoining now...");
+ $irc->yield(join => $where);
+ }
+ return;
+}
+
+sub on_invite {
+ my ($self, $logger, $who, $where, $irc) = @_;
+
+ $irc->yield(join => $where) if (grep {$_ eq $where} @{$root_config->{channels}});
+ return;
+}
+1;
diff --git a/Plugin/Titillate.pm b/Plugin/Titillate.pm
index 499d350..817facd 100644
--- a/Plugin/Titillate.pm
+++ b/Plugin/Titillate.pm
@@ -19,7 +19,7 @@ sub configure {
}
sub on_message {
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $gathered = "";
my @expressions = (keys %{$config->{triggers}});
my %responses;
diff --git a/Plugin/URL_Title.pm b/Plugin/URL_Title.pm
index 205a6c5..4bc9fc8 100644
--- a/Plugin/URL_Title.pm
+++ b/Plugin/URL_Title.pm
@@ -35,7 +35,7 @@ sub start_handler
sub on_message
{
- my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_;
+ my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
my $url;
# Drawn from RFC 3986Β§2