diff options
-rwxr-xr-x | firma | 41 |
1 files changed, 9 insertions, 32 deletions
@@ -96,15 +96,15 @@ function get_message { function get_gpg_message { signal=0 if [ ! -z "$LINES" ]; then - x=0; n=$LINES - for ((count=0;count<=n;count++)); do + n=0; + for ((count=0;count<=LINES;count++)); do if [[ $signal == "0" ]] && [[ "$(echo "${MESSAGE[$count]}" | grep -v -e "-----BEGIN PGP MESSAGE-----")" == "" ]]; then - GPG_MESSAGE[$x]=${MESSAGE[$count]} - ((++x)) + GPG_MESSAGE[$n]=${MESSAGE[$count]} + ((++n)) signal=1 elif [[ $signal == "1" ]]; then - GPG_MESSAGE[$x]=${MESSAGE[$count]} - ((++x)) + GPG_MESSAGE[$n]=${MESSAGE[$count]} + ((++n)) if [[ "$(echo "${MESSAGE[$count]}" | grep -v -e "-----END PGP MESSAGE-----")" == "" ]]; then signal=0 fi @@ -131,13 +131,6 @@ function message_list { # compose and send a message to the list # $1: subscriber email # sorry no identation :P -n=4 - -LIST_MESSAGE[0]="From: $LISTNAME\n" -LIST_MESSAGE[1]="To: $1\n" -LIST_MESSAGE[2]="Subject: none\n" -LIST_MESSAGE[3]="\n" - echo "$PASSWD Message from: $FROM Subject: $SUBJECT @@ -146,19 +139,12 @@ $DATE $(get_gpg_stderr | grep -F 'gpg: Signature made') $(get_gpg_stderr | grep -F 'gpg: Good signature from') -$(echo -e "$PASSWD\n${GPG_MESSAGE[@]}" | $GPGDECRYPT 2> /dev/null)" | sed -e 's/=20$//' | $GPGENCRYPT $1 | while read STDIN; do - LIST_MESSAGE[$n]="$STDIN\n" - ((++n)) -done - -echo -e "${LIST_MESSAGE[@]}" | $MAIL $MAIL_ARGS - +$(echo -e "$PASSWD\n${GPG_MESSAGE[@]}" | $GPGDECRYPT 2> /dev/null)" | sed -e 's/=20$//' | $GPGENCRYPT $1 | $MAIL -r $LISTNAME $1 } function message_list_error { # compose and send an error message # sorry no identation :P -n=0 echo "$PASSWD Message from: $FROM Subject: [BAD SIGNATURE] $SUBJECT @@ -167,17 +153,7 @@ $DATE $(get_gpg_stderr | grep -F 'gpg: Signature made') $(get_gpg_stderr | grep -F 'gpg: BAD signature from') -$(echo -e "$PASSWD\n${GPG_MESSAGE[@]}" | $GPGDECRYPT 2> /dev/null)" | sed -e 's/=20$//' | $GPGENCRYPT $1 | while read STDIN; do - LIST_MESSAGE[$n]="$STDIN\n" - ((++n)) -done - -echo "From: $LISTNAME -To: $1 -Subject: none - -$(echo -e "${LIST_MESSAGE[@]}")" | $MAIL $MAIL_ARGS - +$(echo -e "$PASSWD\n${GPG_MESSAGE[@]}" | $GPGDECRYPT 2> /dev/null)" | sed -e 's/=20$//' | $GPGENCRYPT $1 | $MAIL -r $LISTNAME $1 } function message_list_return { @@ -438,3 +414,4 @@ declare n for array in $USED_ARRAYS; do unset $array done + |