Exemplo n.º 1
0
 def request_unichat(self, uuid, srcuser, dstuser, msglen, msgbody):
     m = TPC_Client_Message.request_unichat(srcuser, dstuser, msglen,
                                            msgbody, uuid)
     print m
     raw_res = process_normal_message(m)
     res = parser.parse(raw_res)
     return res
Exemplo n.º 2
0
    def request_register(self, username, password):
        m = TPC_Client_Message.request_register(username, password)
        raw_res = process_normal_message(m)
        res = parser.parse(raw_res)
        return res


#c = TPC_Client_Request()
#m = c.request_login("bbrabbit2", "12ws34rf")
#m = c.request_logout("b7b96ba6-f87f-11e7-b1d3-6a0002256a80")
#print m
Exemplo n.º 3
0
def request_handler(msg):
    handlers = {
        "login": respond_login,
        "logout": respond_logout,
        "register": respond_register,
        "list": respond_userlist,
        "unichat": respond_unichat
    }
    parsed = parser.parse(msg)
    print parsed
    cli_msg = TPC_Helpers.tpc_parse_helper(parsed)
    func = handlers[cli_msg['type']]
    varnames = func.__doc__.split(',')
    arglist = []
    print cli_msg
    for var in varnames:
        arglist.append(cli_msg[var])
    arglist = tuple(arglist)
    m = func(*arglist)
    return m
Exemplo n.º 4
0
 def request_login(self, username, password):
     m = TPC_Client_Message.request_login(username, password)
     raw_res = process_normal_message(m)
     res = parser.parse(raw_res)
     res = TPC_Helpers.tpc_parse_helper(res)
     return res
Exemplo n.º 5
0
 def request_userlist(self, uuid):
     m = TPC_Client_Message.request_userlist(uuid)
     raw_res = process_normal_message(m)
     res = parser.parse(raw_res)
     return res