Class SFSBuddyManager
- All Implemented Interfaces:
IBuddyManager
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclearAll()booleancontainsBuddy(String name) Indicates whether a buddy exists in user's buddies list or not.getBuddyById(int id) Retrieves a Buddy object from its id property.getBuddyByName(String name) Retrieves a Buddy object from its name property.getBuddyByNickName(String nickName) Retrieves a Buddy object from its nickName property (if set).Returns a list of Buddy objects representing all the buddies in the user's buddies list.Returns a list of strings representing the available custom buddy states.Gets the nickname of the current User or the User's name, if nickname is not setReturns the current user's nickname (if set).booleanReturns the current user's online/offline state.Returns the current user's custom state (if set).getMyVariable(String varName) Retrieves a Buddy Variable from its name.Returns all the Buddy Variables associated with the current user.Returns a list of Buddy objects representing all the offline buddies in the user's buddies list.Returns a list of Buddy objects representing all the online buddies in the user's buddies list.booleanisInited()Indicates whether the client's Buddy List system is initialized or not.removeBuddyById(int id) removeBuddyByName(String name) voidsetBuddyStates(List<String> states) voidsetInited(boolean inited) voidsetMyNickName(String nickName) voidsetMyOnlineState(boolean isOnline) voidsetMyState(String state) voidsetMyVariable(BuddyVariable bVar) voidsetMyVariables(List<BuddyVariable> variables)
-
Field Details
-
buddiesByName
-
myVariables
-
inited
protected boolean inited
-
-
Constructor Details
-
SFSBuddyManager
Creates a new SFSBuddyManager instance.NOTE: developers never instantiate a SFSBuddyManager manually: this is done by the SmartFoxServer 3 API internally. A reference to the existing instance can be retrieved using the SmartFox.getBuddyManager() method.
- Parameters:
sfs- An instance of the SmartFoxServer 3 client API main SmartFox class.- See Also:
-
-
Method Details
-
isInited
public boolean isInited()Description copied from interface:IBuddyManagerIndicates 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.
- Specified by:
isInitedin interfaceIBuddyManager- See Also:
-
setInited
public void setInited(boolean inited) - Specified by:
setInitedin interfaceIBuddyManager
-
addBuddy
- Specified by:
addBuddyin interfaceIBuddyManager
-
removeBuddyById
- Specified by:
removeBuddyByIdin interfaceIBuddyManager
-
removeBuddyByName
- Specified by:
removeBuddyByNamein interfaceIBuddyManager
-
containsBuddy
Description copied from interface:IBuddyManagerIndicates whether a buddy exists in user's buddies list or not.- Specified by:
containsBuddyin interfaceIBuddyManager- Parameters:
name- The name of the buddy whose presence in the buddies list is to be tested.- Returns:
trueif the specified buddy exists in the buddies list.- See Also:
-
getBuddyById
Description copied from interface:IBuddyManagerRetrieves a Buddy object from its id property.- Specified by:
getBuddyByIdin interfaceIBuddyManager- Parameters:
id- The id of the buddy to be found.- Returns:
- The Buddy object representing the buddy, or
nullif no buddy with the passed id exists in the buddies list. - See Also:
-
getBuddyByName
Description copied from interface:IBuddyManagerRetrieves a Buddy object from its name property.- Specified by:
getBuddyByNamein interfaceIBuddyManager- Parameters:
name- The name of the buddy to be found.- Returns:
- The Buddy object representing the buddy, or
nullif no buddy with the passed name exists in the buddies list. - See Also:
-
getBuddyByNickName
Description copied from interface:IBuddyManagerRetrieves a Buddy object from its nickName property (if set).- Specified by:
getBuddyByNickNamein interfaceIBuddyManager- Parameters:
nickName- The nickName of the buddy to be found.- Returns:
- The Buddy object representing the buddy, or
nullif no buddy with the passed nickName exists in the buddies list. - See Also:
-
getOfflineBuddies
Description copied from interface:IBuddyManagerReturns a list of Buddy objects representing all the offline buddies in the user's buddies list.- Specified by:
getOfflineBuddiesin interfaceIBuddyManager- See Also:
-
getOnlineBuddies
Description copied from interface:IBuddyManagerReturns a list of Buddy objects representing all the online buddies in the user's buddies list.- Specified by:
getOnlineBuddiesin interfaceIBuddyManager- See Also:
-
getBuddyList
Description copied from interface:IBuddyManagerReturns a list of Buddy objects representing all the buddies in the user's buddies list. The list isnullif the Buddy List system is not initialized.- Specified by:
getBuddyListin interfaceIBuddyManager- See Also:
-
getBuddyStates
Description copied from interface:IBuddyManagerReturns 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 3 Administration Tool.- Specified by:
getBuddyStatesin interfaceIBuddyManager- See Also:
-
getMyVariable
Description copied from interface:IBuddyManagerRetrieves a Buddy Variable from its name.- Specified by:
getMyVariablein interfaceIBuddyManager- Parameters:
varName- The name of the Buddy Variable to be retrieved.- Returns:
- The BuddyVariable object representing the Buddy Variable, or
nullif no Buddy Variable with the passed name is associated with the current user. - See Also:
-
getMyVariables
Description copied from interface:IBuddyManagerReturns all the Buddy Variables associated with the current user.- Specified by:
getMyVariablesin interfaceIBuddyManager- See Also:
-
getMyOnlineState
public boolean getMyOnlineState()Description copied from interface:IBuddyManagerReturns the current user's online/offline state. Iftrue, 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.
- Specified by:
getMyOnlineStatein interfaceIBuddyManager- See Also:
-
getMyNickName
Description copied from interface:IBuddyManagerReturns the current user's nickname (if set). If the nickname was never set before,nullis 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.
- Specified by:
getMyNickNamein interfaceIBuddyManager- See Also:
-
getMyState
Description copied from interface:IBuddyManagerReturns 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,nullis 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.
- Specified by:
getMyStatein interfaceIBuddyManager- See Also:
-
getMyDisplayName
Description copied from interface:IBuddyManagerGets the nickname of the current User or the User's name, if nickname is not set- Specified by:
getMyDisplayNamein interfaceIBuddyManager- Returns:
- nickname of the current User or the User's name, if nickname is not set
-
setMyVariable
- Specified by:
setMyVariablein interfaceIBuddyManager
-
setMyVariables
- Specified by:
setMyVariablesin interfaceIBuddyManager
-
setMyOnlineState
- Specified by:
setMyOnlineStatein interfaceIBuddyManager- Throws:
SFSException
-
setMyNickName
- Specified by:
setMyNickNamein interfaceIBuddyManager- Throws:
SFSException
-
setMyState
- Specified by:
setMyStatein interfaceIBuddyManager- Throws:
SFSException
-
setBuddyStates
- Specified by:
setBuddyStatesin interfaceIBuddyManager
-
clearAll
public void clearAll()- Specified by:
clearAllin interfaceIBuddyManager
-