/*
 *   Imp Master Config Editor
 *  The Ultimate Imp-Master Util
 *
 *      (C)1995 Steve Pearson
 *
 *      This is Tailor-Ware
 *     Edit it as you NEED it
 *
 * Just leave my Name somewhere in it =)
 *
 *    $VER: Imp Master Config V1 (28.6.95)
 *
 */

address Spot
Options results

preff="mail:imp.pref"
lf='0d'x
nl='0a'x

/******************************************************************/

if ~open('Prefs',preff,'r') then do
	'requestresponse TITLE "Imp Master Config Editor" Prompt "You Have No Prefs" GADGETS "Create|Abort"'
	if rc=1 then do
		call open(prefs,preff,'w')
		writeln(prefs,"Imp Master V1")
		'getusername'
		writeln(prefs,"NAME "result)
		writeln(prefs,"---"||nl)
		call close(prefs)
		call open('Prefs',preff,'r')
	end
	if rc=0 then exit
end

FORMAT=READLN('Prefs');
IF ~(FORMAT='Imp Master V1') then do
	'RequestNotify TITLE "Imp Master" PROMPT "Prefs File Incompatibility.'lf'There has been a MAJOR change in Prefs Format'lf'Please Delete your Prefs" center'
	Exit
end

/* Initial Prefs Variabes */
yname=''
yaddr=''
rarea=''
uuxc=''

/* Process Prefs File Init Data */

do until (line='---' | eof('Prefs'))
	line = readln('Prefs')
	action = upper(subword(line,1,1))
	if action = 'NAME' then do
		YNAME=strip(substr(line,pos('NAME',line)+5,length(line)),'B')
	end
	if action = 'ADDRESS' then do
		YADDR=strip(substr(line,pos('ADDRESS',line)+8,length(line)),'B')
	end
	if action = 'REPORT' then do
		rarea=strip(substr(line,pos('REPORT',line)+7,length(line)),'B')
	end
	if action = 'UUDECODE' then do
		uuxc=strip(substr(line,pos('UUDECODE',line)+9,length(line)),'B')
	end
end


/* Check Integrity of Init Pref data */
/* Get User correction where nexessary */

if eof('Prefs') then do
	'RequestNotify TITLE "Imp Master" PROMPT "Prefs File Error EOF to early"'
	Exit
end

do until yname~=""
	'requeststring TITLE "Imp Master Config" Prompt "Enter Your Name" default "'yname'"'
	yname=result
	if yname="RESULT" then yname=""
end
do until yaddr~=""
	'requeststring TITLE "Imp Master Config" Prompt "Enter Your Netmail Address" default "'yaddr'"'
	yaddr=result
        if yaddr="RESULT" then yaddr=""
end

'getareaname'
store=result
'gotoarea 'rarea

do until wibble=0
	'requestarea TITLE "Post Report In"'
	rarea=result
	wibble=rc
end

'gotoarea 'store

do until uuxc~=""
	'requeststring TITLE "Imp Master Config" Prompt "Enter Your UUdecode Command" default "'uuxc'"'
	uuxc=result
	IF UUXC="RESULT" then uuxc=""
end

/* Now build tempfiles of the rest of the prefs files */

pos=seek('Prefs',0,'C')

fsize=seek('Prefs',0,'E')

call seek('Prefs',pos,'B')

line=""


'progressopen TITLE "Imp Config Ed - Parsing Prefs" Prompt "0% 'substr(line,1,30)'"'

progdat=result

line="Initial Prefs Data"

pcent=(((pos/fsize)*100)%1)
'progressupdate REQ "'progdat'" CURRENT "'pos'" TOTAL "'fsize'" Prompt "'pcent'% 'substr(line,1,30)'"'


do until eof('Prefs')
        line=readln('Prefs')


	if line~="" then do

		pos=seek('Prefs',0,'C')
		pcent=(((pos/fsize)*100)%1)
		'progressupdate REQ "'progdat'" CURRENT "'pos'" TOTAL "'fsize'" Prompt "'pcent'% 'substr(line,1,30)'"'
                if rc=5 then do
			'progressclose 'progdat
			address command
			'c:delete "t:list-#?" all >nil:'
			address spot
			exit
		end

		action=substr(line,1,3)
                select
			when action='RRR' then do
				area=strip(subword(line,2,1))
        			call addlist(area',RRR, ')
                        end

			when action='GMA' then do
				area=strip(subword(line,2,1))
        			call addlist(area',GMA, ')
                        end
                        when action='EMF' then do
				area=strip(subword(line,2,1))
        			call addlist(area',EMF, ')
                        end
			when action='QLA' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				call addlist(area','action'-'lid','lid)
			end
			when action='GMS' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end
			when action='QLS' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				subj=strip(upper(substr(line,pos(lid,line)+length(lid)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)'-'substr(lid,1,12)','lid'*n'subj)
			end
			when action='GMM' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end
			when action='QLM' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				subj=strip(upper(substr(line,pos(lid,line)+length(lid)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)'-'substr(lid,1,12)','lid'*n'subj)
			end
			when action='INT' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end
			when action='QLI' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				subj=strip(upper(substr(line,pos(lid,line)+length(lid)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)'-'substr(lid,1,12)','lid'*n'subj)
			end
			when action='GMF' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end
			when action='QLF' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				subj=strip(upper(substr(line,pos(lid,line)+length(lid)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)'-'substr(lid,1,12)','lid'*n'subj)
			end
			when action='UUD' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)','subj)
			end
			when action='QLD' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				subj=strip(upper(substr(line,pos(lid,line)+length(lid)+1,length(line))),'B')
				call addlist(area','action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)'-'substr(lid,1,12)','lid'*n'subj)
			end
			when action='NNA' then do
				area=strip(subword(line,2,1))
				call addlist(area','action', ')
			end
			when action='NFA' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end
			when action='MLH' then do
				area=strip(subword(line,2,1))
				subj=strip(upper(substr(line,pos(AREA,line)+length(area)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end
			when action='PNR' then do
				area=strip(subword(line,2,1))
				lid=strip(subword(line,3,1))
				subj=strip(upper(substr(line,pos(lid,line)+length(lid)+1,length(line))),'B')
				call addlist(area','action'-'substr(subj,1,12)'-'substr(lid,1,12)','lid'*n'subj)
			end
			when action='COU' then do
				area=strip(subword(line,2,1))
                                subj=strip(subword(line,3,1))
				call addlist(area','action'-'substr(subj,1,12)','subj)
			end

			otherwise nop
		end


	end
end

'progressclose 'progdat

address command
'c:makedir t:list-Actions >nil:'

address spot

call addlist('Actions,GMA - Give Me All,.')
call addlist('Actions,RRR - Receipt Request Reply,.')
call addlist('Actions,QLA - Quick List All,.')

call addlist('Actions,GMS - Give Me Subject,.')
call addlist('Actions,QLS - Quick List Subject,.')

call addlist('Actions,GMM - Give Me Mention,.')
call addlist('Actions,QLM - Quick List Mention,.')

call addlist('Actions,INT - Intercept Mail,.')
call addlist('Actions,QLI - Quick List Intercept,.')

call addlist('Actions,GMF - GIve me From,.')
call addlist('Actions,QLF - Quick List From,.')

call addlist('Actions,UUD - UUdecodes from an area.,.')
call addlist('Actions,QLD - Quick List UUdecodes,.')

call addlist('Actions,NNA - Nuke Not All,.')
call addlist('Actions,NFA - Nuke From Address,.')
call addlist('Actions,MLH - Mailing List Handler,.')
call addlist('Actions,PNR - Process Net Request,.')
call addlist('Actions,COU - Clear Old Unreplied,.')
call addlist('Actions,EMF - Email From,.')
call close('Prefs')


cancelled=0

do until cancelled

	'requestarea TITLE "Edit Which Area"'
	if rc=5 then cancelled=1
	if rc~=5 then do
		edarea=result
		piccan=0
		do until piccan=1
	                fname=picklist(edarea)
			if ~((substr(strip(fname),1,3)="CAN")|(substr(strip(fname),1,1)="-")) then do
	                        if upper(substr(strip(fname),1,3))="ADD" then do
					action=substr(picklist(Actions),1,3)
					select
						when action='RRR' then do
							address command
							'echo "" noline > "t:list-'edarea'/'action'"'
							address spot
						end
						when action='GMA' then do
							address command
							'echo "" noline > "t:list-'edarea'/'action'"'
							address spot
						end
						when action='EMF' then do
							address command
							'echo "" noline > "t:list-'edarea'/'action'"'
							address spot
						end

						when action='QLA' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "List-ID"'
							lid=result
							address command
							'echo "'lid'" noline > "t:list-'edarea'/'action'-'lid'"'
							address spot
						end
						when action='GMS' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Subject :"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
							address spot
						end
						when action='QLS' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Subject :"'
							subj=result
                                                        'requeststring TITLE "Imp-Config" Prompt "List ID :"'
							LID=result
							address command
							'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
							address spot
						end
						when action='GMM' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Mention :"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
							address spot
						end
						when action='QLM' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Mention :"'
							subj=result
                                                        'requeststring TITLE "Imp-Config" Prompt "List ID :"'
							LID=result
							address command
							'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
							address spot
						end
						when action='INT' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Intercept :"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
							address spot
						end
						when action='QLI' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Intercept :"'
							subj=result
                                                        'requeststring TITLE "Imp-Config" Prompt "List ID :"'
							LID=result
							address command
							'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
							address spot
						end
						when action='GMF' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "From :"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
							address spot
						end
						when action='QLF' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "From :"'
							subj=result
                                                        'requeststring TITLE "Imp-Config" Prompt "List ID :"'
							LID=result
							address command
							'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
							address spot
						end


						when action='UUD' then do
                                                        'requestpath TITLE "Decode To" Path "Mail:"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)'"'
							address spot
						end
						when action='QLD' then do
                                                        'requestpath TITLE "Decode To" Path "Mail:"'
							subj=result
                                                        'requeststring TITLE "Imp-Config" Prompt "List ID :"'
							LID=result
							address command
							'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)'-'substr(lid,1,12)'"'
							address spot
						end

						when action='NNA' then do
							address command
							'echo "" noline > "t:list-'edarea'/'action'"'
							address spot
						end
						when action='NFA' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "From Address:"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'"'
							address spot
						end

 						when action='MLH' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Mailing List ID"'
							subj=result
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'"'
							address spot
						end

						when action='PNR' then do
                                                        'requeststring TITLE "Imp-Config" Prompt "Req ID :"'
							LID=result
                                                        'requestfile TITLE "Post File" Path "Mail:"'
							subj=result
							address command
							'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)'-'substr(lid,1,12)'"'
							address spot
						end
                                                when action='COU' then do
                                                        'requestresponse TITLE "Imp-Config" prompt "Keep Personal Mail?" Gadgets "_Keep|_Trash"'
							if rc=0 then subj='CLEARPERSONAL'
							if rc=1 then subj='KEEPPERSONAL'
							address command
							'echo "'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'"'
							address spot
						end

						otherwise nop
					end
				end
				if ~(upper(substr(strip(fname),1,3))="ADD") then do
					action=substr(fNAME,1,3)
                                        select
						when action="RRR" then do
							'requestresponse Title "Imp-Config" Prompt "RRR - Receipt Request Reply" GADGETS "Remove|Abort"'
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/RRA" >nil:'
								address spot
							end

						end
						when action="GMA" then do
							'requestresponse Title "Imp-Config" Prompt "GMA - Give Me All" GADGETS "Remove|Abort"'
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/GMA" >nil:'
								address spot
							end

						end
						when action="EMF" then do
							'requestresponse Title "Imp-Config" Prompt "EMF - Email From" GADGETS "Remove|Abort"'
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/EMF" >nil:'
								address spot
							end

						end
						when action="QLA" then do
							'requestresponse Title "Imp-Config" Prompt "QLA - Quick List All" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								lid=readln('temp')
                                        call close('temp')
								'requeststring Title "Imp-Config" Prompt "List ID :" Default "'lid'"'
								lid=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'lid'" noline > "t:list-'edarea'/'action'-'lid'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end
						when action="GMS" then do
							'requestresponse Title "Imp-Config" Prompt "GMS - Give Me Subject" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								subj=readln('temp')
                                        call close('temp')
								'requeststring Title "Imp-Config" Prompt "Subject :" Default "'Subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="QLS" then do
							'requestresponse Title "Imp-Config" Prompt "QLS - Quick List Subject" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								lid=readln('temp')
								subj=readln('temp')
                                        call close('temp')
								'requeststring Title "Imp-Config" Prompt "Subject :" Default "'Subj'"'
								subj=result
								'requeststring Title "Imp-Config" Prompt "List ID :" Default "'lid'"'
								lid=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="GMM" then do
							'requestresponse Title "Imp-Config" Prompt "GMM - Give Me Mention" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Mention :" Default "'Subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="QLM" then do
							'requestresponse Title "Imp-Config" Prompt "QLM - Quick List Mention" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								lid=readln('temp')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Mention :" Default "'Subj'"'
								subj=result
								'requeststring Title "Imp-Config" Prompt "List ID :" Default "'lid'"'
								lid=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="INT" then do
							'requestresponse Title "Imp-Config" Prompt "INT - Intercept" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Intercept :" Default "'Subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="QLI" then do
							'requestresponse Title "Imp-Config" Prompt "QLI - Quick List Intercept" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								lid=readln('temp')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Intercept :" Default "'Subj'"'
								subj=result
								'requeststring Title "Imp-Config" Prompt "List ID :" Default "'lid'"'
								lid=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end


						when action="UUD" then do
							'requestresponse Title "Imp-Config" Prompt "UUD - UUDecode" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								subj=readln('temp')
								call close('temp')
								'requestpath Title "Decode To"  path "'Subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="QLD" then do
							'requestresponse Title "Imp-Config" Prompt "QLD - Quick List Decode" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								lid=readln('temp')
								subj=readln('temp')
								call close('temp')
								'requestpath Title "Decode To" path "'Subj'"'
								subj=result
								'requeststring Title "Imp-Config" Prompt "List ID :" Default "'lid'"'
								lid=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(strip(compress(subj,":/\*#?()"||'27'x||'22'x)),1,12)'-'substr(lid,1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="NNA" then do
							'requestresponse Title "Imp-Config" Prompt "NNA - Nuke Not All" GADGETS "Remove|Abort"'
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/NNA" >nil:'
								address spot
							end

						end

						when action="NFA" then do
							'requestresponse Title "Imp-Config" Prompt "NFA - Nuke From Address" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Address :" Default "'Subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="MLH" then do
							'requestresponse Title "Imp-Config" Prompt "MLH - Mailing List Handler" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Mailing List ID :" Default "'Subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'subj'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						when action="PNR" then do
							'requestresponse Title "Imp-Config" Prompt "PNR - Post Net Request" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
								call open('temp','t:list-'edarea'/'fname,'r')
								lid=readln('temp')
								subj=readln('temp')
								call close('temp')
								'requeststring Title "Imp-Config" Prompt "Req ID :" Default "'lid'"'
								lid=result
								'requestfile Title "Imp-Config" Prompt "File To Post" file "'subj'"'
								subj=result
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'lid'*n'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'-'substr(lid,1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

                                                when action="COU" then do
							'requestresponse Title "Imp-Config" Prompt "COU - Clear Old Unreplied" Gadgets "Remove|Edit|Abort"'
							if rc=2 then do
	                                                        'requestresponse TITLE "Imp-Config" prompt "Keep Personal Mail?" Gadgets "_Keep|_Trash"'
								if rc=0 then subj='CLEARPERSONAL'
								if rc=1 then subj='KEEPPERSONAL'
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								'echo "'subj'" noline > "t:list-'edarea'/'action'-'substr(subj,1,12)'"'
								address spot
							end
							if rc=1 then do
								address command
								'c:delete "t:list-'edarea'/'fname'" >nil:'
								address spot
 							end
						end

						otherwise nop
					end
				end

			end
			if ((substr(strip(fname),1,1)="C")|(substr(strip(fname),1,1)="-")) then piccan=1
		end
	end
end

call open('prefs',preff,'w')

call writeln('prefs','Imp Master V1')
call writeln('prefs','')
call writeln('prefs','* Initial Data for Imp Master')
call writeln('prefs','')
call writeln('prefs','NAME 'yname)
call writeln('prefs','ADDRESS 'yaddr)
call writeln('prefs','REPORT 'rarea)
call writeln('prefs','UUDECODE 'uuxc)
call writeln('prefs','---')

address command

'c:list t:list-~(Actions)/~(#?Add?Process#?|#?Cancel#?|?#-) lformat "%p%n" > t:Areastodo'

address spot

call open(atd,'t:areastodo','r')

area=""


pos=seek(atd,0,'C')

fsize=seek(atd,0,'E')

call seek(atd,pos,'B')

oline=""


'progressopen TITLE "Imp Config Ed - Writing Prefs" Prompt "0% 'substr(oline,1,30)'"'
progdat=result

do until eof(atd)
	line=readln(atd)
	if line~="" then do

		pos=seek(atd,0,'C')
		pcent=(((pos/fsize)*100)%1)
		'progressupdate REQ "'progdat'" CURRENT "'pos'" TOTAL "'fsize'" Prompt "'pcent'% 'substr(oline,1,30)'"'
		wibble=rc
                if wibble>0 then do
			'requestresponse title "Imp Config" Prompt "Aborting Now Will Corrupt Prefs!" Gadgets "ABORT!|Cancel"'
			if rc=1 then do
                                'progressclose' progdat
				call close('prefs')
				call close(atd)

				address command

				'c:delete "t:list-#?" all >nil:'
				'c:delete "t:areastodo" >nil:'

				address spot

                                exit
			end
		end

		lastarea=area
		area=substr(line,pos("list-",line)+5,lastpos("/",line)-pos("list-",line)-5)
		if area~=lastarea then Call writeln('prefs',nl||"* Actions For Area "||area||nl)
		action=substr(line,lastpos("/",line)+1,3)
		call open(timp,line,'r')
		extras=""
		do until eof(timp)
			xline=readln(timp)
			if xline~="" then extras=extras||xline||" "
		end
		call close(timp)
		if xline~="" then xline=substr(xline,1,length(xline)-1)
		oline=action||" "||area||" "||extras
		call writeln('prefs',oline)
	end

end

call writeln('prefs','---')
call writeln('prefs','Created By ImpEd.Spot (C) 1995 Steven Pearson 2:250/563.12')


'progressclose 'progdat

call close('prefs')
call close(atd)

address command

'c:delete "t:list-#?" all >nil:'
'c:delete "t:areastodo" >nil:'

address spot

exit
/***************************************************************************/
/* A generic list requester                                                */
/***************************************************************************/

newlist: procedure
	parse arg area
	address command
	'c:makedir t:list-'area' >NIL:'
        address spot
	call addlist(area',         Add Process,ADD')
	call addlist(area',         Cancel,CANCEL')
	call addlist(area', ----------------------------,CANCEL')
return


deletelist: procedure

	parse arg area
	address command
	'delete t:list-'area' all >NIL:'
	address spot
return


addlist: procedure
	parse arg area ',' name ',' ltw

	if ~exists("t:list-"area) then call newlist(area)
	address command
	'echo "'ltw'" noline >"t:list-'area'/'name'"'
	address spot
return


picklist: procedure
	parse arg area

	if ~exists("t:list-"area) then call newlist(area)
	'requestfile title "Select Action" path t:list-'area
	name=result
	if rc>0 then name='CANCEL'

	separator=lastpos('/',name)
	if separator=0 then separator=lastpos(':',name)
	if separator=0 then basename=name
	else basename=substr(name,separator+1)

return basename
