summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2af811c)
raw | patch | inline | side by side (parent: 2af811c)
author | Harper Mann <harpermann@users.sourceforge.net> | |
Tue, 29 Nov 2005 23:19:06 +0000 (23:19 +0000) | ||
committer | Harper Mann <harpermann@users.sourceforge.net> | |
Tue, 29 Nov 2005 23:19:06 +0000 (23:19 +0000) |
a warning about type comparison.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1289 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1289 f882894a-f735-0410-b71e-b25c423dba1c
contrib/check_email_loop.pl | patch | blob | history |
index 7e0a9f0e93f97585ad9b095c63bc6acea6dea789..bcaf13b49cdff146fda49f47fa949859db03a644 100644 (file)
-#!/usr/bin/perl
+#!/usr/bin/perl -w
+#
+# $Id$
#
# (c)2000 Benjamin Schmid, blueshift@gmx.net (emergency use only ;-)
# Copyleft by GNU GPL
my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
+$debug = 0;
# Internal Vars
my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
# sending new ping email
-%other_smtp_opts={};
+%other_smtp_opts=();
if ( $debug == 1 ) {
$other_smtp_opts{'Debug'} = 1;
}
$smtp->to($receiver) &&
$smtp->data() &&
$smtp->datasend("To: $receiver\nSubject: E-Mail Ping [$serial]\n\n".
- "This is a automatically sended E-Mail.\n".
- "It ist not intended for human reader.\n\n".
+ "This is an automatically sent E-Mail.\n".
+ "It is not intended for a human reader.\n\n".
"Serial No: $serial\n") &&
$smtp->dataend() &&
$smtp->quit
@@ -145,6 +148,7 @@ nsexit("POP3 login failed (user:$popuser)",'CRITICAL') if (!defined($msgcount));
# Check if more than maxmsg mails in pop3-box
nsexit(">$maxmsg Mails ($msgcount Mails on POP3); Please delete !",'WARNING') if ($msgcount > $maxmsg);
+my ($mid, $nid);
# Count messages, that we are looking 4:
while ($msgcount > 0) {
@msglines = @{$pop->top($msgcount,1)};
if (messagematchsid(\@msglines,$messageids[$i])) {
$matchcount++;
# newest received mail than the others, ok remeber id.
- $newestid = $messageids[$i] if ($messageids[$i] > $newestid || !defined $newestid);
+ if (!defined $newestid) {
+ $newestid = $messageids[$i];
+ } else {
+ $messageids[$i] =~ /\#(\d+)\#/;
+ $mid = $1;
+ $newestid =~ /\#(\d+)\#/;
+ $nid = $1;
+ if ($mid > $nid) {
+ $newestid = $messageids[$i];
+ }
+ }
$pop->delete($msgcount); # remove E-Mail from POP3 server
splice @messageids, $i, 1;# remove id from List
last; # stop looking in list