[Mailman-Developers] [ mailman-Patches-413752 ] Coerce posts to plain text.

noreply@sourceforge.net noreply@sourceforge.net
Tue Nov 19 03:48:34 2002


Patches item #413752, was opened at 2001-04-04 13:23
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=300103&aid=413752&group_id=103

Category: mail delivery
Group: Mailman 2.0.x
Status: Open
Resolution: None
>Priority: 1
Submitted By: Geoffrey T. Dairiki (dairiki)
Assigned to: Nobody/Anonymous (nobody)
Summary: Coerce posts to plain text.

Initial Comment:
This patch adds the ability to have all posts
to a mailing list forced into a MIME text/plain
format.

Many mailing lists have a charter which forbids
binary and HTML posts to the list.  This patch
allows such a charter to be enforced is a
maximally transparent manner.

The feature is configurable on a per-list basis.
If enabled, all posts to the list are run through a 
filter which:

  Squashes multipart messages into a single
flat message (it picks the most plain-text-like
alternative from multipart/alternative entities.)

  Converts 'text/html', 'text/enriched', and
'text/richtext' entities to 'text/plain'.

  Deletes cruft headers from content of type 
'message/rfc822'.

  Deletes any uuencoded files from  'text/plain'
entities.

  Entities of any other types are assumed to
be binary attachements are are deleted.

This patch is on mailman-2.0.3.


----------------------------------------------------------------------

Comment By: Jozeph Brasil (jozeph)
Date: 2002-09-12 13:51

Message:
Logged In: YES 
user_id=17693

Hey dairiki, please... look at
https://sourceforge.net/tracker/index.php?func=detail&aid=608524&group_id=103&atid=100103
I don't know if the problem is plaintext bug! :(

----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2002-08-30 13:16

Message:
Logged In: YES 
user_id=45814

Note also that the recent patch sets also incorporate patch
#415448 [1]: a minor patch so that Mailman recognizes bounce
messages from swbell.net ("Sun Internet Mail Server").

This patch inadvertently slipped in, but it does no harm. 
If you don't like it just delete the patches to
Mailman/Bouncers/SimpleMatch.py.

Reference:
[1] 
http://sf.net/tracker/?func=detail&aid=415448&group_id=103&atid=300103


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2002-08-30 12:07

Message:
Logged In: YES 
user_id=45814

Enh?  The current version of Mailman is 2.0.13.
That said, the latest patch set (named
mailman-2.0.13-plaintext-0.17.patch, and attached below)
will work fine, I think, for Mailmain versions 2.0.x back to
at least 2.0.8, and probably earlier.

Feel free to e-mail me privately for more help. 
<dairiki@dairiki.org>



----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-30 11:02

Message:
Logged In: NO 

I'm new to Mailman. I don't understand why you don't have a 
patch for the current version of Mailman, 2.0.10. Can I apply 
an earlier patch safely?

----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-08-28 00:40

Message:
Logged In: YES 
user_id=12800

BTW, I've finally added that link from the wiki to this patch.

----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2002-08-27 23:44

Message:
Logged In: YES 
user_id=45814

It seems the patches continue to work (basically unchanged)
for Mailman-2.0.13. 

Updated patches are attached below.

The patches as well as a pre-patched Mailman-2.0.13 tarball
are at
  ftp://www.dairiki.org/pub/mailman/



----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-27 20:22

Message:
Logged In: NO 

Hi Dairiki,

It's me... I added your patch in my latest version and it's
running OK... you can post the patch here! :)

----------------------------------------------------------------------

Comment By: Jozeph Brasil (jozeph)
Date: 2002-08-27 15:00

Message:
Logged In: YES 
user_id=17693

Hello dairiki... do you have this patch for Mailman-2.0.13 ?

----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2002-08-13 11:43

Message:
Logged In: YES 
user_id=45814

I don't have strong feelings, but my druthers would be to
wait until 2.1 is officially designated "stable".

A link from the wiki would be great!
(There is/was already a link from the FAQ.)






----------------------------------------------------------------------

Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-08-13 11:29

Message:
Logged In: YES 
user_id=12800

Since this patch is against 2.0.x and since MM2.1 provides
support for stuff like this, I'm inclined to close this
patch.  I'd be willing to add a link to this from the
unofficial patches wiki.  What do you think?

----------------------------------------------------------------------

Comment By: Seb Wills (sebwills)
Date: 2002-02-23 11:20

Message:
Logged In: YES 
user_id=467580

This patch seems to leave any preamble above the first part 
of a multipart message intact. Many mailers put blurb such 
as "This is a MIME-encoded message; you will need a MIME-
aware mail client to see all of this message." here, which 
it makes no sense to reproduce after the mail has be 
coerced into plaintext.

Looks like it's easy enough to change this behaviour by 
commenting out the line

           mimetools.copybinary(infp, outfp) # copy preamble

from Mailman/FilteringMimeWriter.py



----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-12-15 13:15

Message:
Logged In: YES 
user_id=45814

Another bug fix.

  Lines which contain nothing but the word 'end'
mysteriously dissapear.  (Reported by David Gibbs.)

The only changed file in Mailman/FilteringMimeWriter.py,
I've attached the latest version of that file to this page.

As usual, patches on mailman 2.0.8 are also attached.

Diffs and a patched Mailman-2.0.8 tarball are at
  ftp://www.dairiki.org/pub/mailman/


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-09-08 16:08

Message:
Logged In: YES 
user_id=45814

More fixes.

* Mailman/FilteringMimeWriter.py:
    Fixes for bugs in python 1.5.2's quopri library module.

The plaintext patches are at version 0.14.
Look for the patches on Mailman 2.0.6, as well as a complete
tarball of patched Mailman 2.0.6 code at
  ftp://www.dairiki.org/pub/mailman/

Patches on 2.0.6 are also attached to this page.


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-08-25 15:34

Message:
Logged In: YES 
user_id=45814

More fixes:

* Mailman/PlaintextMimeWriter.py:
   Change Message-ID: of filtered messages.

* Mailman/pythonlib/multifile.py:
   Fix obscure but occasionally fatal bug.


The first fix is very minor.  The second fix fixes
a bug which caused the plaintext filter to fail 
occasionally.


Diffs from mailman-2.0.6 are available from this page and
are also at:

ftp://www.dairiki.org/pub/mailman/mailman-2.0.6-plaintext-0.13.patch.gz

Pre-patched mailman-2.0.6 source code is at:

ftp://www.dairiki.org/pub/mailman/mailman-2.0.6-plaintext-0.13.tgz


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-06-16 14:33

Message:
Logged In: NO 

After applying this patch to 2.0.5, I found that I had to 
add this line manually to my existing config file 
$prefix/Mailman/mm_cfg.py...

DEFAULT_FORCE_PLAIN_TEXT = 0

If this line is not added, any web requests and any 
messages posted will produce an error "AttributeError :  
DEFAULT_FORCE_PLAIN_TEXT".

Not sure if I did something wrong or if this is normal, but 
I wanted to advise others just in case

----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-05-19 19:49

Message:
Logged In: YES 
user_id=45814

More fixes:

* Mailman/FilteringMimeWriter.py:  Handle 'content-type:
multipart' (no subtype) gracefully.

* Mailman/Handlers/PlainText.py:  Catch exceptions (fatal
errors) from plaintext filter.   When exception is caught,
an error is logged, but the message is passed on
unfiltered.  (A diagnostic message is added to the message
headers.)  This should make it so little piddly bugs in the
filter will get noticed, but at the same time will not cause
messages to get stuck in the queue.

Patches from mailman-2.0.5 are available from this page and
are also at:

ftp://www.dairiki.org/pub/mailman/mailman-2.0.5-plaintext-0.10.patch.gz

Pre-patched mailman-2.0.5 source code is at:

ftp://www.dairiki.org/pub/mailman/mailman-2.0.5-plaintext-0.10.tgz


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-05-17 15:27

Message:
Logged In: YES 
user_id=45814

Another minor bugfix: it turns out pythons mimetools doesn't
treat the content-transfer-encoding is a case insensitive
fashion --- so now we smash the case ourself.

A new patch set on mailman-2.0.5 is available on this page.
Pre-patched mailman source code can be found at:

ftp://www.dairiki.org/pub/mailman/mailman-2.0.5-plaintext-0.9.tgz


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-05-08 00:38

Message:
Logged In: YES 
user_id=45814

Disregard last.  (Apparently one can't attache files bigger
than 256 kb.)

Mailman-2.0.5 with plaintext patches applied can be found
(for a limited time) at:
 
ftp://www.dairiki.org/pub/mailman/mailman-2.0.5-plaintext-0.8.tgz


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-05-08 00:33

Message:
Logged In: YES 
user_id=45814

If you don't want to mess with patching the source, I've
also attached (below) a tarball of the mailman-2.0.5 source
with my patches already applied.

----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-05-08 00:16

Message:
Logged In: YES 
user_id=45814

Here's a rough outline of how to proceed:

1. Start by unpacking a fresh copy of mailman-2.0.5.tgz
2. Change into the top source directory (which was created
in the previous step.
3. Try applying my patches with:
     patch -p1 <
[where.ever]/mailman-2.0.5-plaintext-0.8.patch
(that's "dash pee one")
That should work --- you should not get any warnings or
prompts from patch.  If you do, something is fishy.
4. Run ./configure and 'make install' as usual (read
mailman's INSTALL for instructions on this.)

Feel free to write me at <dairiki@dairiki.org>.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-05-07 23:30

Message:
Logged In: NO 

For *some* reason when I apply the patch (the newest one) 
to my freshly downloaded version of Mailman 2.0.5 and 
compile and install mail never reaches the list.  I've 
tried without the patch and everything works fine...  
perhaps I'm patching wrong? I'm just saying:

patch < name_of_patch

It makes me fix a few paths to some of the files, but 
that's it... :-/ Any help would be appriciated!

----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-05-07 12:25

Message:
Logged In: YES 
user_id=45814

Fixed bug (reported by Pug Bainter <pug@pug.net> -- thanks!)

New patches,  on mailman-2.0.5 uploaded (below).

The only real change is:

--- 0.5/Mailman/FilteringMimeWriter.py Wed, 04 Apr 2001
10:04:36 -0700 dairiki (mailman/k/4_FilteringM 1.2 664)
+++ 0.8(w)/Mailman/FilteringMimeWriter.py Mon, 07 May 2001
09:05:18 -0700 dairiki (mailman/k/4_FilteringM 1.3 664)
@@ -185,8 +185,12 @@
             pname, pval = string.split(param, '=', 1)
             return (string.lower(pname),
rfc822.unquote(pval))
 
-        return map(split_param, message.getplist())
-
+        def valid_param(param):
+            return '=' in param
+        
+        # Trailing ;'s in content-type yield empty strings
from getplist().
+        return map(split_param,
+                   filter(valid_param, message.getplist()))
 
     def discards_data(fp):
         """Determine whether file object ignores data
written to it.


----------------------------------------------------------------------

Comment By: Geoffrey T. Dairiki (dairiki)
Date: 2001-04-05 11:37

Message:
Logged In: YES 
user_id=45814

I've just made a minor change:

HTML converted to plain-text now includes a list of links at
the end of
the message.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=300103&aid=413752&group_id=103



More information about the Mailman-Developers mailing list