From 7800ebf4ec94a5d7a38aa7e741b9ec54191034b9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 26 Oct 2017 23:35:42 +0100 Subject: [PATCH] Use zenity to set the initial username on mesh client --- src/freedombone-image-customise | 20 ++++++++------------ src/meshavahi | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 3240ea2c..2d3fff2b 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -779,18 +779,11 @@ function mesh_client_startup_applications { echo '' >> $START_DESKTOP echo 'INITIAL_TOX_USERNAME=""' >> $START_DESKTOP echo 'while [ ${#INITIAL_TOX_USERNAME} -eq 0 ]; do' >> $START_DESKTOP - echo ' data=$(tempfile 2>/dev/null)' >> $START_DESKTOP - echo ' trap "rm -f $data" 0 1 2 5 15' >> $START_DESKTOP - echo -n " dialog --title \"${MESH_TITLE}\" " >> $START_DESKTOP - echo -n "--backtitle \"${MESH_TITLE}\" " >> $START_DESKTOP - echo -n "--inputbox \"${MESH_SET_USERNAME}\" 12 60 Anon " >> $START_DESKTOP - echo '2>$data' >> $START_DESKTOP - echo ' sel=$?' >> $START_DESKTOP - echo ' case $sel in' >> $START_DESKTOP - echo ' 0)' >> $START_DESKTOP - echo ' INITIAL_TOX_USERNAME=$(<$data)' >> $START_DESKTOP - echo ' ;;' >> $START_DESKTOP - echo ' esac' >> $START_DESKTOP + echo " data=\$(zenity --forms --title=\"$MESH_TITLE\" --text=\"$MESH_SET_USERNAME\" --separator=\",\" --add-entry=\"Username\")" >> $START_DESKTOP + echo ' accepted=$?' >> $START_DESKTOP + echo ' if ((accepted == 0)); then' >> $START_DESKTOP + echo " INITIAL_TOX_USERNAME=\$(awk -F, '{print \$1}' <<<\$data)" >> $START_DESKTOP + echo ' fi' >> $START_DESKTOP echo 'done' >> $START_DESKTOP echo '' >> $START_DESKTOP echo 'toxid --setuser "$INITIAL_TOX_USERNAME"' >> $START_DESKTOP @@ -892,6 +885,9 @@ function configure_user_interface { # audio recording chroot "$rootdir" apt-get -yq install audacity + # for gtk dialog entry + chroot "$rootdir" apt-get -yq install zenity + # Produce a text file on the desktop listing users on the mesh cat < $rootdir/usr/bin/list-tox-users #!/bin/bash diff --git a/src/meshavahi b/src/meshavahi index 7ea0d3af..74a66899 100755 --- a/src/meshavahi +++ b/src/meshavahi @@ -147,7 +147,7 @@ function detect_new_tox_users { # Produce notifications if new users appear if [ -f $PREV_TOX_USERS_FILE ]; then while IFS='' read -r line || [[ -n "$line" ]]; do - if [[ $line != "Failed*" && $line != "data "* && $line != "Anon "* && $line != "anon "* ]]; then + if [[ $line != "Failed*" && $line != "data "* && $line != "Anon "* && $line != "anon "* && $line != "anonymous "* && $line != "Anonymous "* ]]; then if ! grep -q "$line" $PREV_TOX_USERS_FILE; then # get the nick of the user toxidstr=$(echo "$line" | awk -F ' ' '{print $(NF)}')