Interface IBuddyManager

  • All Known Implementing Classes:
    SFSBuddyManager

    public interface IBuddyManager
    The IBuddyManager interface defines all the methods and properties exposed by the client-side manager of the SmartFoxServer Buddy List system.

    In the SmartFoxServer 2X client API this interface is implemented by the SFSBuddyManager class. Read the class description for additional informations.

    See Also:
    SFSBuddyManager
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addBuddy​(Buddy buddy)
      * API internal usage only *
      void clearAll()
      * API internal usage only *
      boolean containsBuddy​(java.lang.String name)
      Indicates whether a buddy exists in user's buddies list or not.
      Buddy getBuddyById​(int id)
      Retrieves a Buddy object from its id property.
      Buddy getBuddyByName​(java.lang.String name)
      Retrieves a Buddy object from its name property.
      Buddy getBuddyByNickName​(java.lang.String nickName)
      Retrieves a Buddy object from its nickName property (if set).
      java.util.List<Buddy> getBuddyList()
      Returns a list of Buddy objects representing all the buddies in the user's buddies list.
      java.util.List<java.lang.String> getBuddyStates()
      Returns a list of strings representing the available custom buddy states.
      java.lang.String getMyNickName()
      Returns the current user's nickname (if set).
      boolean getMyOnlineState()
      Returns the current user's online/offline state.
      java.lang.String getMyState()
      Returns the current user's custom state (if set).
      BuddyVariable getMyVariable​(java.lang.String varName)
      Retrieves a Buddy Variable from its name.
      java.util.List<BuddyVariable> getMyVariables()
      Returns all the Buddy Variables associated with the current user.
      java.util.List<Buddy> getOfflineBuddies()
      Returns a list of Buddy objects representing all the offline buddies in the user's buddies list.
      java.util.List<Buddy> getOnlineBuddies()
      Returns a list of Buddy objects representing all the online buddies in the user's buddies list.
      boolean isInited()
      Indicates whether the client's Buddy List system is initialized or not.
      Buddy removeBuddyById​(int id)
      * API internal usage only *
      Buddy removeBuddyByName​(java.lang.String name)
      * API internal usage only *
      void setBuddyStates​(java.util.List<java.lang.String> states)
      * API internal usage only *
      void setInited​(boolean inited)
      * API internal usage only *
      void setMyNickName​(java.lang.String nickName)
      * API internal usage only *
      void setMyOnlineState​(boolean isOnline)
      * API internal usage only *
      void setMyState​(java.lang.String state)
      * API internal usage only *
      void setMyVariable​(BuddyVariable bVar)
      * API internal usage only *
      void setMyVariables​(java.util.List<BuddyVariable> variables)
      * API internal usage only *
    • Method Detail

      • isInited

        boolean isInited()
        Indicates whether the client's Buddy List system is initialized or not. If not, an InitBuddyListRequest request should be sent to the server in order to retrieve the persistent Buddy List data.

        No Buddy List related operations are allowed until the system is initialized.

        See Also:
        InitBuddyListRequest
      • setInited

        void setInited​(boolean inited)
        * API internal usage only *
      • addBuddy

        void addBuddy​(Buddy buddy)
        * API internal usage only *
      • removeBuddyById

        Buddy removeBuddyById​(int id)
        * API internal usage only *
      • removeBuddyByName

        Buddy removeBuddyByName​(java.lang.String name)
        * API internal usage only *
      • containsBuddy

        boolean containsBuddy​(java.lang.String name)
        Indicates whether a buddy exists in user's buddies list or not.
        Parameters:
        name - The name of the buddy whose presence in the buddies list is to be tested.
        Returns:
        true if the specified buddy exists in the buddies list.
        See Also:
        Buddy.getName()
      • getBuddyByName

        Buddy getBuddyByName​(java.lang.String name)
        Retrieves a Buddy object from its name property.
        Parameters:
        name - The name of the buddy to be found.
        Returns:
        The Buddy object representing the buddy, or null if no buddy with the passed name exists in the buddies list.
        See Also:
        Buddy.getName(), getBuddyById(int), getBuddyByNickName(java.lang.String)
      • getBuddyByNickName

        Buddy getBuddyByNickName​(java.lang.String nickName)
        Retrieves a Buddy object from its nickName property (if set).
        Parameters:
        nickName - The nickName of the buddy to be found.
        Returns:
        The Buddy object representing the buddy, or null if no buddy with the passed nickName exists in the buddies list.
        See Also:
        Buddy.getNickName(), getBuddyById(int), getBuddyByName(java.lang.String)
      • getOfflineBuddies

        java.util.List<Buddy> getOfflineBuddies()
        Returns a list of Buddy objects representing all the offline buddies in the user's buddies list.
        See Also:
        Buddy.isOnline()
      • getOnlineBuddies

        java.util.List<Buddy> getOnlineBuddies()
        Returns a list of Buddy objects representing all the online buddies in the user's buddies list.
        See Also:
        Buddy.isOnline()
      • getBuddyList

        java.util.List<Buddy> getBuddyList()
        Returns a list of Buddy objects representing all the buddies in the user's buddies list. The list is null if the Buddy List system is not initialized.
        See Also:
        isInited()
      • getBuddyStates

        java.util.List<java.lang.String> getBuddyStates()
        Returns a list of strings representing the available custom buddy states. The custom states are received by the client upon initialization of the Buddy List system. They can be configured by means of the SmartFoxServer 2X Administration Tool.
        See Also:
        Buddy.getState()
      • getMyVariable

        BuddyVariable getMyVariable​(java.lang.String varName)
        Retrieves a Buddy Variable from its name.
        Parameters:
        varName - The name of the Buddy Variable to be retrieved.
        Returns:
        The BuddyVariable object representing the Buddy Variable, or null if no Buddy Variable with the passed name is associated with the current user.
        See Also:
        getMyVariables(), SetBuddyVariablesRequest
      • getMyOnlineState

        boolean getMyOnlineState()
        Returns the current user's online/offline state. If true, the user appears to be online in the buddies list of other users who have him as a buddy.

        The online state of a user in a buddy list is handled by means of a reserved Buddy Variable (see ReservedBuddyVariables class); it can be changed using the dedicated GoOnlineRequest request.

        See Also:
        Buddy.isOnline(), ReservedBuddyVariables, GoOnlineRequest
      • getMyNickName

        java.lang.String getMyNickName()
        Returns the current user's nickname (if set). If the nickname was never set before, null is returned.

        As the nickname of a user in a buddy list is handled by means of a reserved Buddy Variable (see ReservedBuddyVariables class), it can be set using the SetBuddyVariablesRequest request.

        See Also:
        Buddy.getNickName(), ReservedBuddyVariables, SetBuddyVariablesRequest
      • getMyState

        java.lang.String getMyState()
        Returns the current user's custom state (if set). Examples of custom states are "Available", "Busy", "Be right back", etc. If the custom state was never set before, null is returned.

        As the custom state of a user in a buddy list is handled by means of a reserved Buddy Variable (see ReservedBuddyVariables class), it can be set using the SetBuddyVariablesRequest request.

        See Also:
        Buddy.getState(), ReservedBuddyVariables, SetBuddyVariablesRequest
      • setMyVariable

        void setMyVariable​(BuddyVariable bVar)
        * API internal usage only *
      • setMyVariables

        void setMyVariables​(java.util.List<BuddyVariable> variables)
        * API internal usage only *
      • setMyOnlineState

        void setMyOnlineState​(boolean isOnline)
                       throws com.smartfoxserver.v2.exceptions.SFSException
        * API internal usage only *
        Throws:
        com.smartfoxserver.v2.exceptions.SFSException
      • setMyNickName

        void setMyNickName​(java.lang.String nickName)
                    throws com.smartfoxserver.v2.exceptions.SFSException
        * API internal usage only *
        Throws:
        com.smartfoxserver.v2.exceptions.SFSException
      • setMyState

        void setMyState​(java.lang.String state)
                 throws com.smartfoxserver.v2.exceptions.SFSException
        * API internal usage only *
        Throws:
        com.smartfoxserver.v2.exceptions.SFSException
      • setBuddyStates

        void setBuddyStates​(java.util.List<java.lang.String> states)
        * API internal usage only *
      • clearAll

        void clearAll()
        * API internal usage only *