home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
comm
/
ems-1.0.lha
/
EMS
/
Rexx
/
DMreply.ems
< prev
next >
Wrap
Text File
|
1993-08-30
|
45KB
|
1,591 lines
/***************/
/* DMreply.ems */
/**********************/
/* Commands: */
/* */
/* EDIT 1 */
/* EDIT_FILE 2 */
/* WRITE 3 */
/* WRITE_FILE 4 */
/* REPLY 5 */
/* REPLY_FORWARD 6 */
/* REPLY_MULTISEND 7 */
/* FORWARD 8 */
/* MULTISEND 9 */
/* RESEND 10 */
/* ARCHIVE 11 */
/* CONFIG 12 */
/* */
/* ASK */
/**********************/
/* Arguments */
/* */
/* NO_REQS */
/* CARBON_COPY */
/* REPLY_KLUDGES */
/* CHOOSE_OPENING */
/* CHOOSE_COD */
/* CHOOSE_SIGNATURE */
/* CHOOSE_ORIGIN */
/**************************************/
/* $VER: DMreply.ems 1.0 (29.08.93) */
/**************************************/
script_name = 'DMreply'
script_version = 'v1.0'
options results
signal on error
signal on syntax
parse arg session_number src_area msg_num cmd_name cmd_args
cmd_args = strip( cmd_args, 'B' )
if( ~show( 'l', "rexxsupport.library" ) ) then
do
if( ~addlib( "rexxsupport.library", 0, -30, 0 ) )then
do
say "Could not open rexxsupport.library"
exit 10
end
end
if( ~show( 'l', "ems_rexx.library" ) ) then
do
if( ~addlib( "ems_rexx.library", 0, -30, 0 ) )then
do
say "Could not open ems_rexx.library"
exit 10
end
end
if datatype( session_number, 'N' ) ~= 1 then signal Usage
if datatype( msg_num , 'N' ) ~= 1 then signal Usage
if src_area = '' then signal Usage
reply_cfg. = ''
dst_areas.0 = 0
carbon_copy_name.0 = 0
carbon_copy_addr.0 = 0
/*
** Search for areas of type MAIL
*/
call EMS_Areas_Mail( 'areas_mail' )
cmd_num = ParseCommand( src_area, cmd_name, cmd_args )
if cmd_num = 0 then signal ScriptExit
mask = Local_Cfg_Get( 'Cmd_AskAreas' )
if mask = 0 then
do
call EMS_Add_To_Stem( 'dst_areas', src_area )
end
if mask = 1 then
do
if EMS_Area_Select( 'area' ) = 'OK' then call EMS_Add_To_Stem( 'dst_areas', area )
end
if mask = 2 then
do
area = ''
do while EMS_Area_Select( 'area' ) = 'OK'
call EMS_Add_To_Stem( 'dst_areas', area ); area = ''
end
end
if Local_Cfg_GetBit( 'Cmd_Actions', 'Carbon_Copy' ) = 'TRUE' then
do
addr = ''
do while EMS_User_Select( 'name', 'addr' ) = 'OK'
call EMS_Add_To_Stem( 'carbon_copy_name', name )
call EMS_Add_To_Stem( 'carbon_copy_addr', addr )
addr = ''
end
end
/* No areas where to write. */
if dst_areas.0 = 0 then signal ScriptExit
if cmd_num = 12 then /* CONFIG */
do
if Local_Cfg_GetBit( 'Cmd_Actions', 'Insert_Opening' ) = 'TRUE' then
do
call ChooseOpening( src_area, 'TRUE' )
if Local_Cfg_Get( 'Req_Failed' ) = 'TRUE' then signal ScriptExit
end
if Local_Cfg_GetBit( 'Cmd_Actions', 'Insert_Signature' ) = 'TRUE' then
do
call ChooseSignature( src_area, 'TRUE' )
if Local_Cfg_Get( 'Req_Failed' ) = 'TRUE' then signal ScriptExit
end
if Local_Cfg_GetBit( 'Cmd_Actions', 'Insert_COD' ) = 'TRUE' then
do
call ChooseCOD( src_area, 'TRUE' )
if Local_Cfg_Get( 'Req_Failed' ) = 'TRUE' then signal ScriptExit
end
call Global_Cfg_Set( src_area, 'ReplyKludges' , Local_Cfg_Get( 'Cfg_ReplyKludges' ) )
call Global_Cfg_Set( src_area, 'Opening' , Local_Cfg_Get( 'Cfg_Opening' ) )
call Global_Cfg_Set( src_area, 'Signature' , Local_Cfg_Get( 'Cfg_Signature' ) )
call Global_Cfg_Set( src_area, 'COD' , Local_Cfg_Get( 'Cfg_COD' ) )
call Global_Cfg_Set( src_area, 'ChooseOpening' , Local_Cfg_Get( 'Cfg_ChooseOpening' ) )
call Global_Cfg_Set( src_area, 'ChooseSignature' , Local_Cfg_Get( 'Cfg_ChooseSignature' ) )
call Global_Cfg_Set( src_area, 'ChooseCOD' , Local_Cfg_Get( 'Cfg_ChooseCOD' ) )
call Global_Cfg_Set( src_area, 'ChooseOrigin' , Local_Cfg_Get( 'Cfg_ChooseOrigin' ) )
call Global_Cfg_Set( src_area, 'NoDomainInOrigin', Local_Cfg_Get( 'Cfg_NoDomainInOrigin' ) )
signal ScriptExit
end
file = EMS_Var_Local( 'SCRIPT_MSG_FILE' )
if session_number ~= 0 then file = file || session_number
call Local_Cfg_Set( 'Msg_File' , file )
call Local_Cfg_Set( 'Sysop_Name', EMS_Var_Local( 'SYSOP_NAME' ) )
if Local_Cfg_GetBit( 'Cmd_Actions', 'Read_Old_Msg' ) = 'FALSE' then msg_num = 0
/*
** Read the message to act on.
*/
sel = ''
if cmd_num = 2 | cmd_num = 4 then
do
if EMS_Area_File_DBname( src_area ) ~= '' then sel = 'FILE'
end
else
do
if EMS_Area_Msg_DBname( src_area ) ~= '' then sel = 'MSG'
end
if sel = '' then
do
call EMS_Do_Request( "Can't exec requested command (wrong database)!" )
signal ScriptExit
end
if msg_num ~= 0 then call EMS_Item_Alloc( 'reply_msg', src_area, sel, msg_num )
else call EMS_Item_Alloc( 'reply_msg', src_area, sel )
call Local_Cfg_Set( 'Header_From' , EMS_Item_Header_From( 'reply_msg' ) )
call Local_Cfg_Set( 'Header_To' , EMS_Item_Header_To( 'reply_msg' ) )
call Local_Cfg_Set( 'Header_Subject' , EMS_Item_Header_Subject( 'reply_msg' ) )
call Local_Cfg_Set( 'Header_Date' , EMS_Item_Header_Date_Created( 'reply_msg' ) )
call Local_Cfg_Set( 'Header_Addr_From', EMS_Item_Header_Address_From( 'reply_msg' ) )
call Local_Cfg_Set( 'Header_Addr_To' , EMS_Item_Header_Address_To( 'reply_msg' ) )
area_name = dst_areas.1
call DeleteMsgFile( file )
if cmd_num = 11 then /* ARCHIVE */
do
mode.0 = 4
mode.1 = 'Default'
mode.2 = 'File (APPEND)'
mode.3 = 'File (OVERWRITE)'
mode.4 = 'Printer'
sel = 1
res = EMS_Do_Choice_Single( 'Archive Message As', 'mode', 'sel' )
if res ~= 'OK' then signal ScriptExit
textDir = EMS_Var_Local( 'SCRIPT_TEXT_DIR' ); if textDir = '' then textDir = 'EMS:'
arcfile = ''
if sel = 4 then arcfile = 'prt:'
if sel = 2 | sel = 3 then
do
arcfile = textDir
saved_CD = PRAGMA( 'D' )
call PRAGMA( 'D', textDir )
res = EMS_File_Select( 'Select Archive File', 'arcfile' )
call PRAGMA( 'D', saved_CD )
if res ~= 'OK' then signal ScriptExit
if arcfile = '' then sel = 1
end
if arcfile = '' then arcfile = textDir || src_area || '.txt'
if sel = 3 | sel = 4 then file_mode = 'WRITE'
else file_mode = 'APPEND'
if file_mode = 'APPEND' & exists( arcfile ) ~= 1 then file_mode = 'WRITE'
if open( 'tempname', arcfile, file_mode ) ~= 1 then
do
say "| Can't open '" || arcfile || "' file for output."
call ScriptExit
end
from = overlay( EMS_Item_Header_From( 'reply_msg' ), ' ' )
addfrom = EMS_Item_Header_Address_From( 'reply_msg' )
to = overlay( EMS_Item_Header_To( 'reply_msg' ), ' ' )
addto = EMS_Item_Header_Address_To( 'reply_msg' )
subject = EMS_Item_Header_Subject( 'reply_msg' )
date = overlay( EMS_Item_Header_Date_Created( 'reply_msg' ), ' ' )
call writeln( 'tempname', " " )
call writeln( 'tempname', "-------------------------- Archived Message ---------------------------" )
call writeln( 'tempname', "From :" || from || ' at ' || addfrom )
call writeln( 'tempname', "To :" || to || ' at ' || addto )
call writeln( 'tempname', "Subject:" || subject )
call writeln( 'tempname', "Date :" || date || ' Area : ' || src_area )
call writeln( 'tempname', "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" )
call close( 'tempname' )
call EMS_Item_File_Write( 'reply_msg', 'text', arc