From cbcf7979449b970568c28ab50f3c339bb0f2d4b6 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Tue, 20 Aug 2002 21:54:02 +0100 Subject: [PATCH] /offlineimap/head: changeset 236 Now the containing repository is stored within a folder. This will be necessary for moves. --- offlineimap/head/debian/changelog | 6 ++++++ offlineimap/head/offlineimap/folder/Base.py | 4 ++++ offlineimap/head/offlineimap/folder/IMAP.py | 3 ++- offlineimap/head/offlineimap/folder/LocalStatus.py | 3 ++- offlineimap/head/offlineimap/folder/Maildir.py | 3 ++- offlineimap/head/offlineimap/repository/IMAP.py | 6 +++--- offlineimap/head/offlineimap/repository/LocalStatus.py | 5 +++-- offlineimap/head/offlineimap/repository/Maildir.py | 4 ++-- 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/offlineimap/head/debian/changelog b/offlineimap/head/debian/changelog index 88f135a..83d26ed 100644 --- a/offlineimap/head/debian/changelog +++ b/offlineimap/head/debian/changelog @@ -1,3 +1,9 @@ +offlineimap (3.3.0) unstable; urgency=low + + * Placeholder + + -- John Goerzen Tue, 20 Aug 2002 10:46:56 -0500 + offlineimap (3.2.6) unstable; urgency=low * Changed indentation in debian/control. Closes: #156327. diff --git a/offlineimap/head/offlineimap/folder/Base.py b/offlineimap/head/offlineimap/folder/Base.py index 8c25aef..6c1e577 100644 --- a/offlineimap/head/offlineimap/folder/Base.py +++ b/offlineimap/head/offlineimap/folder/Base.py @@ -50,6 +50,10 @@ class BaseFolder: def getvisiblename(self): return self.name + def getrepository(self): + """Returns the repository object that this folder is within.""" + return self.repository + def getroot(self): """Returns the root of the folder, in a folder-specific fashion.""" return self.root diff --git a/offlineimap/head/offlineimap/folder/IMAP.py b/offlineimap/head/offlineimap/folder/IMAP.py index 5c35d67..c660436 100644 --- a/offlineimap/head/offlineimap/folder/IMAP.py +++ b/offlineimap/head/offlineimap/folder/IMAP.py @@ -25,7 +25,7 @@ from copy import copy import __main__ class IMAPFolder(BaseFolder): - def __init__(self, imapserver, name, visiblename, accountname): + def __init__(self, imapserver, name, visiblename, accountname, repository): self.name = imaputil.dequote(name) self.root = None # imapserver.root self.sep = imapserver.delim @@ -33,6 +33,7 @@ class IMAPFolder(BaseFolder): self.messagelist = None self.visiblename = visiblename self.accountname = accountname + self.repository = repository def suggeststhreads(self): return 1 diff --git a/offlineimap/head/offlineimap/folder/LocalStatus.py b/offlineimap/head/offlineimap/folder/LocalStatus.py index acaa28a..4f479f9 100644 --- a/offlineimap/head/offlineimap/folder/LocalStatus.py +++ b/offlineimap/head/offlineimap/folder/LocalStatus.py @@ -22,12 +22,13 @@ import os magicline = "OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1" class LocalStatusFolder(BaseFolder): - def __init__(self, root, name): + def __init__(self, root, name, repository): self.name = name self.root = root self.sep = '.' self.filename = os.path.join(root, name) self.messagelist = None + self.repository = repository def storesmessages(self): return 0 diff --git a/offlineimap/head/offlineimap/folder/Maildir.py b/offlineimap/head/offlineimap/folder/Maildir.py index 70d4df4..29c0db1 100644 --- a/offlineimap/head/offlineimap/folder/Maildir.py +++ b/offlineimap/head/offlineimap/folder/Maildir.py @@ -39,12 +39,13 @@ def gettimeseq(): return timeseq class MaildirFolder(BaseFolder): - def __init__(self, root, name, sep): + def __init__(self, root, name, sep, repository): self.name = name self.root = root self.sep = sep self.uidfilename = os.path.join(self.getfullname(), "offlineimap.uidvalidity") self.messagelist = None + self.repository = repository def getfullname(self): return os.path.join(self.getroot(), self.getname()) diff --git a/offlineimap/head/offlineimap/repository/IMAP.py b/offlineimap/head/offlineimap/repository/IMAP.py index 6af8158..9371d0d 100644 --- a/offlineimap/head/offlineimap/repository/IMAP.py +++ b/offlineimap/head/offlineimap/repository/IMAP.py @@ -48,7 +48,7 @@ class IMAPRepository(BaseRepository): def getfolder(self, foldername): return folder.IMAP.IMAPFolder(self.imapserver, foldername, self.nametrans(foldername), - accountname) + accountname, self) def getfolders(self): if self.folders != None: @@ -69,11 +69,11 @@ class IMAPRepository(BaseRepository): continue retval.append(folder.IMAP.IMAPFolder(self.imapserver, foldername, self.nametrans(foldername), - self.accountname)) + self.accountname, self)) for foldername in self.folderincludes: retval.append(folder.IMAP.IMAPFolder(self.imapserver, foldername, self.nametrans(foldername), - self.accountname)) + self.accountname, self)) retval.sort(lambda x, y: self.foldersort(x.getvisiblename(), y.getvisiblename())) self.folders = retval return retval diff --git a/offlineimap/head/offlineimap/repository/LocalStatus.py b/offlineimap/head/offlineimap/repository/LocalStatus.py index 5a864d8..4d3caaa 100644 --- a/offlineimap/head/offlineimap/repository/LocalStatus.py +++ b/offlineimap/head/offlineimap/repository/LocalStatus.py @@ -42,11 +42,12 @@ class LocalStatusRepository(BaseRepository): retval = [] for folder in os.listdir(self.directory): retval.append(folder.LocalStatus.LocalStatusFolder(self.directory, - folder)) + folder, self)) return retval def getfolder(self, foldername): - return folder.LocalStatus.LocalStatusFolder(self.directory, foldername) + return folder.LocalStatus.LocalStatusFolder(self.directory, foldername, + self) diff --git a/offlineimap/head/offlineimap/repository/Maildir.py b/offlineimap/head/offlineimap/repository/Maildir.py index fa97b3c..af099bb 100644 --- a/offlineimap/head/offlineimap/repository/Maildir.py +++ b/offlineimap/head/offlineimap/repository/Maildir.py @@ -87,7 +87,7 @@ class MaildirRepository(BaseRepository): def getfolder(self, foldername): return folder.Maildir.MaildirFolder(self.root, foldername, - self.getsep()) + self.getsep(), self) def _getfolders_scandir(self, root, extension = None): self.debug("_GETFOLDERS_SCANDIR STARTING. root = %s, extension = %s" \ @@ -131,7 +131,7 @@ class MaildirRepository(BaseRepository): self.debug(" foldername = %s" % foldername) retval.append(folder.Maildir.MaildirFolder(self.root, foldername, - self.getsep())) + self.getsep(), self)) if self.getsep() == '/': # Check sub-directories for folders. retval.extend(self._getfolders_scandir(root, foldername))