From 5836970d51a19e3db78beb671e90abc7bf9d909b Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Thu, 26 Oct 2017 18:23:15 +0200 Subject: [PATCH] utf8foldernames: fix missing decode argument Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/502 Tested-by: https://github.com/pprw Reviewed-by: Ilias Tsitsimpis Signed-off-by: Nicolas Sebrecht --- offlineimap/folder/Gmail.py | 7 ++++--- offlineimap/repository/Base.py | 10 ++++++++-- offlineimap/repository/Gmail.py | 5 +++-- offlineimap/repository/IMAP.py | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py index f294fd1..c2a2dac 100644 --- a/offlineimap/folder/Gmail.py +++ b/offlineimap/folder/Gmail.py @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # 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 six from sys import exc_info @@ -23,7 +25,6 @@ from offlineimap import imaputil, imaplibutil, OfflineImapError import offlineimap.accounts from .IMAP import IMAPFolder -"""Folder implementation to support features of the Gmail IMAP server.""" class GmailFolder(IMAPFolder): """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 """ - def __init__(self, imapserver, name, repository): - super(GmailFolder, self).__init__(imapserver, name, repository) + def __init__(self, imapserver, name, repository, decode=True): + super(GmailFolder, self).__init__(imapserver, name, repository, decode) # The header under which labels are stored self.labelsheader = self.repository.account.getconf('labelsheader', 'X-Keywords') diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py index 127ea79..2ad7708 100644 --- a/offlineimap/repository/Base.py +++ b/offlineimap/repository/Base.py @@ -1,6 +1,6 @@ """ 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 # 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): 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 def sync_folder_structure(self, local_repo, status_repo): diff --git a/offlineimap/repository/Gmail.py b/offlineimap/repository/Gmail.py index 290cb36..9c6be01 100644 --- a/offlineimap/repository/Gmail.py +++ b/offlineimap/repository/Gmail.py @@ -19,6 +19,7 @@ from offlineimap.repository.IMAP import IMAPRepository from offlineimap import folder, OfflineImapError + class GmailRepository(IMAPRepository): """Gmail IMAP repository. @@ -87,9 +88,9 @@ class GmailRepository(IMAPRepository): def getpreauthtunnel(self): return None - def getfolder(self, foldername): + def getfolder(self, foldername, decode=True): return self.getfoldertype()(self.imapserver, foldername, - self) + self, decode) def getfoldertype(self): return folder.Gmail.GmailFolder diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index e10cd57..8cd2293 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -1,6 +1,6 @@ """ 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 # it under the terms of the GNU General Public License as published by