onBuddyList is not fired

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

Nebulous
Posts: 13
Joined: 30 Jul 2009, 21:18

onBuddyList is not fired

Postby Nebulous » 16 Sep 2009, 22:15

Hello,
I'm having an issue where onBuddyList isn't called when the buddy list is received. I have SFS Pro 1.6.6 and the latest SFS_CSharp, version 1.2.3.

Here's my code. Note that "RegisterCallbacks" does appear in my output, and "OnBuddyList" appears if I call SFSEvent.onBuddyList myself.

Code: Select all

private void RegisterCallbacks()
{
    Debug.Log("RegisterCallbacks");
    SFSEvent.onBuddyList += OnBuddyList;
}
void OnBuddyList(ArrayList buddyList)
{
    Debug.Log("OnBuddyList");
    // More processing on buddyList here...
}

//And elsewhere...
SmartFox.Connection.LoadBuddyList();
//Where SmartFox.Connection is our instance of SmartFoxClient


Server output:
INFO | jvm 1 | 2009/09/16 15:51:05 | 15:51:05.242 - [ INFO ] > { DATA IN } : <msg t='sys'><body action='loadB' r='-1'></body></msg>
INFO | jvm 1 | 2009/09/16 15:51:05 | 15:51:05.244 - [ INFO ] > { DATA OUT } : <msg t='sys'><body action='bList' r='-1'><bList></bList></body></msg>


Client output:
FriendListControl: Update - Need to get friends list
[SFS DEBUG] [Sending]: <msg t='sys'><body action='loadB' r='-1'></body></msg>
[SFS DEBUG] [ RECEIVED ]: <msg t='sys'><body action='bList' r='-1'><bList></bList></body></msg>, (len: 69)

[/code]

So, it received the 'bList' from the SFS server, but my OnBuddyList function never got called. My buddy list is empty, but that shouldn't make a difference. Also, if I don't add my function to onBuddyList, I don't see "Trying to call onBuddyList, but no callback is registered" printed either. Could there be some bug in the SFS_CSharp code that's supposed to generate the onBuddyListEvent?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 17 Sep 2009, 19:28

Hey hey

Thanks for the report - I'll look into it asap, but cant before Monday. Not home all weekend.

But I've noted this down and will report back once I get back!

/Thomas
Nebulous
Posts: 13
Joined: 30 Jul 2009, 21:18

Postby Nebulous » 22 Sep 2009, 17:47

Thanks Thomas! We'll be waiting to hear back from you.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 24 Sep 2009, 10:36

Hey hey

Sorry for taking so long to look at this - suuuuper busy.

Just a quick question - do you get a callback on the buddylisterror event?

I've looked at the code, and I am pretty sure it gives you a BuddyListError due to the buddy list being empty.

I'll have to check a little with the flash API to make sure that an empty list is being treated the same, but it might be a error to throw an error on the empty list.

If there are buddies in the list, then you should definitely get a callback on the BuddyList event. Can you confirm that?

/Thomas
Nebulous
Posts: 13
Joined: 30 Jul 2009, 21:18

Postby Nebulous » 25 Sep 2009, 18:20

Ok, I get this now:
An error occurred while loading the buddy list:

I guess I was just expecting SFSEvent.onBuddyList to be called with an empty ArrayList, instead of SFSEvent.onBuddyListError with an empty String.

When you get time, it might be worthwhile to make that change, or at least explain this behavior in the LoadBuddyList Method documentation, and return an error String to onBuddyListError. Also, if no SFSEvent.onBuddyListError delegate exists, you could print an error so that others won't repeat my dumb mistake. :)

Thanks!
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 27 Sep 2009, 08:32

Hey

Yeah, I would myself also expect a callback on the normal (and not the error) list. Having no buddies is lonely - but not an error ;-)

I'll put this onto the "to fix" list for next version for sure, as its not logical correct

/Thomas

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 2 guests