added unsigned mail messages
This commit is contained in:
parent
b58f8e416a
commit
bec8ecdc12
@ -221,7 +221,7 @@ class OnionrUtils:
|
|||||||
if pub == '':
|
if pub == '':
|
||||||
pub = self._core._crypto.pubKey
|
pub = self._core._crypto.pubKey
|
||||||
pub = base64.b16encode(base64.b32decode(pub)).decode()
|
pub = base64.b16encode(base64.b32decode(pub)).decode()
|
||||||
return '-'.join(pgpwords.wordify(pub))
|
return ' '.join(pgpwords.wordify(pub))
|
||||||
|
|
||||||
def getBlockMetadataFromData(self, blockData):
|
def getBlockMetadataFromData(self, blockData):
|
||||||
'''
|
'''
|
||||||
|
@ -48,14 +48,14 @@ class MailStrings:
|
|||||||
self.mailInstance = mailInstance
|
self.mailInstance = mailInstance
|
||||||
|
|
||||||
self.programTag = 'OnionrMail v%s' % (PLUGIN_VERSION)
|
self.programTag = 'OnionrMail v%s' % (PLUGIN_VERSION)
|
||||||
choices = ['view inbox', 'view sentbox', 'send message', 'quit']
|
choices = ['view inbox', 'view sentbox', 'send message', 'toggle pseudonymity', 'quit']
|
||||||
self.mainMenuChoices = choices
|
self.mainMenuChoices = choices
|
||||||
self.mainMenu = '''\n
|
self.mainMenu = '''-----------------
|
||||||
-----------------
|
1. %s
|
||||||
1. %s
|
2. %s
|
||||||
2. %s
|
3. %s
|
||||||
3. %s
|
4. %s
|
||||||
4. %s''' % (choices[0], choices[1], choices[2], choices[3])
|
5. %s''' % (choices[0], choices[1], choices[2], choices[3], choices[4])
|
||||||
|
|
||||||
class OnionrMail:
|
class OnionrMail:
|
||||||
def __init__(self, pluginapi):
|
def __init__(self, pluginapi):
|
||||||
@ -65,6 +65,7 @@ class OnionrMail:
|
|||||||
self.sentboxTools = sentboxdb.SentBox(self.myCore)
|
self.sentboxTools = sentboxdb.SentBox(self.myCore)
|
||||||
self.sentboxList = []
|
self.sentboxList = []
|
||||||
self.sentMessages = {}
|
self.sentMessages = {}
|
||||||
|
self.doSigs = True
|
||||||
return
|
return
|
||||||
|
|
||||||
def inbox(self):
|
def inbox(self):
|
||||||
@ -133,12 +134,14 @@ class OnionrMail:
|
|||||||
else:
|
else:
|
||||||
cancel = ''
|
cancel = ''
|
||||||
readBlock.verifySig()
|
readBlock.verifySig()
|
||||||
|
senderDisplay = self.myCore._utils.bytesToStr(readBlock.signer)
|
||||||
logger.info('Message recieved from %s' % (self.myCore._utils.bytesToStr(readBlock.signer,)))
|
if len(senderDisplay.strip()) == 0:
|
||||||
|
senderDisplay = 'Anonymous'
|
||||||
|
logger.info('Message received from %s' % (senderDisplay,))
|
||||||
logger.info('Valid signature: %s' % readBlock.validSig)
|
logger.info('Valid signature: %s' % readBlock.validSig)
|
||||||
|
|
||||||
if not readBlock.validSig:
|
if not readBlock.validSig:
|
||||||
logger.warn('This message has an INVALID signature. ANYONE could have sent this message.')
|
logger.warn('This message has an INVALID/NO signature. ANYONE could have sent this message.')
|
||||||
cancel = logger.readline('Press enter to continue to message, or -q to not open the message (recommended).')
|
cancel = logger.readline('Press enter to continue to message, or -q to not open the message (recommended).')
|
||||||
if cancel != '-q':
|
if cancel != '-q':
|
||||||
try:
|
try:
|
||||||
@ -147,6 +150,7 @@ class OnionrMail:
|
|||||||
logger.warn('Error presenting message. This is usually due to a malformed or blank message.')
|
logger.warn('Error presenting message. This is usually due to a malformed or blank message.')
|
||||||
pass
|
pass
|
||||||
reply = logger.readline("Press enter to continue, or enter %s to reply" % ("-r",))
|
reply = logger.readline("Press enter to continue, or enter %s to reply" % ("-r",))
|
||||||
|
print('')
|
||||||
if reply == "-r":
|
if reply == "-r":
|
||||||
self.draftMessage(self.myCore._utils.bytesToStr(readBlock.signer,))
|
self.draftMessage(self.myCore._utils.bytesToStr(readBlock.signer,))
|
||||||
return
|
return
|
||||||
@ -241,14 +245,27 @@ class OnionrMail:
|
|||||||
if not cancelEnter:
|
if not cancelEnter:
|
||||||
logger.info('Inserting encrypted message as Onionr block....')
|
logger.info('Inserting encrypted message as Onionr block....')
|
||||||
|
|
||||||
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=True, meta={'subject': subject})
|
blockID = self.myCore.insertBlock(message, header='pm', encryptType='asym', asymPeer=recip, sign=self.doSigs, meta={'subject': subject})
|
||||||
self.sentboxTools.addToSent(blockID, recip, message)
|
self.sentboxTools.addToSent(blockID, recip, message)
|
||||||
|
|
||||||
|
def toggleSigning(self):
|
||||||
|
self.doSigs = not self.doSigs
|
||||||
|
|
||||||
def menu(self):
|
def menu(self):
|
||||||
choice = ''
|
choice = ''
|
||||||
while True:
|
while True:
|
||||||
|
sigMsg = 'Message Signing: %s'
|
||||||
|
|
||||||
logger.info(self.strings.programTag + '\n\nOur ID: ' + self.myCore._crypto.pubKey + self.strings.mainMenu.title()) # print out main menu
|
logger.info(self.strings.programTag + '\n\nUser ID: ' + self.myCore._crypto.pubKey)
|
||||||
|
if self.doSigs:
|
||||||
|
sigMsg = sigMsg % ('enabled',)
|
||||||
|
else:
|
||||||
|
sigMsg = sigMsg % ('disabled (Your messages cannot be trusted)',)
|
||||||
|
if self.doSigs:
|
||||||
|
logger.info(sigMsg)
|
||||||
|
else:
|
||||||
|
logger.warn(sigMsg)
|
||||||
|
logger.info(self.strings.mainMenu.title()) # print out main menu
|
||||||
try:
|
try:
|
||||||
choice = logger.readline('Enter 1-%s:\n' % (len(self.strings.mainMenuChoices))).lower().strip()
|
choice = logger.readline('Enter 1-%s:\n' % (len(self.strings.mainMenuChoices))).lower().strip()
|
||||||
except (KeyboardInterrupt, EOFError):
|
except (KeyboardInterrupt, EOFError):
|
||||||
@ -261,6 +278,8 @@ class OnionrMail:
|
|||||||
elif choice in (self.strings.mainMenuChoices[2], '3'):
|
elif choice in (self.strings.mainMenuChoices[2], '3'):
|
||||||
self.draftMessage()
|
self.draftMessage()
|
||||||
elif choice in (self.strings.mainMenuChoices[3], '4'):
|
elif choice in (self.strings.mainMenuChoices[3], '4'):
|
||||||
|
self.toggleSigning()
|
||||||
|
elif choice in (self.strings.mainMenuChoices[4], '5'):
|
||||||
logger.info('Goodbye.')
|
logger.info('Goodbye.')
|
||||||
break
|
break
|
||||||
elif choice == '':
|
elif choice == '':
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
<div id='threadPlaceholder'>Nothing here yet 😞</div>
|
<div id='threadPlaceholder'>Nothing here yet 😞</div>
|
||||||
</div>
|
</div>
|
||||||
<div id='messageDisplay' class='overlay'>
|
<div id='messageDisplay' class='overlay'>
|
||||||
<span class='closeOverlay' overlay='messageDisplay'></span>
|
|
||||||
<div class='overlayContent'>
|
<div class='overlayContent'>
|
||||||
|
<span class='closeOverlay' overlay='messageDisplay'></span>
|
||||||
<div>From: <input type='text' id='fromUser' readonly>
|
<div>From: <input type='text' id='fromUser' readonly>
|
||||||
</div>
|
</div>
|
||||||
<div id='threadDisplay'>
|
<div id='threadDisplay'>
|
||||||
|
Loading…
Reference in New Issue
Block a user