Hey! So I was using Smartfox Server 1.6x and there was a handy function (it might have been undocumented) called getAllUsersButOne(int userIndex) which was a nice convenient way of getting a list of users in a room but excluding one of the users (usually the user who sent the extension request) so you could send a message to all of the users but 1 of them.
So if a user wanted to broadcast a message to all the other users in the room, it was a nice easy way to set that up.
Now we are using Smartfox Server 2X and I can't seem to find anything equivalent to that function. At the moment, I wrote my own that will get a list of all the users in the room, go through each one and check if it was the same user that sent the request, and if so it removes them from the list. Which is fine, but if there is a function that will do it all for me and keep my code cleaner, that would be awesome.
Is there such a function?
GetAllUsersButOne ?
-
- Posts: 57
- Joined: 26 Oct 2010, 14:03
- Location: South Pasadena California
- Contact:
Re: GetAllUsersButOne ?
Hi,
there isn't such functionality, but it's extremely simple to implement:
Where the 1st line obtains the list of users inside a Room and the next removes one user from the list before we proceed with doing something with it (the list)
Cheers
there isn't such functionality, but it's extremely simple to implement:
Code: Select all
List<User> peopleInRoom = room.getUserList();
peopleInRoom.remove(someUser);
Where the 1st line obtains the list of users inside a Room and the next removes one user from the list before we proceed with doing something with it (the list)
Cheers
-
- Posts: 57
- Joined: 26 Oct 2010, 14:03
- Location: South Pasadena California
- Contact:
Re: GetAllUsersButOne ?
Hmmm, that is way simpler than what I currently have. Thanks for the tip Lapo!
Who is online
Users browsing this forum: No registered users and 48 guests