learn to not download UIDs defined by the user
Allow users to workaround offending emails that offlineimap can't download. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
@ -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.
|
||||
self.repository = repository
|
||||
self.visiblename = repository.nametrans(name)
|
||||
# In case the visiblename becomes '.' or '/' (top-level) we use
|
||||
@ -870,6 +871,13 @@ class BaseFolder(object):
|
||||
if not statusfolder.uidexists(uid)]
|
||||
num_to_copy = len(copylist)
|
||||
|
||||
# Honor 'copy_ignore_eval' configuration option.
|
||||
if self.copy_ignoreUIDs is not None:
|
||||
for uid in self.copy_ignoreUIDs:
|
||||
if uid in copylist:
|
||||
copylist.remove(uid)
|
||||
self.ui.ignorecopyingmessage(uid, self, dstfolder)
|
||||
|
||||
if num_to_copy > 0 and self.repository.account.dryrun:
|
||||
self.ui.info(
|
||||
"[DRYRUN] Copy {0} messages from {1}[{2}] to {3}".format(
|
||||
|
@ -58,6 +58,10 @@ class IMAPFolder(BaseFolder):
|
||||
fh_conf = self.repository.account.getconf('filterheaders', '')
|
||||
self.filterheaders = [h for h in re.split(r'\s*,\s*', fh_conf) if h]
|
||||
|
||||
# self.copy_ignoreUIDs is used by BaseFolder.
|
||||
self.copy_ignoreUIDs = repository.get_copy_ignore_UIDs(
|
||||
self.getvisiblename())
|
||||
|
||||
|
||||
def __selectro(self, imapobj, force=False):
|
||||
"""Select this folder when we do not need write access.
|
||||
|
Reference in New Issue
Block a user