Send a message to a user using the username
Send a message to a user using the username
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?
I mean, with our login sys we don't allow 2 users to login with the same name but different case.Lapo wrote:Methods, functions, variables etc... are always case sensitive.
like username vs UserName, we consider that to be the same user.
so when i'm using getUserByName() it only works when i enter the name with the right case, so I was wondering if there was one that was case-insensitive.