From 9578f291959a5762ed157a16a461853f2d51ed58 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 30 Sep 2011 16:53:18 +0200 Subject: [PATCH] Use 'reference' value when creating an IMAP directory A repositories 'reference value is always prefixed to the full folder path, so we should do so when creating a new one. The code had existed but was commented out since 2003, I guess the "reference" option is not too often used. Signed-off-by: Sebastian Spaeth --- offlineimap/folder/IMAP.py | 3 +-- offlineimap/repository/IMAP.py | 16 +++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 8dbd7aa..58ff633 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -1,6 +1,5 @@ # IMAP folder support -# Copyright (C) 2002-2007 John Goerzen -# +# Copyright (C) 2002-2011 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 diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 2d2962f..4c2cadd 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -1,6 +1,5 @@ # IMAP repository support -# Copyright (C) 2002 John Goerzen -# +# Copyright (C) 2002-2011 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 @@ -171,7 +170,7 @@ class IMAPRepository(BaseRepository): return self.getconf('preauthtunnel', None) def getreference(self): - return self.getconf('reference', '""') + return self.getconf('reference', '') def getidlefolders(self): localeval = self.localeval @@ -316,14 +315,9 @@ class IMAPRepository(BaseRepository): when you are done creating folders yourself. :param foldername: Full path of the folder to be created.""" - #TODO: IMHO this existing commented out code is correct and - #should be enabled, but this would change the behavior for - #existing configurations who have a 'reference' set on a Mapped - #IMAP server....: - #if self.getreference() != '""': - # newname = self.getreference() + self.getsep() + foldername - #else: - # newname = foldername + if self.getreference(): + foldername = self.getreference() + self.getsep() + foldername + imapobj = self.imapserver.acquireconnection() try: self.ui._msg("Creating new IMAP folder '%s' on server %s" %\