Page 1 of 1
how to get the buddylist length from the serverside?
Posted: 08 Mar 2011, 17:49
by mhdside
It might be a noob question, How to get a user's buddylist details like the buddies themselves, and the list length from the server side?
Posted: 09 Mar 2011, 00:28
by BigFIsh
You could use BuddyListManager to do this.
Firstly, get the zone's buddy list manager --> zone.getBuddyManager();
And, secondary use the
loadBuddyList method to fetch the buddy list of a user. Then get its length.
I haven't tried this - let me know if it doesn't work.
Posted: 09 Mar 2011, 13:29
by mhdside
Yeah, it works buddy! thanks for your help.
now I wonder whats the difference between loadBuddyList() and getBuddyList()

Posted: 09 Mar 2011, 16:48
by mhdside
Also the following function in the java serverside doesnt work:
Code: Select all
removeBuddy(java.lang.String owner, java.lang.String buddyName)
any info why?
Posted: 09 Mar 2011, 21:47
by BigFIsh
now I wonder whats the difference between loadBuddyList() and getBuddyList()
I'm not sure actually. What do you get from getBuddyList() ?
As for your second question, here's a snippet from the documentation:
Methods such as addBuddy, removeBuddy etc... will perform the change on the server side but won't dispatch any event back to the clients. When you have done all the changes to one or more buddy lists you can broadcast the changes by calling the sendBuddyListUpdate() method.
Posted: 09 Mar 2011, 23:24
by rjgtav
I think I can help here
The buddylists are saved in a database (i think in a h2database in sfs1.x), so sfs needs to load a buddylist from the database before editing it. For better performance, sfs only loads the necessary buddyLists, i mean, it only loads the buddylists of the users that are online.
So:
- loadBuddyList() - loads the buddyList from the database (idk if it returns it or not, as i haven't tried it in sfs1.x)
- getBuddyList() - returns an already loaded buddyList.
Sorry, but idk when to use each one in sfs1.x, as i only tried it in sfs2.x.
Hope this was helpful
*EDIT*
Just remembered one thing. You usually use loadBuddyList to access a buddyList from an user that is offline (so his buddyList isnt loaded) and then perform changes such as removeBuddy, addBuddy, etc. Then you need to save it (at least in sfs2.x you need).
Normally you use the getBuddyList to perform changes in buddyLists that are already loaded.