Rename $msgs
to $emailbody
to improve readability
This commit is contained in:
parent
66ec57a902
commit
f9dafa35a1
1 changed files with 14 additions and 12 deletions
26
ddclient.in
26
ddclient.in
|
@ -125,8 +125,8 @@ if ($program =~ /test/i) {
|
||||||
$savedir = 'URL';
|
$savedir = 'URL';
|
||||||
}
|
}
|
||||||
|
|
||||||
my $msgs = '';
|
my $emailbody = '';
|
||||||
my $last_msgs = '';
|
my $last_emailbody = '';
|
||||||
|
|
||||||
## If run as *d (e.g., ddclientd) then daemonize by default (but allow
|
## If run as *d (e.g., ddclientd) then daemonize by default (but allow
|
||||||
## flags and options to override).
|
## flags and options to override).
|
||||||
|
@ -2311,19 +2311,19 @@ sub sendmail {
|
||||||
if (opt('mail-failure') && ($result ne 'OK' && $result ne '0')) {
|
if (opt('mail-failure') && ($result ne 'OK' && $result ne '0')) {
|
||||||
$recipients = opt('mail-failure');
|
$recipients = opt('mail-failure');
|
||||||
}
|
}
|
||||||
if ($msgs && $recipients && $msgs ne $last_msgs) {
|
if ($emailbody && $recipients && $emailbody ne $last_emailbody) {
|
||||||
pipecmd("sendmail -oi $recipients",
|
pipecmd("sendmail -oi $recipients",
|
||||||
"To: $recipients",
|
"To: $recipients",
|
||||||
"Subject: status report from $program\@$hostname",
|
"Subject: status report from $program\@$hostname",
|
||||||
"\r\n",
|
"\r\n",
|
||||||
$msgs,
|
$emailbody,
|
||||||
"",
|
"",
|
||||||
"regards,",
|
"regards,",
|
||||||
" $program\@$hostname (version $version)"
|
" $program\@$hostname (version $version)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$last_msgs = $msgs;
|
$last_emailbody = $emailbody;
|
||||||
$msgs = '';
|
$emailbody = '';
|
||||||
}
|
}
|
||||||
######################################################################
|
######################################################################
|
||||||
## split_by_comma
|
## split_by_comma
|
||||||
|
@ -2390,7 +2390,7 @@ sub ynu {
|
||||||
my $_in_msg = 0;
|
my $_in_msg = 0;
|
||||||
sub _msg {
|
sub _msg {
|
||||||
my $fh = shift;
|
my $fh = shift;
|
||||||
my $log = shift;
|
my $email = shift;
|
||||||
my $prefix = shift;
|
my $prefix = shift;
|
||||||
my $format = shift;
|
my $format = shift;
|
||||||
my $buffer = sprintf $format, @_;
|
my $buffer = sprintf $format, @_;
|
||||||
|
@ -2409,11 +2409,13 @@ sub _msg {
|
||||||
$buffer .= "\n";
|
$buffer .= "\n";
|
||||||
print $fh $buffer;
|
print $fh $buffer;
|
||||||
|
|
||||||
$msgs .= $buffer if $log;
|
if ($email) {
|
||||||
if ($log && !$_in_msg) {
|
$emailbody .= $buffer;
|
||||||
++$_in_msg; # avoid infinite recursion if logger calls _msg
|
if (!$_in_msg) {
|
||||||
logger($buffer);
|
++$_in_msg; # avoid infinite recursion if logger calls _msg
|
||||||
--$_in_msg;
|
logger($buffer);
|
||||||
|
--$_in_msg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue