Show onion email address as QR code on user control panel

This commit is contained in:
Bob Mottram 2018-04-07 11:35:48 +01:00
parent 43133492dd
commit 60b4b077d8
1 changed files with 37 additions and 15 deletions

View File

@ -856,28 +856,50 @@ function show_your_email_address {
if [ -f "$HOME/.email_onion_domain" ]; then
onion_domain=$(cat "$HOME/.email_onion_domain")
fi
dialog_height=14
if [[ "$HOSTNAME" != *'.onion' && "$onion_domain" ]]; then
msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
if [ ! -f ~/.mutt/bdsmail ]; then
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
dialog_height=17
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nOnion Email: ${USER}@${onion_domain}\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE\\n\\nI2P Address: ${bdsmail_address}"
dialog_height=20
fi
else
msgstr=$"Email Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
if [ ! -f ~/.mutt/bdsmail ]; then
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE"
dialog_height=14
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
msgstr=$"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE\\n\\nI2P Address: ${bdsmail_address}"
dialog_height=17
fi
fi
if [ ! -f ~/.mutt/bdsmail ]; then
dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox "$msgstr" 14 100
else
bdsmail_address=$(grep 'set from=' ~/.mutt/bdsmail | awk -F '=' '{print $2}')
dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox $"\\nYou can press SHIFT and then drag the mouse and right click to copy.\\n\\nEmail Address: $MY_EMAIL_ADDRESS\\n\\nKey ID: $GPG_ID\\n\\nFingerprint: $GPG_FINGERPRINT\\n\\nCreated: $GPG_DATE\\n\\nI2P Address: ${bdsmail_address}" 17 100
clear
dialog --title $"Show your Email Address" \
--backtitle $"Freedombone User Control Panel" \
--msgbox "$msgstr" $dialog_height 100
clear
qr_code_shown=
if [ "$onion_domain" ]; then
echo ''
echo $'Your bdsmail address as a QR code'
echo $'Your onion email address:'
echo ''
echo -n "${USER}@${onion_domain}" | qrencode -t UTF8
echo ''
qr_code_shown=1
fi
if [ -f ~/.mutt/bdsmail ]; then
echo ''
echo $'Your bdsmail address:'
echo ''
echo -n "${bdsmail_address}" | qrencode -t UTF8
echo ''
echo "${bdsmail_address}"
echo ''
qr_code_shown=1
fi
if [ $qr_code_shown ]; then
any_key
fi
}