diff --git a/tojam b/tojam index 01d7198..87c5b37 100755 --- a/tojam +++ b/tojam @@ -99,8 +99,35 @@ delete_server() { } -settings() { - echo "Settings coming soon" +configure_ninjam() { + local menuCode=0 + while [[ $menuCode -ne 1 ]]; do + settings=( + "anonymous" "Login in anonymously: ($anonymous)" + "save source files" "Save Source Files: (${saveSourceFiles/-nosavesourcefiles/false recommended})" + "sound driver" "Sound Driver: (${soundDriver%% *})" + "username" "Set User Name: (${userName#*anonymous:})" + ) + setting="$(dialog --backtitle "Tojam" \ + --no-tags \ + --menu "Select a setting" -1 -1 -1 "${settings[@]}" --stdout)" + menuCode=$? + if [ ${menuCode} -eq 1 -o ${menuCode} -eq 255 ]; then + exit 0 + fi + case "${setting}" in + "username") + userName="$(dialog --backtitle "Tojam" \ + --inputbox "Enter User Name (letters, numbers, dash, and underscore accepted):" -1 -1 "${userName#*anonymous:}" --stdout)" + menuCode=$? + [[ ${menuCode} -ne 0 ]] && continue + [[ "${anonymous}" == "true" ]] && userName="anonymous:${userName}" + sed -i "s/^userName=.*/userName='${userName}'/" "${config}/config" && + dialog --msgbox "Username set to \"${userName#*anonymous:}\"." -1 -1 + ;; + esac + done + exit 0 } @@ -186,7 +213,7 @@ server="$(dialog --clear \ menuCode=$? case ${menuCode} in 1|255) exit 0;; - 2) settings;; + 2) configure_ninjam;; 3) add_server;; esac