pass back userid/deviceid
This commit is contained in:
parent
8e186d5cdc
commit
061a631d44
3 changed files with 4 additions and 3 deletions
|
|
@ -202,7 +202,7 @@ func apiv0_createclient_pass(mxpassfile_path *C.char, storage_path *C.char, url
|
|||
mxclient.OnEvent = client.OnEvent
|
||||
mxclient.OnMessage = client.OnMessage
|
||||
cclients = append(cclients, client)
|
||||
out, err := json.Marshal(map[string]int{"id": len(cclients) - 1})
|
||||
out, err := json.Marshal(map[string]any{"id": len(cclients) - 1, "userid": client.UserID.String(), "deviceid": client.DeviceID.String()})
|
||||
if err != nil {
|
||||
return C.CString(fmt.Sprintf("ERR: %v", err))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,8 @@ class DemoBot(SMALBot):
|
|||
logger.error(f"not a room message: {msg}")
|
||||
return
|
||||
|
||||
if msg["sender"] == "get own id from missing code":
|
||||
if msg["sender"] == self.UserID:
|
||||
# ignore own messages
|
||||
# for now just do not send valid commands by yourself
|
||||
logger.info(f"ignore own message: {msg}")
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ class _MXClient:
|
|||
|
||||
result_dict = json.loads(result)
|
||||
self.client_id = result_dict["id"]
|
||||
self.UserID = result_dict["userid"]
|
||||
self.DeviceID = result_dict["deviceid"]
|
||||
|
||||
def _sync(self):
|
||||
r = lib.apiv0_startclient(self.client_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue