Maildir repository: add config keys for IMAP keywords
This commit assembles a dictionary mapping user-specified IMAP keywords to Maildir lower-case flags, similar to Dovecot's format http://wiki2.dovecot.org/MailboxFormat/Maildir Configuration example: [Repository Local] type = Maildir localfolders = ~/Maildir/ customflag_a = $label1 customflag_b = $Forwarded customflag_c = Junk Signed-off-by: Igor Almeida <igor.contato@gmail.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
c52ca66874
commit
4e2de8f58a
@ -133,6 +133,9 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
|
||||
def getsep(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def getkeywordmap(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def should_sync_folder(self, fname):
|
||||
"""Should this folder be synced?"""
|
||||
|
||||
|
@ -39,6 +39,14 @@ class MaildirRepository(BaseRepository):
|
||||
if not os.path.isdir(self.root):
|
||||
os.mkdir(self.root, 0o700)
|
||||
|
||||
# Create the keyword->char mapping
|
||||
self.keyword2char = dict()
|
||||
for c in 'abcdefghijklmnopqrstuvwxyz':
|
||||
confkey = 'customflag_' + c
|
||||
keyword = self.getconf(confkey, None)
|
||||
if keyword is not None:
|
||||
self.keyword2char[keyword] = c
|
||||
|
||||
def _append_folder_atimes(self, foldername):
|
||||
"""Store the atimes of a folder's new|cur in self.folder_atimes"""
|
||||
|
||||
@ -72,6 +80,9 @@ class MaildirRepository(BaseRepository):
|
||||
def getsep(self):
|
||||
return self.getconf('sep', '.').strip()
|
||||
|
||||
def getkeywordmap(self):
|
||||
return self.keyword2char
|
||||
|
||||
def makefolder(self, foldername):
|
||||
"""Create new Maildir folder if necessary
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user