utf8foldernames: fix missing decode argument

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/502
Tested-by: https://github.com/pprw
Reviewed-by: Ilias Tsitsimpis <i.tsitsimpis@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2017-10-26 18:23:15 +02:00
parent a79263bb31
commit 5836970d51
4 changed files with 16 additions and 8 deletions

View File

@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""Folder implementation to support features of the Gmail IMAP server."""
import re import re
import six import six
from sys import exc_info from sys import exc_info
@ -23,7 +25,6 @@ from offlineimap import imaputil, imaplibutil, OfflineImapError
import offlineimap.accounts import offlineimap.accounts
from .IMAP import IMAPFolder from .IMAP import IMAPFolder
"""Folder implementation to support features of the Gmail IMAP server."""
class GmailFolder(IMAPFolder): class GmailFolder(IMAPFolder):
"""Folder implementation to support features of the Gmail IMAP server. """Folder implementation to support features of the Gmail IMAP server.
@ -41,8 +42,8 @@ class GmailFolder(IMAPFolder):
https://developers.google.com/google-apps/gmail/imap_extensions https://developers.google.com/google-apps/gmail/imap_extensions
""" """
def __init__(self, imapserver, name, repository): def __init__(self, imapserver, name, repository, decode=True):
super(GmailFolder, self).__init__(imapserver, name, repository) super(GmailFolder, self).__init__(imapserver, name, repository, decode)
# The header under which labels are stored # The header under which labels are stored
self.labelsheader = self.repository.account.getconf('labelsheader', 'X-Keywords') self.labelsheader = self.repository.account.getconf('labelsheader', 'X-Keywords')

View File

@ -1,6 +1,6 @@
""" Base repository support """ """ Base repository support """
# Copyright (C) 2002-2016 John Goerzen & contributors # Copyright (C) 2002-2017 John Goerzen & contributors
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -165,7 +165,13 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
def deletefolder(self, foldername): def deletefolder(self, foldername):
raise NotImplementedError raise NotImplementedError
def getfolder(self, foldername): def getfolder(self, foldername, decode=True):
"""Get the folder for this repo.
WARNING: the signature changes whether it's remote or local:
- remote types have the decode arg
- local types don't have the decode arg
"""
raise NotImplementedError raise NotImplementedError
def sync_folder_structure(self, local_repo, status_repo): def sync_folder_structure(self, local_repo, status_repo):

View File

@ -19,6 +19,7 @@
from offlineimap.repository.IMAP import IMAPRepository from offlineimap.repository.IMAP import IMAPRepository
from offlineimap import folder, OfflineImapError from offlineimap import folder, OfflineImapError
class GmailRepository(IMAPRepository): class GmailRepository(IMAPRepository):
"""Gmail IMAP repository. """Gmail IMAP repository.
@ -87,9 +88,9 @@ class GmailRepository(IMAPRepository):
def getpreauthtunnel(self): def getpreauthtunnel(self):
return None return None
def getfolder(self, foldername): def getfolder(self, foldername, decode=True):
return self.getfoldertype()(self.imapserver, foldername, return self.getfoldertype()(self.imapserver, foldername,
self) self, decode)
def getfoldertype(self): def getfoldertype(self):
return folder.Gmail.GmailFolder return folder.Gmail.GmailFolder

View File

@ -1,6 +1,6 @@
""" IMAP repository support """ """ IMAP repository support """
# Copyright (C) 2002-2016 John Goerzen & contributors # Copyright (C) 2002-2017 John Goerzen & contributors
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by