utf8: implement utf8foldernames option
If utf8foldernames is enabled on account level all folder names read from the IMAP server will immediately be reencoded to UTF-8. Names will be treated as UTF-8 as long as the IMAP server isn't contacted again, for which they are reencoded to IMAP4-UTF-7. This means that any further processing such as nametrans, folderfilter etc. will act upon the UTF-8 names, which will have to be documented carefully. NOTE 1: GMail repositories and folders inherit from the IMAP... classes, so I don't know yet if these changes have ugly side-effects. But web research suggests that GMail IMAP folders are equally encoded in UTF-7 so that should work identically here and incorporate the same improvements. NOTE 2: I could not test the behaviour with idlefolders as I didn't get this option to work at all, not even with the latest stable version. NOTE 3: I *did* test to sync an IMAP repository against another IMAP repository. Signed-off-by: Urs Liska <git@ursliska.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:

committed by
Nicolas Sebrecht

parent
14d83dbf48
commit
36d726763d
@ -40,8 +40,8 @@ class MappedIMAPFolder(IMAPFolder):
|
||||
diskr2l: dict mapping message uids: self.r2l[remoteuid]=localuid
|
||||
diskl2r: dict mapping message uids: self.r2l[localuid]=remoteuid"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
IMAPFolder.__init__(self, *args, **kwargs)
|
||||
def __init__(self, imapserver, name, repository, decode=True):
|
||||
IMAPFolder.__init__(self, imapserver, name, repository, decode=False)
|
||||
self.dryrun = self.config.getdefaultboolean("general", "dry-run", True)
|
||||
self.maplock = Lock()
|
||||
self.diskr2l, self.diskl2r = self._loadmaps()
|
||||
@ -49,7 +49,7 @@ class MappedIMAPFolder(IMAPFolder):
|
||||
# Representing the local IMAP Folder using local UIDs.
|
||||
# XXX: This should be removed since we inherit from IMAPFolder.
|
||||
# See commit 3ce514e92ba7 to know more.
|
||||
self._mb = IMAPFolder(*args, **kwargs)
|
||||
self._mb = IMAPFolder(imapserver, name, repository, decode=False)
|
||||
|
||||
def _getmapfilename(self):
|
||||
return os.path.join(self.repository.getmapdir(),
|
||||
|
Reference in New Issue
Block a user