#CREATE TABLE userpref (
#  username varchar(100) NOT NULL default '',
#  preference varchar(50) NOT NULL default '',
#  value varchar(100) NOT NULL default '',
#  prefid int(11) NOT NULL auto_increment,
#  PRIMARY KEY  (prefid),
#  KEY username (username)
#) TYPE=MyISAM;

DEBUG_LEVEL=4
LANG=['sk_SK']
CHROOT='/var/spool/vscan'
LOGFILE=CHROOT+'/var/log/sagator/sagator.log'
USER,GROUP='vscan','vscan'
SMTP_SERVER=('127.0.0.1',26)
from scanners import *
from srv import *

# bo se nam to jinak pousti mockrat
CLAMAV=b2f(libclam(limits={'maxratio':9999}))

DB_ENGINE=db.MySQLdb(host='127.0.0.1',port=3306,dbname='sagator',
                     dbuser='sagator',dbpasswd='xxxxx')

E2I_SCANNERS={
  '': # DEFAULT
      log_sql(DB_ENGINE,log_sql.FORMAT,
        status("Virus",
          quarantine('/tmp/quarantine/vir/%Y%m','', CLAMAV)
        ),
        status("Spam",
          drop('.',
            quarantine('/tmp/quarantine/spam/%Y%m','',
              spamassassind(
                ['localhost',783],
                virtual_users=".",
                filter=True,
                reqspamlevel=20
              )
            )
          )
        )
      ),

  '99': # 99 don't delete spams
        log_sql(DB_ENGINE,log_sql.FORMAT,
          status("Virus",
            quarantine('/tmp/quarantine/vir/%Y%m','', CLAMAV)
          ),
          status("Spam",
            drop('.',
              quarantine('/tmp/quarantine/spam/%Y%m','',
                spamassassind(
                  ['localhost',783],
                  virtual_users=".",
                  filter=True,
                  reqspamlevel=99
                )
              )
            )
          )
        )
}

for x in range(4,14):
  E2I_SCANNERS[str(x)]= \
    log_sql(DB_ENGINE,log_sql.FORMAT,
      status("Virus",
        quarantine('/tmp/quarantine/vir/%Y%m','', CLAMAV)
      ),
      status("Spam",
        drop('.',
          quarantine('/tmp/quarantine/spam/%Y%m','',
            spamassassind(
              ['localhost',783],
              virtual_users=".",
              filter=True,
              reqspamlevel=x
            )
          )
        )
      )
    )

SRV=[
    rlimit(AS=100*MB),
    #collector('127.0.0.1',28),
    lmtpd(
       [sql_find(
           'recipient',
           db.MySQLdb(host='127.0.0.1',port=3306,dbname='spamassassin',
                      dbuser='sagator',dbpasswd='xxxxx'),
           "SELECT value FROM userpref" \
             " WHERE username=%s and preference='drop_spam'" \
             " LIMIT 1",
           E2I_SCANNERS
       )],
       '127.0.0.1',27,8
    )
]
