diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index 89c15b3d..236084eb 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -181,29 +181,22 @@ function xmpp_remove_onion_address_interactive { } function configure_interactive_xmpp { + W=(1 $"Add an ICANN to onion domain mapping" + 2 $"Remove an ICANN to onion domain mapping") + while true do - data=$(mktemp 2>/dev/null) - dialog --backtitle $"Freedombone Control Panel" \ - --title $"XMPP" \ - --radiolist $"Choose an operation:" 12 70 3 \ - 1 $"Add an ICANN to onion domain mapping" off \ - 2 $"Remove an ICANN to onion domain mapping" off \ - 3 $"Return to administrator control panel" on 2> "$data" - sel=$? - case $sel in - 1) rm -f "$data" - return;; - 255) rm -f "$data" - return;; - esac - case $(cat "$data") in + # shellcheck disable=SC2068 + selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"XMPP" --menu $"Choose an operation, or ESC to exit:" 10 60 2 "${W[@]}" 3>&2 2>&1 1>&3) + + if [ ! "$selection" ]; then + break + fi + + case $selection in 1) xmpp_add_onion_address_interactive;; 2) xmpp_remove_onion_address_interactive;; - 3) rm -f "$data" - break;; esac - rm -f "$data" done }