self.log(f'Sent msg obj to {name_or_pubkey}: {msg_obj}')
self.stat(f'Message successfully sent to @{name_or_pubkey}.\n{msg_obj}')
defcheck(self,dat):
ifself.with_required_login():
res=self.komrade.refresh()
ifnotres['success']:
self.stat(res['status'])
else:
unr=res.get('unread',[])
inb=res.get('inbox',[])
self.stat(f'You have {len(unr)} unread messages, with {len(inb)} total in your inbox.')
defcheck(self,dat=None,res=None,statd={}):
self.log(f'<-- dat={dat}, res={res}')
ifnotres:
ifself.with_required_login():
res=self.komrade.refresh()
ifnotres['success']:
self.stat(res['status'])
return
unr=res.get('unread',[])
inb=res.get('inbox',[])
self.stat(f'You have {len(unr)} unread messages,',f'with {len(inb)} total in your inbox.',**statd)
self.log(f'--> unr={unr}, inb={inb}')
# stop
defprompt_adduser(self,msg):
# self.print('prompt got:',msg)
@ -251,33 +274,41 @@ class CLI(Logger):
meet_name=msg.data.get('meet_name')
meet_uri=msg.data.get('meet')
qrstr=self.komrade.qr_str(meet_uri)
do_adduser=input(f'''@Operator: Add @{meet_name}'s public key to your address book? It will allow you and @{meet_name} to read and write encrypted messages to one another.\n\n{self.komrade} [y/N]: ''')
self.stat(f"Add @{meet_name}'s public key to your address book?",f'It will allow you and @{meet_name} to read and write encrypted messages to one another.')
do_adduser=input(f'''\n{self.komrade} [y/N]: ''')
ifdo_adduser.strip().lower()=='y':
fnfn=self.komrade.save_uri_as_qrcode(
meet_uri,
meet_name
)
clear_screen()
self.stat(f'The public key of @{meet_name} has been saved as a QRcode to {fnfn}:\n{qrstr}')
self.stat(f'The public key of @{meet_name} has been saved as a QRcode to {fnfn}')
print(qrstr)
do_pause()
clear_screen()
do_senduser=input(f'''\n@Operator: Send this user your public key as well?\n\n{self.komrade} [y/N]: ''')
self.stat('Send this user your public key as well?')