From da3c0f5eed5ae06696db28891c4e13c10da14428 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sun, 1 Nov 2015 10:08:36 +0000
Subject: [PATCH] Tidying

---
 src/freedombone-controlpanel | 84 ++++++++++++++++++++++++------------
 1 file changed, 56 insertions(+), 28 deletions(-)

diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel
index aabaada2c..b09f2c7a0 100755
--- a/src/freedombone-controlpanel
+++ b/src/freedombone-controlpanel
@@ -53,11 +53,13 @@ function add_user {
     new_user_username=$(cat $data | sed -n 1p)
     new_user_ssh_public_key=$(cat $data | sed -n 2p)
     if [ ${#new_user_username} -lt 2 ]; then
-        dialog --title "New username" --msgbox "No username was given" 6 40
+        dialog --title "New username" \
+               --msgbox "No username was given" 6 40
         return
     fi
     if [[ "$new_user_username" == *" "* ]]; then
-        dialog --title "Invalid username" --msgbox "The username should not contain any spaces" 6 40
+        dialog --title "Invalid username" \
+               --msgbox "The username should not contain any spaces" 6 40
         return
     fi
     if [ ${#new_user_ssh_public_key} -lt 20 ]; then
@@ -70,7 +72,8 @@ function add_user {
             freedombone-adduser "$new_user_username" "$new_user_ssh_public_key"
             any_key
         else
-            dialog --title "ssh public key" --msgbox "This does not look like an ssh public key" 6 40
+            dialog --title "ssh public key" \
+                   --msgbox "This does not look like an ssh public key" 6 40
         fi
     fi
 }
@@ -92,7 +95,8 @@ function select_user {
         SELECTED_USERNAME=
     fi
     if [ ! -d /home/$SELECTED_USERNAME/Maildir ]; then
-        dialog --title "User directory check" --msgbox "This does not look like a user directory" 6 40
+        dialog --title "User directory check" \
+               --msgbox "This does not look like a user directory" 6 40
         SELECTED_USERNAME=
     fi
 }
@@ -103,7 +107,8 @@ function delete_user {
         return
     fi
     if grep -Fxq "Admin user: $SELECTED_USERNAME" $COMPLETION_FILE; then
-        dialog --title "Administrator user" --msgbox "You can't delete the administrator user" 6 40
+        dialog --title "Administrator user" \
+               --msgbox "You can't delete the administrator user" 6 40
         return
     fi
     clear
@@ -147,24 +152,30 @@ function add_to_mailing_list {
     LIST_EMAIL=$(cat $data | sed -n 3p)
 
     if [ ${#LIST_NAME} -lt 2 ]; then
-        dialog --title "Add mailing list" --msgbox "No mailing list name was given" 6 40
+        dialog --title "Add mailing list" \
+               --msgbox "No mailing list name was given" 6 40
         return
     fi
     if [ ${#LIST_SUBJECT} -lt 2 ]; then
-        dialog --title "Add mailing list" --msgbox "No mailing list subject was given" 6 40
+        dialog --title "Add mailing list" \
+               --msgbox "No mailing list subject was given" 6 40
         return
     fi
     if [ ${#LIST_EMAIL} -lt 2 ]; then
-        dialog --title "Add mailing list" --msgbox "No mailing list email address was given" 6 40
+        dialog --title "Add mailing list" \
+               --msgbox "No mailing list email address was given" 6 40
         return
     fi
     if [[ "$LIST_EMAIL" != *"@"* || "$LIST_EMAIL" != *"."* ]]; then
-        dialog --title "Add mailing list" --msgbox "Unrecognised email address" 6 40
+        dialog --title "Add mailing list" \
+               --msgbox "Unrecognised email address" 6 40
         return
     fi
 
-    freedombone-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" -s "$LIST_SUBJECT" -e "$LIST_EMAIL"
-    dialog --title "Add mailing list" --msgbox "$LIST_NAME list was added" 6 40
+    freedombone-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \
+                        -s "$LIST_SUBJECT" -e "$LIST_EMAIL"
+    dialog --title "Add mailing list" \
+           --msgbox "$LIST_NAME list was added" 6 40
 }
 
 function email_rule {
@@ -189,20 +200,25 @@ function email_rule {
     RULE_FOLDER=$(cat $data | sed -n 2p)
 
     if [ ${#RULE_EMAIL} -lt 2 ]; then
-        dialog --title "Add email rule" --msgbox "No email address was given" 6 40
+        dialog --title "Add email rule" \
+               --msgbox "No email address was given" 6 40
         return
     fi
     if [ ${#RULE_FOLDER} -lt 2 ]; then
-        dialog --title "Add email rule" --msgbox "No folder name was given" 6 40
+        dialog --title "Add email rule" \
+               --msgbox "No folder name was given" 6 40
         return
     fi
     if [[ "$RULE_EMAIL" != *"@"* || "$RULE_EMAIL" != *"."* ]]; then
-        dialog --title "Add email rule" --msgbox "Unrecognised email address" 6 40
+        dialog --title "Add email rule" \
+               --msgbox "Unrecognised email address" 6 40
         return
     fi
 
-    freedombone-addemail -u $SELECTED_USERNAME -e "$RULE_EMAIL" -g "$RULE_FOLDER"
-    dialog --title "Add email rule" --msgbox "Email rule for $RULE_EMAIL was added" 6 40
+    freedombone-addemail -u $SELECTED_USERNAME -e "$RULE_EMAIL" \
+                         -g "$RULE_FOLDER"
+    dialog --title "Add email rule" \
+           --msgbox "Email rule for $RULE_EMAIL was added" 6 40
 }
 
 function block_unblock_email {
@@ -226,19 +242,23 @@ function block_unblock_email {
     BLOCK_EMAIL=$(cat $data | sed -n 1p)
     BLOCK=$(cat $data | sed -n 2p)
     if [ ${#BLOCK_EMAIL} -lt 2 ]; then
-        dialog --title "Block/Unblock an email" --msgbox "No email address was given" 6 40
+        dialog --title "Block/Unblock an email" \
+               --msgbox "No email address was given" 6 40
         return
     fi
     if [[ "$BLOCK_EMAIL" != *"@"* || "$BLOCK_EMAIL" != *"."* ]]; then
-        dialog --title "Block/Unblock an email" --msgbox "Unrecognised email address" 6 40
+        dialog --title "Block/Unblock an email" \
+               --msgbox "Unrecognised email address" 6 40
         return
     fi
     if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
         freedombone-ignore -u $SELECTED_USERNAME -e "$BLOCK_EMAIL"
-        dialog --title "Block an email" --msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME blocked" 6 40
+        dialog --title "Block an email" \
+               --msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME blocked" 6 40
     else
         freedombone-unignore -u $SELECTED_USERNAME -e "$BLOCK_EMAIL"
-        dialog --title "Unblock an email" --msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME unblocked" 6 40
+        dialog --title "Unblock an email" \
+               --msgbox "Email from $BLOCK_EMAIL to $SELECTED_USERNAME unblocked" 6 40
     fi
 }
 
@@ -263,15 +283,18 @@ function block_unblock_subject {
     BLOCK_SUBJECT=$(cat $data | sed -n 1p)
     BLOCK=$(cat $data | sed -n 2p)
     if [ ${#BLOCK_SUBJECT} -lt 2 ]; then
-        dialog --title "Block/Unblock an email" --msgbox "No subject was given" 6 40
+        dialog --title "Block/Unblock an email" \
+               --msgbox "No subject was given" 6 40
         return
     fi
     if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
         freedombone-ignore -u $SELECTED_USERNAME -t "$BLOCK_SUBJECT"
-        dialog --title "Block an email" --msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME blocked" 6 40
+        dialog --title "Block an email" \
+               --msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME blocked" 6 40
     else
         freedombone-unignore -u $SELECTED_USERNAME -t "$BLOCK_SUBJECT"
-        dialog --title "Unblock an email" --msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME unblocked" 6 40
+        dialog --title "Unblock an email" \
+               --msgbox "Email with subject $BLOCK_SUBJECT to $SELECTED_USERNAME unblocked" 6 40
     fi
 }
 
@@ -280,7 +303,8 @@ function create_keydrive_master {
     if [ ! $SELECTED_USERNAME ]; then
         return
     fi
-    dialog --title "USB Master Keydrive" --msgbox "Plug in a LUKS encrypted USB drive" 6 40
+    dialog --title "USB Master Keydrive" \
+           --msgbox "Plug in a LUKS encrypted USB drive" 6 40
     clear
     freedombone-keydrive -u $SELECTED_USERNAME --master 'yes'
     any_key
@@ -291,21 +315,24 @@ function create_keydrive_fragment {
     if [ ! $SELECTED_USERNAME ]; then
         return
     fi
-    dialog --title "USB Fragment Keydrive" --msgbox "Plug in a LUKS encrypted USB drive" 6 40
+    dialog --title "USB Fragment Keydrive" \
+           --msgbox "Plug in a LUKS encrypted USB drive" 6 40
     clear
     freedombone-keydrive -u $SELECTED_USERNAME
     any_key
 }
 
 function backup_data {
-    dialog --title "Backup data to USB" --msgbox "Plug in a LUKS encrypted USB drive" 6 40
+    dialog --title "Backup data to USB" \
+           --msgbox "Plug in a LUKS encrypted USB drive" 6 40
     clear
     backup
     any_key
 }
 
 function restore_data {
-    dialog --title "Restore data from USB" --msgbox "Plug in your backup USB drive" 6 40
+    dialog --title "Restore data from USB" \
+           --msgbox "Plug in your backup USB drive" 6 40
     clear
     restore
     any_key
@@ -332,7 +359,8 @@ function restore_gpg_key {
     if [ ! $SELECTED_USERNAME ]; then
         return
     fi
-    dialog --title "Restore GPG key for user $SELECTED_USERNAME" --msgbox "Plug in your USB keydrive" 6 40
+    dialog --title "Restore GPG key for user $SELECTED_USERNAME" \
+           --msgbox "Plug in your USB keydrive" 6 40
     clear
     freedombone-recoverkey -u $SELECTED_USERNAME
     any_key
-- 
GitLab