From 7a496275635ac7f3c9250387e830b9b4e1fe9071 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 24 Oct 2004 12:53:44 +0000 Subject: [PATCH] headers decoding is now better --- scripts/mailman/mailman-rpc.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/mailman/mailman-rpc.py b/scripts/mailman/mailman-rpc.py index bd3f76d..a183613 100755 --- a/scripts/mailman/mailman-rpc.py +++ b/scripts/mailman/mailman-rpc.py @@ -18,7 +18,7 @@ #* Foundation, Inc., * #* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * #*************************************************************************** -# $Id: mailman-rpc.py,v 1.64 2004-10-24 08:53:31 x2000habouzit Exp $ +# $Id: mailman-rpc.py,v 1.65 2004-10-24 12:53:44 x2000habouzit Exp $ #*************************************************************************** import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha, signal @@ -119,8 +119,12 @@ def is_admin_on(userdesc,perms,mlist): return ( perms == 'admin' ) or ( userdesc.address in mlist.owner ) -def quote(s): - return Utils.uquote(s.replace('&','&').replace('>','>').replace('<','<')) +def quote(s,is_header=False): + if is_header: + h = Utils.oneline(s,'iso-8859-1') + else: + h = s + return Utils.uquote(h.replace('&','&').replace('>','>').replace('<','<')) #------------------------------------------------------------------------------- # helpers on lists @@ -428,9 +432,9 @@ def get_pending_ops((userdesc,perms),vhost,listname): continue helds.append({ 'id' : id, - 'sender': quote(sender), + 'sender': quote(sender, True), 'size' : size, - 'subj' : quote(subject), + 'subj' : quote(subject, True), 'stamp' : ptime }) if dosave: mlist.Save() @@ -482,9 +486,9 @@ def get_pending_mail((userdesc,perms),vhost,listname,id,raw=0): if c is not None: results.append (c) results = map(lambda x: quote(x), results) return {'id' : id, - 'sender': quote(sender), + 'sender': quote(sender, True), 'size' : size, - 'subj' : quote(subject), + 'subj' : quote(subject, True), 'stamp' : ptime, 'parts' : results } except: -- 2.1.4