Change X-OfflineIMAP header format
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. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
d687999a66
commit
573d7ed52a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user