diff --git a/komrade/backend/komrades.py b/komrade/backend/komrades.py index 0bfb11d..4bb25d5 100644 --- a/komrade/backend/komrades.py +++ b/komrade/backend/komrades.py @@ -288,11 +288,15 @@ def test_register(): marxbot.register(passphrase='spectre') + def test_msg(): - z = locate_an_operator('zuck') + z = comlink('zuck') z.login(passphrase='eee') - s = locate_an_operator('sergey') - z.send_msg_to('you ssssssuck',s) + + s = comlink('sergey') + + z.send_msg_to('you ssssssuck') + if __name__=='__main__': test_msg() diff --git a/komrade/backend/operators.py b/komrade/backend/operators.py index 1d39200..a0ffe9c 100644 --- a/komrade/backend/operators.py +++ b/komrade/backend/operators.py @@ -9,10 +9,11 @@ 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)==str: 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 comlink(name_or_pubkey): return locate_an_operator_somehow(x) PHONEBOOK = {}