summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-22 17:29:07 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-22 17:29:07 +0000
commit20976669015cde7e31319a9e727a4d0750690cc8 (patch)
tree992e68464fa9c95d955660c22a3eebf8d65603de /pykolab
parenteedfa8cd189cbde571788bb3a46f79fc54fdd823 (diff)
downloadpykolab-20976669015cde7e31319a9e727a4d0750690cc8.tar.gz
Add delivery to folder sieve rule (#1519)
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/cli/sieve/cmd_refresh.py3
-rw-r--r--pykolab/plugins/sievemgmt/__init__.py17
2 files changed, 13 insertions, 7 deletions
diff --git a/pykolab/cli/sieve/cmd_refresh.py b/pykolab/cli/sieve/cmd_refresh.py
index 8d5703f..91e19cb 100644
--- a/pykolab/cli/sieve/cmd_refresh.py
+++ b/pykolab/cli/sieve/cmd_refresh.py
@@ -349,6 +349,9 @@ def execute(*args, **kw):
if sdf_filter:
mgmt_script.addfilter('spam_delivery_folder', [("X-Spam-Status", ":matches", "Yes,*")], [("fileinto", "INBOX/Spam"), ("stop")])
+ if dtf_active:
+ mgmt_script.addfilter('delivery_to_folder', ['true'], [("fileinto", dtf_folder)])
+
mgmt_script = mgmt_script.__str__()
log.debug(_("MANAGEMENT Script contents: %r") % (mgmt_script), level=9)
diff --git a/pykolab/plugins/sievemgmt/__init__.py b/pykolab/plugins/sievemgmt/__init__.py
index e87381c..9a47423 100644
--- a/pykolab/plugins/sievemgmt/__init__.py
+++ b/pykolab/plugins/sievemgmt/__init__.py
@@ -362,14 +362,17 @@ class KolabSievemgmt(object):
if sdf_filter:
mgmt_script.addfilter('spam_delivery_folder', [("X-Spam-Status", ":matches", "Yes,*")], [("fileinto", "INBOX/Spam"), ("stop")])
+ if dtf_active:
+ mgmt_script.addfilter('delivery_to_folder', ['true'], [("fileinto", dtf_folder)])
+
mgmt_script = mgmt_script.__str__()
result = sieveclient.putscript("MANAGEMENT", mgmt_script)
if not result:
print "Putting in script MANAGEMENT failed...?"
- else:
- print "Putting in script MANAGEMENT succeeded"
+ #else:
+ #print "Putting in script MANAGEMENT succeeded"
user_script = """#
# User
@@ -380,7 +383,7 @@ require ["include"];
for script in scripts:
if not script in [ "MASTER", "MANAGEMENT", "USER" ]:
- print "Including script %s in USER" % (script)
+ #print "Including script %s in USER" % (script)
user_script = """%s
include :personal "%s";
@@ -389,8 +392,8 @@ include :personal "%s";
result = sieveclient.putscript("USER", user_script)
if not result:
print "Putting in script USER failed...?"
- else:
- print "Putting in script USER succeeded"
+ #else:
+ #print "Putting in script USER succeeded"
result = sieveclient.putscript("MASTER", """#
# MASTER
@@ -419,8 +422,8 @@ include :personal "USER";
if not result:
print "Putting in script MASTER failed...?"
- else:
- print "Putting in script MASTER succeeded"
+ #else:
+ #print "Putting in script MASTER succeeded"
sieveclient.setactive("MASTER")