diff --git a/Changelog.draft.rst b/Changelog.draft.rst index e099689..f68d747 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -12,6 +12,9 @@ others. New Features ------------ +* Implement UIDPLUS extension support. OfflineIMAP will now not insert + an X-OfflineIMAP header if the mail server supports the UIDPLUS + extension. * SSL: support subjectAltName. diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 17b849b..a419664 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -274,9 +274,6 @@ class IMAPFolder(BaseFolder): def savemessage_searchforheader(self, imapobj, headername, headervalue): - if imapobj.untagged_responses.has_key('APPENDUID'): - return long(imapobj.untagged_responses['APPENDUID'][-1].split(' ')[1]) - self.ui.debug('imap', 'savemessage_searchforheader called for %s: %s' % \ (headername, headervalue)) # Now find the UID it got. @@ -389,38 +386,42 @@ class IMAPFolder(BaseFolder): This function will update the self.messagelist dict to contain the new message after sucessfully saving it. - :param rtime: A timestamp to be + :param rtime: A timestamp to be used as the mail date :returns: the UID of the new message as assigned by the server. If the folder is read-only it will return 0.""" - imapobj = self.imapserver.acquireconnection() self.ui.debug('imap', 'savemessage: called') try: + imapobj = self.imapserver.acquireconnection() + try: - imapobj.select(self.getfullname()) # Needed for search + imapobj.select(self.getfullname()) # Needed for search and making the box READ-WRITE except imapobj.readonly: + # readonly exception. Return original uid to notify that + # we did not save the message. (see savemessage in Base.py) self.ui.msgtoreadonly(self, uid, content, flags) - # Return indicating message taken, but no UID assigned. - return 0 - + return uid + + # UIDPLUS extension provides us with an APPENDUID response to our append() + use_uidplus = 'UIDPLUS' in imapobj.capabilities + # get the date of the message file, so we can pass it to the server. date = self.getmessageinternaldate(content, rtime) - self.ui.debug('imap', 'savemessage: using date %s' % date) + content = re.sub("(?