aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2019-06-23 14:27:10 +1200
committerDavid Phillips <david@sighup.nz>2019-06-23 14:27:10 +1200
commitcc32474c98aa46b69856e276a46f325e29588f93 (patch)
treefb942ee32c768a532b5dd60f45a147a1a8ee9a55
parent6f76af376a0a3838447190fd1eeb723c15d0bb99 (diff)
downloadidalius-cc32474c98aa46b69856e276a46f325e29588f93.tar.xz
Log private messages, too
-rw-r--r--Plugin/Log.pm7
-rwxr-xr-xidalius.pl6
2 files changed, 10 insertions, 3 deletions
diff --git a/Plugin/Log.pm b/Plugin/Log.pm
index a5dee69..a993d3f 100644
--- a/Plugin/Log.pm
+++ b/Plugin/Log.pm
@@ -17,6 +17,7 @@ my %t = (
host => color("magenta"),
channel => color("blue"),
message => color("reset"),
+ private => color("magenta"),
misc => color("bright_black"),
reset => color("reset")
);
@@ -92,6 +93,12 @@ sub on_message {
return;
}
+sub on_privmsg {
+ my ($self, $logger, $who, $to, $raw_what, $what, $irc) = @_;
+ $logger->("$t{bracket}\[$t{channel}private$t{bracket}\] $t{nick}$who$t{bracket}: $t{private}$what$t{reset}");
+ return;
+}
+
sub on_action {
my ($self, $logger, $who, $where, $raw_what, $what, $irc) = @_;
$logger->("$t{bracket}\[$t{channel}$where->[0]$t{bracket}\] $t{message}* $t{nick}$who $t{message}$raw_what$t{reset}");
diff --git a/idalius.pl b/idalius.pl
index 8e14897..b34353d 100755
--- a/idalius.pl
+++ b/idalius.pl
@@ -525,14 +525,14 @@ sub irc_ping {
sub irc_msg {
my ($who, $to, $what, $ided) = @_[ARG0 .. ARG3];
my $nick = (split /!/, $who)[0];
-
- # FIXME trigger plugins with on_msg or something. Currently no privmsg
- # are logged, but Log.pm can do this for us.
+ my @empty = ();
my $stripped_what = strip_color(strip_formatting($what));
my $output = run_command($stripped_what, $who, $nick, $ided);
$irc->yield(privmsg => $nick => $output) if $output;
+ trigger_modules("privmsg", $who, undef, \@empty, ($who, $to, $what, $stripped_what));
+
return;
}