Package com.smartfoxserver.v2.buddylist
Interface Buddy
-
- All Known Implementing Classes:
SFSBuddy
public interface Buddy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ISFSArraygetBuddyVariablesData()java.lang.StringgetName()The Buddy name, which corresponds to the User name.java.lang.StringgetNickName()Get the nickname of the Buddy.BuddyListgetParentBuddyList()Return the parent BuddyList containing this Buddyjava.lang.StringgetState()Returns the current Buddy StateBuddyVariablegetVariable(java.lang.String varName)Get a Buddy Variable from its namejava.util.List<BuddyVariable>getVariables()Get all BuddyVariablesbooleanhasVariables()Checks if the Buddy has at least one variable setbooleanisBlocked()When a Buddy is blocked he won't be able to see the User status and send him messagesbooleanisOnline()Checks if the Buddy is active in the systembooleanisTemp()A temporary Buddy will only exist at runtime but will be lost as soon as he goes away or the user is disconnected.voidsetBlocked(boolean value)Block the BuddyvoidsetIsTemp(boolean value)voidsetParentBuddyList(BuddyList parentList)Set the parent BuddyListvoidsetVariable(BuddyVariable buddyVariable)Set / modify a BuddyVariable.voidsetVariables(java.util.List<BuddyVariable> buddyVariables)Sets a number of variables at once.ISFSArraytoSFSArray()
-
-
-
Method Detail
-
getName
java.lang.String getName()
The Buddy name, which corresponds to the User name.- Returns:
- the name of the buddy
-
getState
java.lang.String getState()
Returns the current Buddy State- Returns:
- the current buddy states
-
getNickName
java.lang.String getNickName()
Get the nickname of the Buddy. By default no Buddies have no nickname set
-
isBlocked
boolean isBlocked()
When a Buddy is blocked he won't be able to see the User status and send him messages- Returns:
- true if the Buddy is blocked
-
setBlocked
void setBlocked(boolean value)
Block the Buddy- Parameters:
value- true to block the buddy, false to unblock him
-
isTemp
boolean isTemp()
A temporary Buddy will only exist at runtime but will be lost as soon as he goes away or the user is disconnected. It is never saved.- Returns:
- true if the Buddy is temporary
-
setIsTemp
void setIsTemp(boolean value)
-
isOnline
boolean isOnline()
Checks if the Buddy is active in the system- Returns:
- true if the Buddy is online
-
getParentBuddyList
BuddyList getParentBuddyList()
Return the parent BuddyList containing this Buddy- Returns:
- the parent BuddyList
-
setParentBuddyList
void setParentBuddyList(BuddyList parentList)
Set the parent BuddyList- Parameters:
parentList- the BuddyList
-
hasVariables
boolean hasVariables()
Checks if the Buddy has at least one variable set- Returns:
- true if at least 1 variable exists for this buddy
-
getVariable
BuddyVariable getVariable(java.lang.String varName)
Get a Buddy Variable from its name- Parameters:
varName- the variable name- Returns:
- the BuddyVariable or null if no variables was ever set with that name
-
getVariables
java.util.List<BuddyVariable> getVariables()
Get all BuddyVariables- Returns:
- a List with all the BuddyVariables
-
setVariable
void setVariable(BuddyVariable buddyVariable)
Set / modify a BuddyVariable.
By convention any variables starting with a '$' (dollar sign) will be stored persistently when the use goes off-line
Persistent variables are available even when the Buddy is not online.- Parameters:
buddyVariable- the Buddy Variable
-
setVariables
void setVariables(java.util.List<BuddyVariable> buddyVariables)
Sets a number of variables at once.- Parameters:
buddyVariables- a list of variables
-
toSFSArray
ISFSArray toSFSArray()
-
getBuddyVariablesData
ISFSArray getBuddyVariablesData()
-
-