» The Buddy List API

SmartFoxServer 2X provides a new set of client and server API specifically designed for managing Buddies and Buddy Lists including persistence, custom states, ability to go online/offline, runtime and persistent Buddy Variables, server side events and more... The new Buddy API (version 3.0) are loosely based on the previous SFS 1.x Buddy List framework, although we attempted to provide a more simplified approach, better flexibility and more advanced features.

If you are familiar with the previous system you will notice the following differences:

» New features

The following is a rapid overview of the new features and improvements added in the framework:

» Buddy List Persistence

The Buddy List persistence is delegated to an implementation of the BuddyStorage interface found under the com.smartfoxserver.v2.buddylist.storage package. This is the skeleton of the interface:
 
void init();
void destroy();
 
BuddyList loadList(String ownerName) throws SFSBuddyListNotFoundException, IOException;
void saveList(BuddyList buddyList) throws IOException;
List<BuddyVariable> getOfflineVariables(String buddyName) throws IOException;
 
BuddyListManager getBuddyListManager();
void setBuddyListManager(BuddyListManager buddyListManager);

The init() and destroy() method are called upon creation and destruction of the class, while the BuddyListManager getter/setter is used to maintain a reference to the BuddyListManager object that governs the Buddy Lists in the current Zone. The remaining methods represent the core of the persistence mechanism, which is very simple.

You will be able to provide your custom implementation by simply dropping your .jar file in the SFS2X lib/ folder and providing the fully qualified name of the storage class in the AdminTool (Zone Configurator -> BuddyList tab).

Buddy Tab

>> DOWNLOAD the the default BuddyStorage source code <<