summaryrefslogtreecommitdiffstats
path: root/pykolab/imap
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-12 15:38:03 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-02-12 15:38:03 +0100
commita07c9bbf99eaf8f6337101cafa559af0e11b8671 (patch)
tree839939a6d3cd5a6ce37149a4b02e4554d2743ba8 /pykolab/imap
parent78bbd216e3b7c2d2338450a4cc332f79fc751deb (diff)
downloadpykolab-a07c9bbf99eaf8f6337101cafa559af0e11b8671.tar.gz
Make sure a shared folder with an inbound address can be delivered mail to
Diffstat (limited to 'pykolab/imap')
-rw-r--r--pykolab/imap/__init__.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 9995292..fbe515d 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -328,6 +328,36 @@ class IMAP(object):
if short_rights.has_key(acl):
acl = short_rights[acl]
+ # Special treatment for '-' and '+' characters
+ if '+' in acl or '-' in acl:
+ acl_map = {
+ 'set': '',
+ 'subtract': '',
+ 'add': ''
+ }
+
+ mode = 'set'
+ for char in acl:
+ if char == '-':
+ mode = 'subtract'
+ continue
+ if char == '+':
+ continue
+ mode = 'add'
+
+ acl_map[mode] += char
+
+ current_acls = self.imap.lam(self.folder_utf7(folder))
+ for current_acl in current_acls.keys():
+ if current_acl == identifier:
+ _acl = current_acls[current_acl]
+ break
+
+ _acl = _acl + acl_map['set'] + acl_map['add']
+
+ _acl = [x for x in _acl.split() if x not in acl_map['subtract'].split()]
+ acl = ''.join(list(set(_acl)))
+
self.imap.sam(self.folder_utf7(folder), identifier, acl)
def set_metadata(self, folder, metadata_path, metadata_value, shared=True):