2
0
mirror of https://github.com/ComradCollective/Comrad synced 2024-11-05 21:20:51 +00:00
This commit is contained in:
quadrismegistus 2020-09-13 19:06:41 +01:00
parent ca2dec4433
commit 20cb7ebdee
3 changed files with 40 additions and 1 deletions

View File

@ -222,6 +222,25 @@ class Komrade(Caller):
## MEETING PEOPLE
def find(self,someone):
if type(someone)==str:
return Komrade(name=someone)
if type(someone)==bytes:
return Komrade(pubkey=someone)
self.log('what is type of someoen here?',type(someone))
return someone
def meet(self,someone):
# get person obj
someone = self.find(someone)
self.log('got someone =',someone,type(someone))
def ring_ring(self,msg,route=None,**y):

View File

@ -7,6 +7,11 @@ from komrade import *
# from komrade.backend.switchboard import *
from komrade.backend import *
def locate_an_operator_somehow(str_or_byte_or_obj):
if issubclass(type(str_or_byte_or_obj),Operator): return str_or_byte_or_obj
if type(str_or_byte_or_obj)==bytes: return locate_an_operator(name=str_or_byte_or_obj)
if type(str_or_byte_or_obj)==bytes: return locate_an_operator(pubkey=str_or_byte_or_obj)
raise KomradeException(type(str_or_byte_or_obj),'???')
def locate_an_operator(name=None,pubkey=None):
global OPERATOR,TELEPHONE

View File

@ -6,6 +6,7 @@ import textwrap as tw
HELPSTR = """
/login [name] --> log back in
/register [name] --> new komrade
/meet [name] --> exchange info
/help --> seek help
"""
@ -13,7 +14,8 @@ class CLI(Logger):
ROUTES = {
'help':'seek help',
'register':'join the komrades',
'login':'log back in'
'login':'log back in',
'meet':'meet a komrade'
}
def __init__(self,name='',cmd='',persona=None):
@ -108,6 +110,19 @@ class CLI(Logger):
return None
return self._name
@property
def logged_in(self):
return (self._loggedin and self._komrade and self._name)
def meet(self,name):
if not self.logged_in:
print('@Operator: You must be logged in first.\n')
if not name:
name=input(f'@Operator: To whom would you like to introduce yourself?\n\n@{self.name}: ')
if not name: return
# meet?
self.komrade.meet(name)