summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
12d2edf)
(log_headers): Pass the array of contents for each header to
logincoming rather than indexing here. logincoming now checks for an
empty array (i.e. message missing this header) before trying to index
into it (it used to bomb).
-sub logincoming { mylog('info', INCOMINGCHAR, @_); }
sub logsave { mylog('notice', SAVECHAR, @_); }
sub loginfo { mylog('info', INFOCHAR, @_); }
sub logdebug { mylog('debug', DEBUGCHAR, @_); }
sub logwarn { mylog('warning', WARNCHAR, @_); }
sub logerr { mylog('error', ERRORCHAR, @_); }
sub logsave { mylog('notice', SAVECHAR, @_); }
sub loginfo { mylog('info', INFOCHAR, @_); }
sub logdebug { mylog('debug', DEBUGCHAR, @_); }
sub logwarn { mylog('warning', WARNCHAR, @_); }
sub logerr { mylog('error', ERRORCHAR, @_); }
+sub logincoming {
+ my ($text, @contents) = @_;
+ my $last;
+
+ if (@contents) {
+ $last = $contents[-1];
+ } else {
+ $last = '';
+ }
+
+ mylog('info', INCOMINGCHAR, $text, $last);
+}
+
sub log_headers {
my %headers = @_;
# For an explanation of the %headers structure, see the
# get_headers function below.
sub log_headers {
my %headers = @_;
# For an explanation of the %headers structure, see the
# get_headers function below.
- logincoming('From: ', @{$headers{'return-path'}}[-1]);
- logincoming('To: ', @{$headers{'to'}}[-1]);
- logincoming('Subject: ', @{$headers{'subject'}}[-1]);
- logincoming('Message-Id: ', @{$headers{'message-id'}}[-1]);
+ logincoming('From: ', @{$headers{'return-path'}});
+ logincoming('To: ', @{$headers{'to'}});
+ logincoming('Subject: ', @{$headers{'subject'}});
+ logincoming('Message-Id: ', @{$headers{'message-id'}});