Khalil Abbas wrote:
>
>my suggestion is, before I had the honor to use outlook I had Smartermail .. 
>they have a cool feature of approving messages with passwords is to use it in 
>the subject line itself : "[password: PASSWORD] Subject bla bla bla"..  then 
>it removes the password part of course ..
>
> 
>
>why don't you guys do the same? it sure beats adding a custom header and stuff 
>.. because in html messages it's really hard to do that !!


We do. Just not in the subject.

As long as the incoming message has a text/plain part (i.e. is either a
text/plain message or a multipart/alternative message with a
text/plain alternative, we recognize and delete "Approved: passord" if
it is the first non-blank line of the body. We also attempt to delete
the line from any other body parts in which it appears, but in
pathological cases, this may fail, so test first.

If your clients insist on posting HTML only messages and can't add an
actual Approved: header to the message, then you can try patching
Mailman/Handlers/Approve.py to recognize "[Approved: password]" in the
Subject: header. The attached Approve.patch.txt file contains a patch
that might do it.

I'll consider this as a feature for Mailman 2.2

-- 
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

--- Approve.py  2009-08-01 16:54:01.561348900 -0700
+++ Approvex.py 2009-08-06 13:33:24.000000000 -0700
@@ -25,8 +25,10 @@
 
 import re
 
+from email.Header import Header
 from email.Iterators import typed_subpart_iterator
 
+from Mailman import Utils
 from Mailman import mm_cfg
 from Mailman import Errors
 
@@ -38,6 +40,7 @@
     False = 0
 
 NL = '\n'
+PWDRE = re.compile(r'\[Approved?:\s*([^\]\s]+)\s*\]', re.IGNORECASE)
 
 
 
@@ -57,6 +60,23 @@
     missing = []
     passwd = msg.get('approved', msg.get('approve', missing))
     if passwd is missing:
+        # Try the Subject header first
+        subj = Utils.oneline(msg.get('subject'), 'utf-8')
+        if subj:
+            mo = PWDRE.search(subj)
+            if mo:
+                passwd = mo.group(1)
+                del msg['subject']
+                subj = PWDRE.sub('', subj)
+                try:
+                    # Is the subject ascii?
+                    unicode(subj, 'us-ascii')
+                except UnicodeError:
+                    # It's not, encode it
+                    msg['Subject'] = Header(subj, 'utf-8')
+                else:
+                    msg['Subject'] = subj
+    if passwd is missing:
         # Find the first text/plain part in the message
         part = None
         stripped = False
------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to