1
0
mirror of https://github.com/OfflineIMAP/offlineimap.git synced 2024-06-29 07:50:51 +02:00

/offlineimap/head: changeset 143

No longer throws an exception when updating messages with strange Date
headers; will just set IMAP Internaldate to the current date.
This commit is contained in:
jgoerzen 2002-07-18 22:50:50 +01:00
parent 0f104249ee
commit 57ba2d0e85
2 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,8 @@
offlineimap (3.0.3) unstable; urgency=low offlineimap (3.0.3) unstable; urgency=low
* Placeholder. * No longer throws an exception when updating messages with strange
Date headers; will just set IMAP Internaldate to the current date.
Closes: #153425.
-- John Goerzen <jgoerzen@complete.org> Thu, 18 Jul 2002 17:46:13 -0500 -- John Goerzen <jgoerzen@complete.org> Thu, 18 Jul 2002 17:46:13 -0500

View File

@ -18,7 +18,7 @@
from Base import BaseFolder from Base import BaseFolder
from offlineimap import imaputil, imaplib from offlineimap import imaputil, imaplib
import rfc822 import rfc822, time
from StringIO import StringIO from StringIO import StringIO
from copy import copy from copy import copy
@ -105,7 +105,10 @@ class IMAPFolder(BaseFolder):
message = rfc822.Message(StringIO(content)) message = rfc822.Message(StringIO(content))
mid = imapobj._quote(message.getheader('Message-Id')) mid = imapobj._quote(message.getheader('Message-Id'))
date = imaplib.Time2Internaldate(rfc822.parsedate(message.getheader('Date'))) datetuple = rfc822.parsedate(message.getheader('Date'))
if datetuple == None:
datetuple = time.localtime()
date = imaplib.Time2Internaldate(datetuple)
if content.find("\r\n") == -1: # Convert line endings if not already if content.find("\r\n") == -1: # Convert line endings if not already
content = content.replace("\n", "\r\n") content = content.replace("\n", "\r\n")