How to get room information of friends ?

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

How to get room information of friends ?

Postby hoangdoanh » 01 Oct 2013, 08:09

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

Re: How to get room information of friends ?

Postby Lapo » 01 Oct 2013, 09:01

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
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Re: How to get room information of friends ?

Postby hoangdoanh » 01 Oct 2013, 09:22

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

Re: How to get room information of friends ?

Postby Lapo » 01 Oct 2013, 10:44

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
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
hoangdoanh
Posts: 253
Joined: 21 Jun 2013, 04:54
Location: Vietnam

Re: How to get room information of friends ?

Postby hoangdoanh » 01 Oct 2013, 10:56

These are great answer Lapo !

Thank you very much

Kind regards,
Doanh

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 37 guests