[PATCH 4/4] learn to not download UIDs defined by the user

Łukasz Żarnowiecki dolohow at outlook.com
Tue Jul 5 22:10:42 BST 2016


On Wed, Jun 29, 2016 at 12:04:47AM +0200, Nicolas Sebrecht wrote:
> diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
> index 98f78f8..e467f23 100644
> --- a/offlineimap/folder/Base.py
> +++ b/offlineimap/folder/Base.py
> @@ -45,6 +45,7 @@ class BaseFolder(object):
>          if self.name == 'INBOX':
>              self.newmail_hook = repository.newmail_hook
>          self.have_newmail = False
> +        self.copy_ignoreUIDs = None # List of UIDs to ignore.

Maybe it would be better to use empty list?  You could then avoid
checking if it is None plus you would have consitent type.

> @@ -75,6 +77,19 @@ class IMAPRepository(BaseRepository):
>      def dropconnections(self):
>          self.imapserver.close()
>  
> +    def get_copy_ignore_UIDs(self, foldername):
> +        """Return a list of UIDs to not copy for this foldername."""
> +
> +        if self.copy_ignore_eval is None:
> +            if self.config.has_option(self.getsection(),
> +                                     'copy_ignore_eval'):
> +                self.copy_ignore_eval = self.localeval.eval(
> +                        self.getconf('copy_ignore_eval'))
> +            else:
> +                self.copy_ignore_eval = lambda x: None

lambda: None should be enough ;)




More information about the OfflineIMAP-project mailing list