Page 1 of 1

How to get room information of friends ?

Posted: 01 Oct 2013, 08:09
by hoangdoanh
Hi all

I want to get information of the rooms in that friends of some user are playing.

In ios library we can get buddyList by code :

Code: Select all

     NSArray *   buddyList   =   [smartFox.buddyManager buddyList];
From buddyList, we can get buddy :

Code: Select all

SFSBuddy    *   buddy=[buddyList objectAtIndex:i];
But from buddy I can't found API to find information of room in that this buddy(user) are playing.

Could you please advice me on this !

Kind regards,
Doanh

Re: How to get room information of friends ?

Posted: 01 Oct 2013, 09:01
by Lapo
You will need some server code to obtain that information.
You can add an extension command that given a User's name finds the Room(s) where the user is active and sends you back the information you need.

Cheers

Re: How to get room information of friends ?

Posted: 01 Oct 2013, 09:22
by hoangdoanh
Thanks Lapo !

Could you please help me to understant 2 points :

1.How on server : from User we can get his buddy list ?

2.Why on client-side, there is not some method to do that without writing extension part ? Is there any security reason ?

Kind regards,
Doanh

Re: How to get room information of friends ?

Posted: 01 Oct 2013, 10:44
by Lapo
hoangdoanh wrote: 1.How on server : from User we can get his buddy list ?
Each Zone has its own buddy list manager... so you just need the name of the User to access his buddy list:

Code: Select all

BuddyListManager manager = getParentZone().getBuddyListManager();
BuddyList buddyList = manager.getBuddyList("the user name");
2.Why on client-side, there is not some method to do that without writing extension part ? Is there any security reason ?
Yes, that's correct. Otherwise people could use custom clients to "spy" other user's buddy lists. :)

Cheers

Re: How to get room information of friends ?

Posted: 01 Oct 2013, 10:56
by hoangdoanh
These are great answer Lapo !

Thank you very much

Kind regards,
Doanh