Notification client stores all direct messages

merge-requests/21/head
Bob Mottram 2021-03-12 14:34:56 +00:00
parent 77818c99ce
commit ed05285ace
2 changed files with 11 additions and 2 deletions

View File

@ -569,6 +569,9 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
speakerJson['say'] = messageStr
speakerJson['decrypted'] = True
_storeMessage(speakerJson)
elif speakerJson.get('direct'):
speakerJson['decrypted'] = False
_storeMessage(speakerJson)
print('')

View File

@ -12,6 +12,7 @@ import random
import urllib.parse
from auth import createBasicAuthHeader
from session import getJson
from utils import isDM
from utils import camelCaseSplit
from utils import getDomainFromActor
from utils import getNicknameFromActor
@ -284,7 +285,8 @@ def _speakerEndpointJson(displayName: str, summary: str,
postDM: bool, postReply: bool,
followRequestsExist: bool,
likedBy: str, published: str, postCal: bool,
postShare: bool, themeName: str) -> {}:
postShare: bool, themeName: str,
isDirect: bool) -> {}:
"""Returns a json endpoint for the TTS speaker
"""
speakerJson = {
@ -296,6 +298,7 @@ def _speakerEndpointJson(displayName: str, summary: str,
"imageDescription": imageDescription,
"detectedLinks": links,
"id": postId,
"direct": isDirect,
"notify": {
"theme": themeName,
"dm": postDM,
@ -445,6 +448,8 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
imageDescription += \
img['name'] + '. '
isDirect = isDM(postJsonObject)
published = ''
if postJsonObject['object'].get('published'):
published = postJsonObject['object']['published']
@ -512,7 +517,8 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
postDM, postReply,
followRequestsExist,
likedBy, published,
postCal, postShare, themeName)
postCal, postShare, themeName,
isDirect)
def updateSpeaker(baseDir: str, httpPrefix: str,