Send a message to a user using the username

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Send a message to a user using the username

Post 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?
Kalagaraz
Posts: 12
Joined: 06 Feb 2009, 15:55

Post by Kalagaraz »

zone.GetUserByName(string Name);
dieffe
Posts: 29
Joined: 27 Nov 2008, 09:08

Post by dieffe »

Mmmm

TypeError: Cannot find function GetUserByName.
Kalagaraz
Posts: 12
Joined: 06 Feb 2009, 15:55

Post by Kalagaraz »

dieffe wrote:Mmmm

TypeError: Cannot find function GetUserByName.
try getUserByName(); no intellisense for you? :)
jamieyg3
Posts: 84
Joined: 25 Sep 2008, 16:01

Post by jamieyg3 »

Is there a case-insensitive version of getUserByName()?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Methods, functions, variables etc... are always case sensitive.
Lapo
--
gotoAndPlay()
...addicted to flash games
jamieyg3
Posts: 84
Joined: 25 Sep 2008, 16:01

Post 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.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

ah, sorry, didn't get it :oops:
Anyways no, the system is not case insensitive.
Lapo
--
gotoAndPlay()
...addicted to flash games
jamieyg3
Posts: 84
Joined: 25 Sep 2008, 16:01

Post 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?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

yes, there's no other way I can think of
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply