From b5167c9f0cd6dabcc47133b0f9869909baadd5c0 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Wed, 19 Jun 2002 06:55:12 +0100 Subject: [PATCH] /head: changeset 7 *** empty log message *** --- head/offlineimap/folder/Maildir.py | 28 ++++++++++++++++++++++++++++ head/offlineimap/repository/IMAP.py | 4 ++++ 2 files changed, 32 insertions(+) create mode 100644 head/offlineimap/folder/Maildir.py diff --git a/head/offlineimap/folder/Maildir.py b/head/offlineimap/folder/Maildir.py new file mode 100644 index 0000000..0274055 --- /dev/null +++ b/head/offlineimap/folder/Maildir.py @@ -0,0 +1,28 @@ +# IMAP folder support +# Copyright (C) 2002 John Goerzen +# +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from Base import BaseFolder +from imapsync import imaputil + +class IMAPFolder(BaseFolder): + def __init__(self, imapserver, name): + self.name = imaputil.dequote(name) + self.root = imapserver.root + self.sep = imapserver.delim + self.imapserver = imapserver + diff --git a/head/offlineimap/repository/IMAP.py b/head/offlineimap/repository/IMAP.py index c354b59..f6f2c5c 100644 --- a/head/offlineimap/repository/IMAP.py +++ b/head/offlineimap/repository/IMAP.py @@ -25,12 +25,16 @@ class IMAPRepository(BaseRepository): object.""" self.imapserver = imapserver self.imapobj = imapserver.makeconnection() + self.folders = None def getfolders(self): + if self.folders != None: + return self.folders retval = [] for string in self.imapobj.list(self.imapserver.root)[1]: flags, delim, name = imaputil.imapsplit(string) if '\\Noselect' in imaputil.flagsplit(flags): continue retval.append(folder.IMAP.IMAPFolder(self.imapserver, name)) + self.folders = retval return retval