Make GmailFolder sync GMail labels
When synclabels config flag is set to "yes" for the GMail repo, offlineimap fetches the message labels along with the messages, and embeds them into the body under the header X-Keywords (or whatever 'labelsheader' was set to), as a comma separated list. It also adds an extra pass to savemessageto, that performs label synchronization on existing messages from GMail to local, the same way it is done with flags. We also introduce GmailMaildir repository that adds functionality to change message labels. It keeps track of messages modification time, so one can quickly detect when the labels may have changed. Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:

committed by
Eygene Ryabinkin

parent
9319ae212b
commit
0e4afa9132
@ -177,10 +177,9 @@ class MaildirRepository(BaseRepository):
|
||||
self.debug(" This is maildir folder '%s'." % foldername)
|
||||
if self.getconfboolean('restoreatime', False):
|
||||
self._append_folder_atimes(foldername)
|
||||
retval.append(folder.Maildir.MaildirFolder(self.root,
|
||||
foldername,
|
||||
self.getsep(),
|
||||
self))
|
||||
fd = self.getfoldertype()(self.root, foldername,
|
||||
self.getsep(), self)
|
||||
retval.append(fd)
|
||||
|
||||
if self.getsep() == '/' and dirname != '':
|
||||
# Recursively check sub-directories for folders too.
|
||||
@ -194,6 +193,9 @@ class MaildirRepository(BaseRepository):
|
||||
self.folders = self._getfolders_scandir(self.root)
|
||||
return self.folders
|
||||
|
||||
def getfoldertype(self):
|
||||
return folder.Maildir.MaildirFolder
|
||||
|
||||
def forgetfolders(self):
|
||||
"""Forgets the cached list of folders, if any. Useful to run
|
||||
after a sync run."""
|
||||
|
Reference in New Issue
Block a user