[PATCH 1/2] Another way of locating UID of just saved message

Vladimir Marek Vladimir.Marek at Oracle.COM
Wed Aug 3 16:12:13 BST 2011


Hmm, that should be 1/1.

After discussion with imaplib2 author, I don't need to modify imaplib2's
code. I use bytearray instead of my personal class.

> @@ -485,6 +549,9 @@ class IMAPFolder(BaseFolder):
>                      assert(imapobj.noop()[0] == 'OK')
>                      uid = self.savemessage_searchforheader(imapobj, headername,
>                                                         headervalue)
> +                    if uid == 0:
> +                        self.ui.debug('imap', 'savemessage: second attempt to get new UID failed. Going to try search headers manually')
> +                        uid = self.savemessage_fetchheaders(imapobj, headername, headervalue)

Also I don't like the fact, that OfflineIMAP tries SEARCH twice for
every message before it tries to download full headers. It could
remember that SEARCH failed in the past and for every new message skip
directly to fetching headrers.

But that can be updated in further changes.

Maybe this is not suitable for the just-to-be released branch anyway?

-- 
	Vlad




More information about the OfflineIMAP-project mailing list