Class InitBuddyListRequest

  • All Implemented Interfaces:
    sfs2x.client.requests.IRequest

    public class InitBuddyListRequest
    extends BaseRequest
    Initializes the Buddy List system on the current client.

    Buddy List system initialization involves loading any previously stored buddy-specific data from the server, such as the current user's buddies list, his previous state and the persistent Buddy Variables. The initialization request is the first operation to be executed in order to be able to use the Buddy List system features. Once the initialization is completed, the buddyListInit event is fired and the user has access to all his previously set data and can start to interact with his buddies; if the initialization failed, a buddyError event is fired.

    Example
    The following example initializes the Buddy List system:

     private void someMethod() {
         sfs.addEventListener(SFSBuddyEvent.BUDDY_LIST_INIT, new IEventListener() {
             public void dispatch(BaseEvent evt) throws SFSException {
                 System.out.println("Buddy List system initialized successfully");
                 
                 // Retrieve my buddies list
                 List buddies = sfs.getBuddyManager().getBuddyList();
                 
                 // Display the online buddies in a list component in the application interface
                 ...
             }
         });
         
         sfs.addEventListener(SFSBuddyEvent.BUDDY_ERROR, new IEventListener() {
             public void dispatch(BaseEvent evt) throws SFSException {
                 System.out.println("The following error occurred while executing a buddy-related request:" + evt.getArguments().get("errorMessage"));
             }
         });
         
         // Initialize the Buddy List system
         sfs.send(new InitBuddyListRequest());
     }
     
    See Also:
    SFSBuddyEvent.BUDDY_LIST_INIT, SFSBuddyEvent.BUDDY_ERROR
    • Field Detail

      • KEY_BLIST

        public static final java.lang.String KEY_BLIST
        * API internal usage only *
        See Also:
        Constant Field Values
      • KEY_BUDDY_STATES

        public static final java.lang.String KEY_BUDDY_STATES
        * API internal usage only *
        See Also:
        Constant Field Values
      • KEY_MY_VARS

        public static final java.lang.String KEY_MY_VARS
        * API internal usage only *
        See Also:
        Constant Field Values
    • Constructor Detail

      • InitBuddyListRequest

        public InitBuddyListRequest()
        Creates a new InitBuddyListRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
        See Also:
        SmartFox.send(sfs2x.client.requests.IRequest)
    • Method Detail

      • validate

        public void validate​(ISmartFox sfs)
                      throws sfs2x.client.exceptions.SFSValidationException
        * API internal usage only *
        Throws:
        sfs2x.client.exceptions.SFSValidationException
      • execute

        public void execute​(ISmartFox sfs)
        * API internal usage only *