3 commits - .gitignore pykolab/cli

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Nov 20 15:38:09 CET 2012


 .gitignore                           |    2 
 pykolab/cli/cmd_list_mailbox_acls.py |    2 
 pykolab/cli/sieve/cmd_refresh.py     |   76 +++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+)

New commits:
commit bf04f0b8c40843b92b709efaf5bb041996b7cb16
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Nov 20 14:37:53 2012 +0000

    Add vacation support to sieve script management refresh

diff --git a/pykolab/cli/sieve/cmd_refresh.py b/pykolab/cli/sieve/cmd_refresh.py
index 038a762..33fd427 100644
--- a/pykolab/cli/sieve/cmd_refresh.py
+++ b/pykolab/cli/sieve/cmd_refresh.py
@@ -110,6 +110,44 @@ def execute(*args, **kw):
     user = auth.get_entry_attributes(domain, user, ['*'])
 
     #
+    # Vacation settings (a.k.a. Out of Office)
+    #
+    vacation_active = None
+    vacation_text = None
+    vacation_uce = None
+    vacation_noreact_domains = None
+
+    vacation_active_attr = conf.get('sieve', 'vacation_active_attr')
+    vacation_text_attr = conf.get('sieve', 'vacation_text_attr')
+    vacation_uce_attr = conf.get('sieve', 'vacation_uce_attr')
+    vacation_noreact_domains_attr = conf.get('sieve', 'vacation_noreact_domains_attr')
+
+    if not vacation_text_attr == None:
+
+        if user.has_key(vacation_active_attr):
+            vacation_active = utils.true_or_false(user[vacation_active_attr])
+        else:
+            vacation_active = False
+
+        if user.has_key(vacation_text_attr):
+            vacation_text = user[vacation_text_attr]
+        else:
+            vacation_active = False
+
+        if user.has_key(vacation_uce_attr):
+            vacation_uce = utils.true_or_false(user[vacation_uce_attr])
+        else:
+            vacation_uce = False
+
+        if user.has_key(vacation_noreact_domains_attr):
+            if isinstance(user[vacation_noreact_domains_attr], list):
+                vacation_noreact_domains = user[vacation_noreact_domains_attr]
+            else:
+                vacation_noreact_domains = [ user[vacation_noreact_domains_attr] ]
+        else:
+            vacation_noreact_domains = []
+
+    #
     # Delivery to Folder
     #
     dtf_active_attr = conf.get('sieve', 'deliver_to_folder_active')
@@ -191,6 +229,10 @@ def execute(*args, **kw):
             else:
                 forward_uce = False
 
+    if vacation_active:
+        mgmt_required_extensions.append('vacation')
+        mgmt_required_extensions.append('envelope')
+
     if dtf_active:
         mgmt_required_extensions.append('fileinto')
 
@@ -207,6 +249,40 @@ def execute(*args, **kw):
     for required_extension in mgmt_required_extensions:
         mgmt_script.require(required_extension)
 
+    if vacation_active:
+        if len(vacation_noreact_domains) > 0:
+            mgmt_script.addfilter(
+                    'vacation',
+                    [('not', ('envelope', ':domain', ":is", "from", vacation_noreact_domains))],
+                    [
+                            (
+                                    "vacation",
+                                    ":days", 1,
+                                    ":subject",
+                                    "Out of Office",
+                                    # ":handle", see http://tools.ietf.org/html/rfc5230#page-4
+                                    # ":mime", to indicate the reason is in fact MIME
+                                    vacation_text
+                                )
+                        ]
+                )
+        else:
+            mgmt_script.addfilter(
+                    'vacation',
+                    [('true',)],
+                    [
+                            (
+                                    "vacation",
+                                    ":days", 1,
+                                    ":subject",
+                                    "Out of Office",
+                                    # ":handle", see http://tools.ietf.org/html/rfc5230#page-4
+                                    # ":mime", to indicate the reason is in fact MIME
+                                    vacation_text
+                                )
+                        ]
+                )
+
     if forward_active:
         forward_rules = []
 


commit 5a35bb644903e850fb539710f9b20361e167cc98
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Nov 20 14:18:19 2012 +0000

    Ignore *.orig and *.rej

diff --git a/.gitignore b/.gitignore
index dab7375..7c1de8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,10 @@ Makefile.in
 *~
 *.kate-swp
 *.log
+*.orig
 *.pyc
 *.pyo
+*.rej
 *.spec
 *.tar.gz
 aclocal.m4


commit 307880dfd4a986fa690c56aa3ebc9dccc152fc40
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Nov 20 14:17:13 2012 +0000

    import sys (#1317)

diff --git a/pykolab/cli/cmd_list_mailbox_acls.py b/pykolab/cli/cmd_list_mailbox_acls.py
index 7f4a9fc..62bac4f 100644
--- a/pykolab/cli/cmd_list_mailbox_acls.py
+++ b/pykolab/cli/cmd_list_mailbox_acls.py
@@ -17,6 +17,8 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+import sys
+
 import commands
 
 import pykolab





More information about the commits mailing list