Add a gpg key

This commit is contained in:
Bob Mottram 2016-02-27 11:11:07 +00:00
parent 63a114ec70
commit 500974eb1e
1 changed files with 25 additions and 3 deletions

View File

@ -336,11 +336,11 @@ function block_unblock_subject {
if [[ $BLOCK == "y"* || $BLOCK == "Y"* ]]; then
${PROJECT_NAME}-ignore -u $USER -t "$BLOCK_SUBJECT"
dialog --title $"Block an email" \
--msgbox "Email with subject $BLOCK_SUBJECT is now blocked" 6 40
--msgbox $"Email with subject $BLOCK_SUBJECT is now blocked" 6 40
else
${PROJECT_NAME}-unignore -u $USER -t "$BLOCK_SUBJECT"
dialog --title $"Unblock an email" \
--msgbox "Email with subject $BLOCK_SUBJECT is now unblocked" 6 40
--msgbox $"Email with subject $BLOCK_SUBJECT is now unblocked" 6 40
fi
}
@ -351,10 +351,32 @@ function show_gpg_key {
GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $2}')
dialog --title $"Your PGP/GPG Key" \
--backtitle $"Freedombone User Control Panel" \
--msgbox "Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
--msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
}
function add_gpg_key {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"Add someone's PGP/GPG key" \
--backtitle $"Freedombone User Control Panel" \
--inputbox $"Enter their email address below" 8 60 2>$data
sel=$?
case $sel in
0)
ADD_EMAIL_ADDRESS=$(<$data)
if [ ${#ADD_EMAIL_ADDRESS} -gt 1 ]; then
if [[ $ADD_EMAIL_ADDRESS == *"@"* && $ADD_EMAIL_ADDRESS == *"."* ]]; then
clear
gpg --search-keys $ADD_EMAIL_ADDRESS
else
dialog --title $"Unrecognised email address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox $"This doesn't look like an email address" 6 50
fi
fi
;;
esac
}
function remove_gpg_key {