summaryrefslogtreecommitdiff
path: root/lib/Multi/IRC.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-06-15 19:03:29 +0200
committerYorhel <git@yorhel.nl>2015-06-15 19:03:29 +0200
commit2cde95a8076306a9d4f27b62121d30f6518f2846 (patch)
treef38be13bc771df65a129b38e5ac003626e13b752 /lib/Multi/IRC.pm
parent9b5895c7a6d2dc1cbb7587215bebbbf293a2ab49 (diff)
Multi::IRC: Some fixes wrt. chat logging
Diffstat (limited to 'lib/Multi/IRC.pm')
-rw-r--r--lib/Multi/IRC.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm
index ad5a456d..100e4967 100644
--- a/lib/Multi/IRC.pm
+++ b/lib/Multi/IRC.pm
@@ -146,7 +146,7 @@ sub set_logger {
my $l = sub {
my($chan, $msg, @arg) = @_;
return if !grep $chan eq $_, @{$O{channels}};
- open my $F, '>>', "$VNDB::M{log_dir}/$chan" or die $!;
+ open my $F, '>>', "$VNDB::M{log_dir}/$chan.log" or die $!;
print $F strftime('%Y-%m-%d %H:%M:%S', localtime).' '.sprintf($msg, @arg)."\n";
};
@@ -154,13 +154,11 @@ sub set_logger {
my(undef, $nick, $chan) = @_;
$l->($chan, '--> %s (%s) joins %s', $nick, $irc->nick_ident($nick)||'', $chan);
});
- $irc->reg_cb(part => sub {
- my(undef, $nick, $chan, undef $msg) = @_;
- $l->($chan, '<-- %s (%s) quits (%s)', $nick, $irc->nick_ident($nick)||'', $msg);
- });
- $irc->reg_cb(kick => sub {
- my(undef, $nick, $chan, undef, $msg, $kicker) = @_;
- $l->($chan, '<-- %s kicks %s from %s (%s)', $kicker, $nick, $chan, $msg);
+ $irc->reg_cb(channel_remove => sub {
+ my(undef, $msg, $chan, @nicks) = @_;
+ return if !defined $msg;
+ $msg = $msg->{params}[$#{$msg->{params}}]||'';
+ $l->($chan, '<-- %s (%s) quits (%s)', $_, $irc->nick_ident($_)||'', $msg) for(@nicks);
});
$irc->reg_cb(channel_change => sub {
my(undef, undef, $chan, $old, $new) = @_;