'''
config helper for sagator
 
(c) 2003-2005 Jan ONDREJ (SAL) <ondrejj(at)salstar.sk>
                                                                                
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
'''

# All scanners included here

from av import *
from as import *
from interscan import *
from stats import status
import db

def SIMPLE_SCANNERS(av,as,
    notify_admin=[],
    notify_sender=False,
    notify_recipients=False,
    deliverto=[],
    quarantine=False,
    quarantine_dir='/tmp/quarantine',
    admin_msg=report.MSG_TMPL,
    recipients_msg=report.MSG_TMPL
  ):
  if notify_sender:
    drop_pattern='(worm|@mm)'
  else:
    drop_pattern='.'
  if notify_recipients:
    my_report_recipients=report_recipients
  else:
    my_report_recipients=nothing
  if quarantine:
    my_quarantine=quarantine
  else:
    my_quarantine=nothing
  return [\
    status("Virus",
      deliver_to(deliverto,
        report(notify_admin,admin_msg,
          my_report_recipients(recipients_msg,
            my_quarantine(quarantine_dir,'',
              drop(drop_pattern,
                av
              )
            )
          )
        )
      )
    ),
    status("Spam",
      deliver_to(deliverto,
        report(notify_admin,admin_msg,
          my_report_recipients(recipients_msg,
            my_quarantine(quarantine_dir,'',
              drop(drop_pattern,
                as
              )
            )
          )
        )
      )
    )
  ]
