From: Thomas Jarosch Date: Thu, 28 Jun 2012 07:59:42 +0000 (+0200) Subject: Always log if the date is going to be corrected X-Git-Url: http://developer.intra2net.com/git/?p=imap-fix-internaldate;a=commitdiff_plain;h=36f4d19646946b93bcf0aa2b3dffecb451ec5dfe Always log if the date is going to be corrected --- diff --git a/confscript.cfg b/confscript.cfg index e287aa8..5e6f10a 100644 --- a/confscript.cfg +++ b/confscript.cfg @@ -1,6 +1,6 @@ [basic_settings] # 0 NOTSET, 10 DEBUG, 20 INFO, 30 WARNING, 40 ERROR, 50 CRITICAL -file_log_level = 20 +file_log_level = 10 console_log_level = 20 imap_server = intranator.m.i2n tolerance = 120 diff --git a/fix_imap_internaldate.py b/fix_imap_internaldate.py index d169f2b..06f39e0 100644 --- a/fix_imap_internaldate.py +++ b/fix_imap_internaldate.py @@ -82,21 +82,21 @@ def main(): logging.error(ex) continue if(date_parser.compare_dates(received_date, internal_date, tolerance)): - #print(received_date, internal_date) + logging.warning("Date conflict found in message uid: %s - mailbox: %s - user: %s.\nInternal date %s is different from received date %s from RECEIVED header:\n%s.", + mid.decode('iso-8859-1'), box.name, box.owner, + internal_date.strftime("%d %b %Y %H:%M:%S"), + received_date.strftime("%d %b %Y %H:%M:%S"), + fetched_received_date.split("Received:")[1]) if(args.test_mode==0): try: session.update_message(mid, box.name, received_date) except UserWarning as ex: logging.error(ex) continue - else: - logging.warning("Date conflict found in message uid: %s - mailbox: %s - user: %s.\nInternal date %s is different from received date %s from RECEIVED header:\n%s.", - mid.decode('iso-8859-1'), box.name, box.owner, - internal_date.strftime("%d %b %Y %H:%M:%S"), - received_date.strftime("%d %b %Y %H:%M:%S"), - fetched_received_date.split("Received:")[1]) + # count total emails for every user and mailbox box.date_conflicts += 1 + # if all messages were successfully fixed confirm caching if(not args.test_mode): box.confirm_change()