mirror of https://gitlab.com/bashrc2/epicyon
Store decrypted messages
parent
c88bdf1cd9
commit
b920aac6ab
|
@ -11,7 +11,9 @@ import html
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import select
|
import select
|
||||||
|
from pathlib import Path
|
||||||
from random import randint
|
from random import randint
|
||||||
|
from utils import saveJson
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
|
@ -370,6 +372,23 @@ def _notificationNewDM(session, toHandle: str,
|
||||||
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
_sayCommand(sayStr, sayStr, screenreader, systemLanguage, espeak)
|
||||||
|
|
||||||
|
|
||||||
|
def _storeMessage(speakerJson: {}) -> None:
|
||||||
|
"""Stores a message for later reading
|
||||||
|
"""
|
||||||
|
if not speakerJson.get('published'):
|
||||||
|
return
|
||||||
|
homeDir = str(Path.home())
|
||||||
|
if not os.path.isdir(homeDir + '/.config'):
|
||||||
|
os.mkdir(homeDir + '/.config')
|
||||||
|
if not os.path.isdir(homeDir + '/.config/epicyon'):
|
||||||
|
os.mkdir(homeDir + '/.config/epicyon')
|
||||||
|
msgDir = homeDir + '/.config/epicyon/dm'
|
||||||
|
if not os.path.isdir(msgDir):
|
||||||
|
os.mkdir(msgDir)
|
||||||
|
msgFilename = msgDir + '/' + speakerJson['published'] + '.json'
|
||||||
|
saveJson(speakerJson, msgFilename)
|
||||||
|
|
||||||
|
|
||||||
def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str, port: int,
|
||||||
password: str, screenreader: str,
|
password: str, screenreader: str,
|
||||||
|
@ -543,6 +562,12 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
systemLanguage, espeak,
|
systemLanguage, espeak,
|
||||||
nameStr, gender)
|
nameStr, gender)
|
||||||
|
|
||||||
|
if encryptedMessage:
|
||||||
|
speakerJson['content'] = content
|
||||||
|
speakerJson['say'] = messageStr
|
||||||
|
speakerJson['decrypted'] = True
|
||||||
|
_storeMessage(speakerJson)
|
||||||
|
|
||||||
print('')
|
print('')
|
||||||
|
|
||||||
prevSay = speakerJson['say']
|
prevSay = speakerJson['say']
|
||||||
|
|
Loading…
Reference in New Issue