/****************************************************************/ /* Filter for use with Weasel */ /* */ /* This filter adds one or more extra header lines to the */ /* mail item being processed. In this version, the extra */ /* lines are hard-coded - you change them by editing the */ /* first few lines of the source code. */ /* */ /* Author: Peter Moylan (peter@ee.newcastle.edu.au) */ /* Started: 15 January 2004 */ /* Last revised: 15 January 2004 */ /* */ /****************************************************************/ /*******************************************************/ /* DEFINITION OF THE EXTRA HEADER LINES */ ExtraHeaders.0 = 2 ExtraHeaders.1 = "X-Sample-Header: hello" ExtraHeaders.2 = "X-Interesting: slightly" /* NOTE THAT ExtraHeaders.0 SAYS HOW MANY LINES TO ADD */ /*******************************************************/ CALL RxFuncAdd SysLoadFuncs, rexxutil, sysloadfuncs CALL SysLoadFuncs PARSE ARG userlist SrcFile SrcFile = STRIP(SrcFile) SrcFile = TRANSLATE(SrcFile, '\', '/') /* Generate a file name for the copy. */ DstFile = SysTempFileName( '?????.TMP' ) /* Copy SrcFile to DstFile, until we reach the end of the existing headers. */ InHeader = 1 found = 0 DO WHILE InHeader /* Each time around this loop we look at one line of */ /* the header. */ line = LineIn(SrcFile) IF line = "" THEN InHeader = 0 ELSE IF (LEFT(line,1) = ' ') | (LEFT(line,1) = '09'X) THEN DO /* Continuation line */ CALL LineOut DstFile, line END ELSE DO /* Normal header line */ CALL LineOut DstFile, line END END /* Add our new header lines. */ k = 1 DO WHILE k <= ExtraHeaders.0 CALL LineOut DstFile, ExtraHeaders.k k = k + 1 END /* Terminate headers with a blank line. */ CALL LineOut DstFile, "" /* Copy the remainder of the source file to the destination. */ DO WHILE Lines(SrcFile) > 0 CALL LineOut DstFile, LineIn(SrcFile) END CALL stream SrcFile, 'C', 'CLOSE' CALL stream DstFile, 'C', 'CLOSE' /* Replace the source file by the destination file. */ '@DEL 'SrcFile '@COPY 'DstFile' 'SrcFile' >nul' '@DEL 'DstFile /* Return to Weasel with an 'OK' return code. */ RETURN 0