Send a message to a user using the username
Posted: 12 Mar 2009, 18:20
The only ways i found in the docs to send a message to a user are based on the CHANNEL or the ID.
Can i send a message using only the unique username? Something like:
_server.sendResponse(response,fromRoom,sender,recipient as String)
The only way i found is to get all the user in the room:
var zone = _server.getCurrentZone();
var main=zone.getRoom(1);
var utenti=main.getAllUsers()
cycle trough those user and find the one with the username i am looking for, get a user object from this and then send the message using the id.
Seem pretty inefficient to me.
Is there a better way?
Can i send a message using only the unique username? Something like:
_server.sendResponse(response,fromRoom,sender,recipient as String)
The only way i found is to get all the user in the room:
var zone = _server.getCurrentZone();
var main=zone.getRoom(1);
var utenti=main.getAllUsers()
cycle trough those user and find the one with the username i am looking for, get a user object from this and then send the message using the id.
Seem pretty inefficient to me.
Is there a better way?