diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 650c9abd..ad80190b 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -687,23 +687,26 @@ function add_to_mailing_list { return fi if [ ${#LIST_SUBJECT} -lt 2 ]; then - dialog --title $"Add mailing list" \ - --msgbox $"No mailing list subject was given" 6 40 - return + if [ ${#LIST_EMAIL} -lt 2 ]; then + dialog --title $"Add mailing list" \ + --msgbox $"No mailing list subject or address was given" 6 40 + return + fi fi - if [ ${#LIST_EMAIL} -lt 2 ]; then - 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 - return + if [ ${#LIST_SUBJECT} -gt 1 ]; then + ${PROJECT_NAME}-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \ + -s "$LIST_SUBJECT" + else + if [[ "$LIST_EMAIL" != *"@"* || "$LIST_EMAIL" != *"."* ]]; then + dialog --title $"Add mailing list" \ + --msgbox $"Unrecognised email address" 6 40 + return + else + ${PROJECT_NAME}-addlist -u $SELECTED_USERNAME -l "$LIST_NAME" \ + -e "$LIST_EMAIL" + fi fi - ${PROJECT_NAME}-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 }