Next and previous commands

merge-requests/21/head
Bob Mottram 2021-03-12 19:13:01 +00:00
parent 414db21067
commit 90e02e8af8
2 changed files with 40 additions and 4 deletions

View File

@ -434,6 +434,9 @@ post to [handle] Create a new direct message
announce/boost Boost the last post
follow [handle] Make a follow request
unfollow [handle] Stop following the give handle
show dm|sent|inbox Show a timeline
next Next page in the timeline
prev Previous page in the timeline
```
If you have a GPG key configured on your local system and are sending a direct message to someone who has a PGP key (the exported key, not just the key ID) set as a tag on their profile then it will try to encrypt the message automatically. So under some conditions end-to-end encryption is possible, such that the instance server only sees ciphertext. Conversely, for arriving direct messages if they are PGP encrypted then the notification client will try to obtain the relevant public key and decrypt.

View File

@ -303,7 +303,7 @@ def _showLocalBox(boxName: str, startPostIndex=0, noOfPosts=10) -> None:
if not speakerJson.get('published'):
continue
published = speakerJson['published'].replace('T', ' ')
posStr = str(pos) + '.'
posStr = str(pos + 1) + '.'
while len(posStr) < 3:
posStr += ' '
if speakerJson.get('name'):
@ -515,6 +515,10 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
content = None
cachedWebfingers = {}
personCache = {}
currDMIndex = 0
currSentIndex = 0
currInboxIndex = 0
currTimeline = ''
while (1):
session = createSession(proxyType)
speakerJson = \
@ -660,11 +664,40 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
keyPress = _waitForKeypress(2, debug)
break
elif keyPress.startswith('show dm'):
_showLocalBox('dm', 0, 10)
_showLocalBox('dm', currDMIndex, 10)
currTimeline = 'dm'
elif keyPress.startswith('show sen'):
_showLocalBox('sent', 0, 10)
_showLocalBox('sent', currSentIndex, 10)
currTimeline = 'sent'
elif keyPress.startswith('show in'):
_showLocalBox('inbox', 0, 10)
_showLocalBox('inbox', currInboxIndex, 10)
currTimeline = 'inbox'
elif keyPress.startwith('next'):
if currTimeline == 'dm':
currDMIndex += 10
_showLocalBox('dm', currDMIndex, 10)
elif currTimeline == 'sent':
currSentIndex += 10
_showLocalBox('sent', currSentIndex, 10)
elif currTimeline == 'inbox':
currInboxIndex += 10
_showLocalBox('inbox', currInboxIndex, 10)
elif keyPress.startswith('prev'):
if currTimeline == 'dm':
currDMIndex -= 10
if currDMIndex < 0:
currDMIndex = 0
_showLocalBox('dm', currDMIndex, 10)
elif currTimeline == 'sent':
currSentIndex -= 10
if currSentIndex < 0:
currSentIndex = 0
_showLocalBox('sent', currSentIndex, 10)
elif currTimeline == 'inbox':
currInboxIndex -= 10
if currInboxIndex < 0:
currInboxIndex = 0
_showLocalBox('inbox', currInboxIndex, 10)
elif keyPress == 'reply' or keyPress == 'r':
if speakerJson.get('id'):
postId = speakerJson['id']