[PATCH] Change X-OfflineIMAP header format
Johannes Stezenbach
js at sig21.net
Thu Oct 7 11:33:27 BST 2010
Change the X-OfflineIMAP header to work around possible Exchange MAPI
table overflow problem described in
http://article.gmane.org/gmane.mail.imap.offlineimap.general/1699
(It is unknown whether this problem still exits in current
Exchange versions, but let's assume the worst.)
The X-OfflineIMAP header is neccessary with some IMAP servers to
reliably determine the UID of a new messages uploaded to the server
by using the "UID SEARCH HEADER name string" command. Since this
command compares header name and value it is sufficient to have
a unique header value and a non-unique header name.
Note that a message can have more than one X-OfflineIMAP header if
the message was copied between IMAP folders multiple times.
---
offlineimap/folder/IMAP.py | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index c90d0e5..927c5f4 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -220,10 +220,11 @@ class IMAPFolder(BaseFolder):
return self.messagelist[uid]['flags']
def savemessage_getnewheader(self, content):
- headername = 'X-OfflineIMAP-%s-' % str(binascii.crc32(content)).replace('-', 'x')
- headername += binascii.hexlify(self.repository.getname()) + '-'
- headername += binascii.hexlify(self.getname())
- headervalue= '%d-' % long(time.time())
+ headername = 'X-OfflineIMAP'
+ headervalue = '%s-' % str(binascii.crc32(content)).replace('-', 'x')
+ headervalue += binascii.hexlify(self.repository.getname()) + '-'
+ headervalue += binascii.hexlify(self.getname())
+ headervalue += '-%d-' % long(time.time())
headervalue += str(self.randomgenerator.random()).replace('.', '')
headervalue += '-v' + versionstr
return (headername, headervalue)
--
1.7.1
More information about the OfflineIMAP-project
mailing list