summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-04 13:05:39 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-04 13:05:39 +0100
commit48ffdcd019de3f1c8c2fe8b704648db8b127662f (patch)
tree78946582cab6f76ee2faccf231ca6021e05f600e /pykolab
parent8dd7946abde86de2ddc99396b22a8486f1fa0519 (diff)
downloadpykolab-48ffdcd019de3f1c8c2fe8b704648db8b127662f.tar.gz
Cherry-pick changes to pykolab/imap/__init__.py from master
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/imap/__init__.py31
1 files changed, 7 insertions, 24 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 7391669..cabd059 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -194,8 +194,7 @@ class IMAP(object):
if self._imap.has_key(server):
del self._imap[server]
else:
- log.warning(_("Called imap.disconnect() on a server that " + \
- "we had no connection to"))
+ log.warning(_("Called imap.disconnect() on a server that we had no connection to."))
def create_folder(self, folder_path, server=None):
if not server == None:
@@ -314,7 +313,7 @@ class IMAP(object):
if folder_name.startswith("shared%s" % (self.imap.separator) * 2):
folder_name = folder_name[7:]
- self.imap._setannotation(folder_name, '/vendor/kolab/folder-type', folder_type)
+ self.set_metadata(folder_name, '/shared/vendor/kolab/folder-type', folder_type)
def shared_mailbox_create(self, mailbox_base_name, server=None):
"""
@@ -402,12 +401,11 @@ class IMAP(object):
if additional_folders[additional_folder].has_key("annotations"):
for annotation in additional_folders[additional_folder]["annotations"].keys():
- if conf.get('kolab', 'imap_backend') == 'cyrus-imap':
- self.imap._setannotation(
- folder_name,
- "%s" % (annotation),
- "%s" % (additional_folders[additional_folder]["annotations"][annotation])
- )
+ self.set_metadata(
+ folder_name,
+ "%s" % (annotation),
+ "%s" % (additional_folders[additional_folder]["annotations"][annotation])
+ )
if additional_folders[additional_folder].has_key("quota"):
self.imap.sq(
@@ -506,15 +504,12 @@ class IMAP(object):
log.warning(_("Moving INBOX folder %s won't succeed as target folder %s already exists") % (old_name,new_name))
def user_mailbox_server(self, mailbox):
- self.connect(domain=self.domain)
return self.imap.find_mailfolder_server(mailbox)
def has_folder(self, folder):
"""
Check if the environment has a folder named folder.
"""
- self.connect(domain=self.domain)
-
folders = self.imap.lm(folder)
log.debug(_("Looking for folder '%s', we found folders: %r") % (folder,folders), level=8)
# Greater then one, this folder may have subfolders.
@@ -564,8 +559,6 @@ class IMAP(object):
""" Blah functions """
def move_user_folders(self, users=[], domain=None):
- self.connect(domain=domain)
-
for user in users:
if type(user) == dict:
if user.has_key('old_mail'):
@@ -595,9 +588,6 @@ class IMAP(object):
Sets the quota in IMAP using the authentication and authorization
database 'quota' attribute for the users listed in parameter 'users'
"""
-
- self.connect(domain=primary_domain)
-
if conf.has_option(primary_domain, 'quota_attribute'):
_quota_attr = conf.get(primary_domain, 'quota_attribute')
else:
@@ -675,8 +665,6 @@ class IMAP(object):
self.imap._setquota(folder, quota)
def set_user_mailhost(self, users=[], primary_domain=None, secondary_domain=[], folders=[]):
- self.connect(domain=primary_domain)
-
if conf.has_option(primary_domain, 'mailserver_attribute'):
_mailserver_attr = conf.get(primary_domain, 'mailserver_attribute')
else:
@@ -724,7 +712,6 @@ class IMAP(object):
auth.set_user_attribute(primary_domain, user, _mailserver_attr, _current_mailserver)
def parse_mailfolder(self, mailfolder):
- self.connect()
return self.imap.parse_mailfolder(mailfolder)
def expunge_user_folders(self, inbox_folders=None):
@@ -745,8 +732,6 @@ class IMAP(object):
primary_domain, secondary_domains
"""
- self.connect()
-
if inbox_folders == None:
inbox_folders = []
@@ -803,8 +788,6 @@ class IMAP(object):
List the INBOX folders in the IMAP backend. Returns a list of unique
base folder names.
"""
- self.connect(domain=primary_domain)
-
_folders = self.imap.lm("user/%")
# TODO: Replace the .* below with a regex representing acceptable DNS
# domain names.