config_query DSPAM_GD     'Use gd for pretty graphs?' n  &&

config_query_option DSPAM_OPTS 'Enable debug mode?' n \
                               '--enable-debug --enable-bnr-debug' \
                               '--disable-debug --disable-bnr-debug' &&

if list_find "$DSPAM_OPTS" "--enable-debug"; then
  config_query_option DSPAM_OPTS 'Enable verbose debug mode?' n \
                                 '--enable-verbose-debug' \
                                 '--disable-verbose-debug'
else
  DSPAM_OPTS="--disable-verbose-debug $DSPAM_OPTS"
fi &&

config_query_option DSPAM_OPTS 'Enable daemon mode?' y \
                               '--enable-daemon' \
                               '--disable-daemon' &&

config_query_option DSPAM_OPTS 'Enable preferences extension?' y \
                               '--enable-preferences-extension' \
                               '--disable-preferences-extension' &&

config_query_option DSPAM_OPTS 'Enable trusted user security?' y \
                               '--enable-trusted-user-security' \
                               '--disable-trusted-user-security' &&

config_query_option DSPAM_OPTS 'Enable split configuration file support?' y \
                               '--enable-split-configuration' \
                               '--disable-split-configuration' &&

config_query_option DSPAM_OPTS 'Enable long usernames? (defaults to system length)' y \
                               '--enable-long-usernames' \
                               '--disable-long-usernames' &&

config_query_option DSPAM_OPTS 'Enable performance profiling?' n \
                               '--enable-profiling' \
                               '--disable-profiling' &&

config_query_list DSPAM_SCALE 'Select a filesystem organization method:' \
                              'None'         \
                              'Domain Scale' \
                              'Large Scale' &&

if [[ $DSPAM_SCALE == None ]]; then
  config_query_option DSPAM_OPTS 'Enable home directory filesystem storage driver?' n \
                                 '--enable-homedir' \
                                 '--disable-homedir'
else
  list_add "DSPAM_OPTS" "--disable-homedir" &&
  list_remove "DSPAM_OPTS" "--enable-homedir"
fi &&

# the next 2 queries use the previous spell defaults instead of the upstream
# default, to make sure the spell does not disrupt anything
config_query_string DSPAM_HOME 'which home directory for dspam?' '/var/spool/dspam'
config_query_string DSPAM_LOG 'which log directory for dspam?' '/var/log/dspam'
