/****************************************************************/ /* Filter for use with Weasel */ /* */ /* Filter for use with SpamAssassin (www.spamassassin.org */ /* SpamAssassin needs to be installed as per INSTALL in */ /* the .zip file from the website */ /* */ /* sa_learn.cmd can be used to teach SA */ /* */ /* Author: Paul Smedley (paul@smedley.info) */ /* Started: 23 September 2003 */ /* Last revised: 23 September 2003 */ /* */ /* Installation: */ /* Put this file in the directory containing WEASEL.INI */ /* Put its name in the 'Filter 4' line in the 'Filters' */ /* page in Setup. */ /* Weasel needs to be restarted to recognise the change. */ /* */ /****************************************************************/ PARSE ARG userlist SrcFile CALL RxFuncAdd SysLoadFuncs, rexxutil, sysLoadFuncs CALL SysLoadFuncs CALL SysFileTree SrcFile, 'files.' parse value DELWORD(files.1,4) with files.1 parse value DELWORD(files.1,1,2) with files.1 say files.1 IF files.1 >256000 THEN RETURN 0 ELSE DO date=date() time=time() DstFile = SysTempFileName('?????.TMP') 'perl e:\perllib\bin\spamassassin <' SrcFile '>' DstFile '@DEL 'SrcFile '@COPY 'DstFile' 'SrcFile' >nul' '@del 'DstFile ok = 0 do until ok = 1 parse value LINEIN(SrcFile) with spamscore if subword(spamscore,1,1) = 'X-Spam-Status:' then ok = 1 end rc = stream('SrcFile','c','close') /* Grabs Spam Assassin score from the line containing "X-Spam-Status: Yes" */ parse value DELWORD(spamscore,4) with spamscore parse value DELWORD(spamscore,1,2) with spamscore parse value DELSTR(spamscore,1,5) with spamscore IF spamscore >= 15 then RETURN 3 IF spamscore <15 then RETURN 0 END