# remove deprecated options
if [[ -n $AUDACIOUS_IPV6 ]]; then
  persistent_remove AUDACIOUS_IPV6
fi &&
if [[ -n $AUDACIOUS_AD ]]; then
  persistent_remove AUDACIOUS_AD
fi &&

if [[ ! -v AUDACIOUS_OPTS ]]; then
  persistent_add AUDACIOUS_OPTS
fi &&

# backport legacy options
for o in AUDACIOUS_STATUS AUDACIOUS_OSD AUDACIOUS_COSD AUDACIOUS_SONGCHANGE \
         AUDACIOUS_HOTKEY AUDACIOUS_MPRIS AUDACIOUS_GTKUI AUDACIOUS_SKINS \
         AUDACIOUS_LYRIC; do
  if [[ -n ${!o} ]]; then
    list_add "AUDACIOUS_OPTS" "${!o}" &&
    persistent_remove ${o}
  fi
done &&

config_query_option AUDACIOUS_OPTS \
                    'Enable X11 Status Icon plugin?' y \
                    '--enable-statusicon' \
                    '--disable-statusicon' &&

config_query_option AUDACIOUS_OPTS \
                    'for OSD plugin' y \
                    '--enable-aosd' \
                    '--disable-aosd' &&

if list_find "$AUDACIOUS_OPTS" '--enable-aosd'; then
  config_query_option AUDACIOUS_OPTS \
                    'for X Composite OSD plugin' y \
                    '--enable-aosd-xcomp' \
                    '--disable-aosd-xcomp'
fi  &&

config_query_option AUDACIOUS_OPTS \
                    "Enable Song Change Plugin?" y \
                    "--enable-songchange" \
                    "--disable-songchange" &&

config_query_option AUDACIOUS_OPTS \
                    "Enable global hotkey plugin?" y \
                    "--enable-hotkey" \
                    "--disable-hotkey" &&

config_query_option AUDACIOUS_OPTS \
                    "Enable mpris2 plugin?" y \
                    "--enable-mpris2" \
                    "--disable-mpris2" &&

config_query_option AUDACIOUS_OPTS \
                    "Enable GTK Interface?" y \
                    "--enable-gtkui" \
                    "--disable-gtkui" &&

config_query_option AUDACIOUS_OPTS \
                    "Enable Winamp Classic interface?" y \
                    "--enable-skins" \
                    "--disable-skins" &&

config_query_option AUDACIOUS_OPTS \
                    "Enable LyricWiki plugin?" y \
                    "--enable-lyricwiki" \
                    "--disable-lyricwiki" 
