diff --git a/logcompact b/logcompact
index 217d25a..ccd517d 100644
--- a/logcompact
+++ b/logcompact
@@ -167,6 +167,14 @@ sub hook_queue {
return DECLINED;
}
+sub hook_post_connection {
+ my ($self) = @_;
+ return DECLINED if $self->qp->connection->notes("logcompact");
+
+ $self->_log(undef, "logcompact", "", "Connection gone");
+ return DECLINED;
+}
+
sub _quote {
my ($string) = @_;
$string =~ s/([\\"])/\\$1/g;
@@ -197,13 +205,13 @@ sub _log {
L => $c->local_ip,
R => $c->remote_ip,
H => lc($c->remote_host),
- F => lc($t->sender), # also forces string overloading :)
- T => join(',', map lc, $t->recipients),
+ F => ($t ? lc($t->sender) : ""),
+ T => ($t ? join(',', map lc, $t->recipients) : ""),
S => $retval{$retval},
P => $plugin,
I => $info,
X => sub { $c->notes(shift) },
- N => sub { $t->notes(shift) },
+ N => ($t ? sub { $t->notes(shift) } : ""),
);
not defined and $_ = "" for values %info;
@@ -224,6 +232,8 @@ sub _log {
}ge;
$self->log($self->{_loglevel}, $string);
+
+ $c->notes("logcompact" => 1);
}
1;