/****************************************************************/ /* Sample stage 4 filter for use with Weasel */ /* */ /* This filter takes a copy of the incoming message and */ /* stores the copy in an 'Archive' subdirectory. */ /* */ /* Author: Peter Moylan (peter@pmoylan.org) */ /* Started: 26 October 2000 */ /* Last revised: 16 November 2020 */ /* */ /* Prerequisite: */ /* SelectTNI.cmd and INI_get.cmd, from the GenINI */ /* package, must be in your PATH */ /* */ /* Installation: */ /* Put this file in the directory */ /* containing WEASEL.INI or WEASEL.TNI */ /* Put its name in the 'Filter 4' field of the */ /* 'Filter' page in Setup */ /* Create a subdirectory 'Archive' under the mail root. */ /* Weasel does not need to be restarted to */ /* recognise the change. */ /* */ /****************************************************************/ CALL RxFuncAdd SysLoadFuncs, rexxutil, sysloadfuncs CALL SysLoadFuncs IF SysSearchPath('PATH', 'SelectTNI.cmd') = '' THEN DO SAY "ERROR: SelectTNI.cmd must be in your PATH" EXIT 1 END IF SysSearchPath('PATH', 'INI_get.cmd') = '' THEN DO SAY "ERROR: INI_get.cmd must be in your PATH" EXIT 1 END PARSE ARG namefile messagefile /* Work out where the archive directory is. */ Nul = '00'X IF SelectTNI("Weasel") > 0 THEN INIname = "Weasel.TNI" ELSE INIname = "Weasel.INI" DestDir = INI_get(INIname, '$SYS', 'MailRoot') j = POS(Nul,DestDir) IF j > 0 THEN DestDir = LEFT(DestDir, j-1) DestDir = STRIP(DestDir) DestDir = TRANSLATE(DestDir, '\', '/')||'Archive' /* Generate a file name for the copy. */ DestFile = SysTempFileName( DestDir||'\?????.ARC' ) /* Do the copy. */ '@COPY 'messagefile', 'DestFile /* Return to Weasel with an 'OK' return code. */ RETURN 0