diff --git a/notifications_client.py b/notifications_client.py index de81b65fb..67fa16e59 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -780,6 +780,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, cachedWebfingers = {} personCache = {} currDMIndex = 0 + currRepliesIndex = 0 currSentIndex = 0 while (1): session = createSession(proxyType) @@ -905,6 +906,8 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, speakerJson['decrypted'] = False if encryptedMessage or speakerJson.get('direct'): _storeMessage(speakerJson, 'dm') + elif speakerJson.get('replyToYou'): + _storeMessage(speakerJson, 'replies') else: if storeInboxPosts: _storeMessage(speakerJson, 'inbox') @@ -940,6 +943,12 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, screenreader, systemLanguage, espeak, currDMIndex, 10) currTimeline = 'dm' + elif keyPress.startswith('show rep'): + currRepliesIndex = 0 + _showLocalBox(notifyJson, 'replies', + screenreader, systemLanguage, espeak, + currRepliesIndex, 10) + currTimeline = 'replies' elif keyPress.startswith('show sen'): currSentIndex = 0 _showLocalBox(notifyJson, 'sent', @@ -959,6 +968,11 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, _showLocalBox(notifyJson, 'dm', screenreader, systemLanguage, espeak, currDMIndex, 10) + elif currTimeline == 'replies': + currRepliesIndex += 10 + _showLocalBox(notifyJson, 'replies', + screenreader, systemLanguage, espeak, + currRepliesIndex, 10) elif currTimeline == 'sent': currSentIndex += 10 _showLocalBox(notifyJson, 'sent', @@ -977,6 +991,13 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str, _showLocalBox(notifyJson, 'dm', screenreader, systemLanguage, espeak, currDMIndex, 10) + elif currTimeline == 'replies': + currRepliesIndex -= 10 + if currRepliesIndex < 0: + currRepliesIndex = 0 + _showLocalBox(notifyJson, 'replies', + screenreader, systemLanguage, espeak, + currRepliesIndex, 10) elif currTimeline == 'sent': currSentIndex -= 10 if currSentIndex < 0: diff --git a/speaker.py b/speaker.py index ed2218714..2ec228b95 100644 --- a/speaker.py +++ b/speaker.py @@ -13,6 +13,7 @@ import urllib.parse from auth import createBasicAuthHeader from session import getJson from utils import isDM +from utils import isReply from utils import camelCaseSplit from utils import getDomainFromActor from utils import getNicknameFromActor @@ -293,7 +294,7 @@ def _speakerEndpointJson(displayName: str, summary: str, followRequestsList: [], likedBy: str, published: str, postCal: bool, postShare: bool, themeName: str, - isDirect: bool) -> {}: + isDirect: bool, replyToYou: bool) -> {}: """Returns a json endpoint for the TTS speaker """ speakerJson = { @@ -306,6 +307,7 @@ def _speakerEndpointJson(displayName: str, summary: str, "detectedLinks": links, "id": postId, "direct": isDirect, + "replyToYou": replyToYou, "notify": { "theme": themeName, "dm": postDM, @@ -457,6 +459,8 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str, img['name'] + '. ' isDirect = isDM(postJsonObject) + actor = httpPrefix + '://' + domainFull + '/users/' + nickname + replyToYou = isReply(postJsonObject, actor) published = '' if postJsonObject['object'].get('published'): @@ -531,7 +535,7 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str, followRequestsList, likedBy, published, postCal, postShare, themeName, - isDirect) + isDirect, replyToYou) def updateSpeaker(baseDir: str, httpPrefix: str,