Change locale to fr_FR.UTF-8
[platal.git] / bin / lists.rpc.py
index 36245de..671b365 100755 (executable)
@@ -171,7 +171,7 @@ def quote(s, is_header=False):
         h = Utils.oneline(s, 'iso-8859-1')
     else:
         h = s
-    h = str('').join(re.split('[\x00-\x09\x0B-\x1f]+', h))
+    h = str('').join(re.split('[\x00-\x08\x0B-\x1f]+', h))
     return Utils.uquote(h.replace('&', '&amp;').replace('>', '&gt;').replace('<', '&lt;')) 
 
 def to_forlife(email):
@@ -576,7 +576,7 @@ def get_pending_mail(userdesc, perms, vhost, listname, id, raw=0):
         mlist.Unlock()
 
         if raw:
-            return str(msg)
+            return quote(str(msg))
         results_plain = []
         results_html  = []
         for part in typed_subpart_iterator(msg, 'text', 'plain'):
@@ -657,11 +657,15 @@ def get_bogo_level(userdesc, perms, vhost, listname):
             return 0
         if mlist.header_filter_rules == []:
             return 0
-        action = mlist.header_filter_rules[0][1]
-        if action == mm_cfg.HOLD:
-            return 1
-        if action == mm_cfg.DISCARD:
+        try:
+            action = mlist.header_filter_rules[1][1]
             return 2
+        except:
+            action = mlist.header_filter_rules[0][1]
+            if action == mm_cfg.HOLD:
+                return 1
+            if action == mm_cfg.DISCARD:
+                return 3
     except:
         return 0
 
@@ -677,6 +681,9 @@ def set_bogo_level(userdesc, perms, vhost, listname, level):
         if int(level) is 1:
             hfr.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False))
         elif int(level) is 2:
+            hfr.append(('X-Spam-Flag: Yes, tests=bogofilter, spamicity=(0\.999999|1\.000000)', mm_cfg.DISCARD, False))
+            hfr.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False))
+        elif int(level) is 3:
             hfr.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.DISCARD, False))
         if mlist.header_filter_rules != hfr:
             mlist.Lock()
@@ -751,8 +758,9 @@ check_opts = {
 }
 
 def check_options(userdesc, perms, vhost, listname, correct=False):
+    listname = listname.lower()
     try:
-        mlist = MailList.MailList(vhost+VHOST_SEP+listname.lower(), lock=0)
+        mlist = MailList.MailList(vhost+VHOST_SEP+listname, lock=0)
     except:
         return 0
     try: