Page 1 of 1

Send a message to a user using the username

Posted: 12 Mar 2009, 18:20
by dieffe
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?

Posted: 13 Mar 2009, 03:27
by Kalagaraz
zone.GetUserByName(string Name);

Posted: 13 Mar 2009, 06:25
by dieffe
Mmmm

TypeError: Cannot find function GetUserByName.

Posted: 13 Mar 2009, 06:45
by Kalagaraz
dieffe wrote:Mmmm

TypeError: Cannot find function GetUserByName.
try getUserByName(); no intellisense for you? :)

Posted: 02 Apr 2009, 16:47
by jamieyg3
Is there a case-insensitive version of getUserByName()?

Posted: 02 Apr 2009, 17:26
by Lapo
Methods, functions, variables etc... are always case sensitive.

Posted: 02 Apr 2009, 17:59
by jamieyg3
Lapo wrote:Methods, functions, variables etc... are always case sensitive.
I mean, with our login sys we don't allow 2 users to login with the same name but different case.

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.

Posted: 02 Apr 2009, 19:44
by Lapo
ah, sorry, didn't get it :oops:
Anyways no, the system is not case insensitive.

Posted: 22 Apr 2009, 18:31
by jamieyg3
Lapo wrote:ah, sorry, didn't get it :oops:
Anyways no, the system is not case insensitive.
What would be the best way to find a user based on their case-insensitive username?

Iterate through all the users and compare? or would there be a better way?

Posted: 22 Apr 2009, 21:16
by Lapo
yes, there's no other way I can think of