/* $VER: UnMime.thor 3.1 (17.12.1994) * * Arexx script to convert mime quoted-printable mail messages to * readable text. Assumes charset=iso-8859-1. * * Will convert the current message when executed from Thor. The * result will be shown in the message listview. * * Disclaimer: This script is made without any knowledge of MIME * encoded messages. :-) * * Known bugs: Not as speedy as it should have been. :-) * * Script by: Eivind Nordseth, Ultima Thule Software. */ /* trace results */ parse arg filename TRUE = 1 FALSE = 0 if filename = '' then do if(substr(address(),1,4) ~= "THOR") then do parse arg thorport if~(show(p, thorport)) then do if ~(show(p, "THOR.01")) then do say "No THOR port found!" exit end else thorport = "THOR.01" end end else thorport = address() thor = TRUE filename = 't:unmime.tmp' outfile = 't:unmime.out.tmp' address command 'delete >nil:' filename if(~open('out', outfile, 'Write')) then do say 'Failed to open file temp file' exit end address(thorport) SAVEMESSAGE CURRENT FILE filename noheader if(rc ~= 0) then do REQUESTNOTIFY TEXT '"Not able to save current message."' BT '"_Ok"' exit end end else thor = FALSE if(~open('fh', filename, 'Read')) then do say 'Failed to open file' exit end outline = '' do until eof('fh') aline = readln('fh') donewline = TRUE linelen = length(aline) do n = 1 to linelen char = substr(aline, n, 1) if char = '=' then do select when n = linelen then do donewline = FALSE end when substr(aline, n + 1, 1) = '=' then do outline = outline || '=' n = n + 1 end otherwise do outline = outline || x2c(substr(aline, n + 1, 2)) n = n + 2 end end end else outline = outline || char end if donewline then do if thor then call writeln('out', outline) else say outline outline = '' end end call close('fh') if thor then do call close('out') SHOWTEXT outfile CURRENTMSGTEXT if(rc ~= 0) then do REQUESTNOTIFY TEXT '"Not able to show the converted message."' BT '"_Ok"' exit end end