FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » maillist.php wrapper to maintain formatted text email
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
icon2.gif  maillist.php wrapper to maintain formatted text email [message #11664] Thu, 10 July 2003 23:54
kaelff is currently offline  kaelff   United States
Messages: 2
Registered: June 2003
Karma:
Junior Member
We use fud to track lists that have a lot of formatted text: like columns, code and stuff generated on the UNIX command line. When sent to the BBS by mail all the whitespace is compressed.

This has been a real pain in the wazoo for us and although I spent a few hrs hacking the fud code, I found no joy there. An earlier post to this forum was met with the response: wrap the message in
[code][/code]
tags. This I already knew, but I was hoping that there was a setting for this in fud.


Here is a wrapper in python that takes the message on stdin and passes it to the fud maillist.php script.

The first argument to the script should be the same as the code you would normally pass to maillist.php to specify the correct forum.

This works with normal 1-part all text email. With multi-part mime messages the first part is "code" wrapped and the other parts are untouched.

I hope someone finds it useful - substitute the name of this script for the mailist.php script.

#!/usr/local/bin/python
#
# 	$Id: remoteMaillistWrapper.py,v 1.3 2003/07/10 23:17:11 hhfud Exp $	
#
#
import sys,os,re,os.path

# change this path as necessary ###
fudScriptPath = '/usr/local/share/doc/apache/forum/scripts'
###

fudMailListCmd = os.path.join(fudScriptPath,'maillist.php')

fudListCode = sys.argv[1]


boundary = re.compile('boundary="(.+)"')

headersDone = 0
codeStart = 0
codeEnd = 0
boundaryLine = None

out = ''
inputL = 0
while inputL != '':
    inputL = sys.stdin.readline()
    if not headersDone:
        bMatch = boundary.search(inputL)
        if bMatch :
            boundaryLine =  '--' + bMatch.group(1) + '\n'
        if inputL == '\n':
            headersDone = 1
            if not boundaryLine:
                inputL = '\n[code]\n'
                codeStart = 1
    else:
        if not codeEnd:
            if not codeStart:
                if inputL == boundaryLine:
                    while inputL != '\n':
                        out = out + inputL
                        inputL = sys.stdin.readline()

                    codeStart = 1
                    inputL = inputL + '[code]\n'
            else:
                if inputL == boundaryLine or inputL == '':
                    codeEnd = 1
                    inputL = '[/code]\n' + inputL

    out = out + inputL

cmd = os.popen(fudMailListCmd + ' ' + fudListCode,'w')
cmd.write(out)
sys.exit(cmd.close())


[/CODE]
[Message index]
 
Read Message icon2.gif
Previous Topic: Online stauts icon
Next Topic: I deleted GLOBALS.php
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 00:32:36 GMT 2024

Total time taken to generate the page: 0.04459 seconds