mirror of
https://github.com/ComradCollective/Comrad
synced 2024-11-05 21:20:51 +00:00
updates
This commit is contained in:
parent
99770e5055
commit
0837c019e1
@ -316,6 +316,33 @@ class KomradeX(Caller):
|
||||
route='deliver_msg'
|
||||
)
|
||||
|
||||
def check_mail(self,inbox=None):
|
||||
if not self.pubkey and self.privkey:
|
||||
return {'success':False,'status':'Need to be logged in'}
|
||||
|
||||
# checking my own mail I presume?
|
||||
if not inbox:
|
||||
inbox=self.pubkey.data_b64
|
||||
|
||||
# send info op needs
|
||||
msg = {
|
||||
'secret_login':self.secret_login,
|
||||
'name':self.name,
|
||||
'pubkey':self.pubkey.data_b64,
|
||||
'inbox':inbox
|
||||
}
|
||||
self.log('sending msg to op:',msg)
|
||||
|
||||
res = self.ring_ring(msg,route='read_mail')
|
||||
self.log('got back response:',res)
|
||||
|
||||
# # decrypt?
|
||||
# SMessage(
|
||||
# self.privkey.data,
|
||||
# self.op.pubkey.data
|
||||
# ).unwrap()
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def test_register():
|
||||
|
@ -402,6 +402,28 @@ from_komrade = {from_komrade}
|
||||
|
||||
return {'status':'Message delivered.', 'success':True}
|
||||
|
||||
def check_mail(self,
|
||||
msg_to_op,
|
||||
required_fields = [
|
||||
'secret_login',
|
||||
'name',
|
||||
'pubkey',
|
||||
'inbox',
|
||||
]):
|
||||
|
||||
# logged in?
|
||||
login_res = self.login(msg_to_op)
|
||||
if not login_res.get('success'):
|
||||
return login_res
|
||||
|
||||
# ok, then find the inbox?
|
||||
inbox=msg_to_op.data.get('inbox')
|
||||
if not inbox: inbox=msg_to_op.data.get('pubkey')
|
||||
if not inbox: return {'success':False, 'status':'No inbox specified'}
|
||||
inbox_encr = self.crypt_keys.get(b64enc(inbox),prefix='/inbox/')
|
||||
|
||||
# fine: here, try this on for size
|
||||
return inbox_encr
|
||||
|
||||
|
||||
def test_op():
|
||||
|
@ -14,7 +14,8 @@ class CLI(Logger):
|
||||
'login':'log back in',
|
||||
'meet':'meet a komrade',
|
||||
'who':'show contacts or info',
|
||||
'msg':'write people'
|
||||
'msg':'write people',
|
||||
'check':'check mail'
|
||||
}
|
||||
|
||||
def __init__(self,name='',cmd='',persona=None):
|
||||
@ -67,7 +68,8 @@ class CLI(Logger):
|
||||
/register [name] --> new komrade""" + (("""
|
||||
/meet [name] --> exchange info
|
||||
/msg [name] [msg] --> write to person or group
|
||||
/who [name] --> show contact info""")
|
||||
/who [name] --> show contact info
|
||||
/check --> check for new posts""")
|
||||
if self.with_required_login(quiet=True) else "") + """
|
||||
/help --> seek help
|
||||
"""
|
||||
@ -149,7 +151,9 @@ class CLI(Logger):
|
||||
)
|
||||
self.log(f'Sent msg obj to {name_or_pubkey}: {msg_obj}')
|
||||
|
||||
|
||||
def check(self,dat):
|
||||
if self.with_required_login():
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user