Package com.smartfoxserver.buddylist
Class SFSBuddyListManager
java.lang.Object
com.smartfoxserver.buddylist.SFSBuddyListManager
- All Implemented Interfaces:
com.smartfoxserver.bitswarm.service.IService,BuddyListManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final ISFSBuddyApiprotected BuddyStorageprotected intprotected final org.slf4j.Loggerprotected intprotected intprotected booleanprotected com.smartfoxserver.buddylist.cache.BuddyVariablesCacheprotected final Stringprotected final SmartFoxServerprotected booleanprotected final ISFSEventListenerprotected booleanprotected final Zone -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUse the SFSBuddyAPIbooleanCheck if the "offline" (persistent) Buddy Variables are supported in the current ZonevoidbooleanCheck if the current Zone applies the WordFilter to the Buddy messagesgetBuddyList(String ownerName) Get the Buddy List of a specific userintGet the maximum size of a BuddyListGet a list of custom Buddy states such as "Available", "Occupied", "Be right back" etc...getClientsWatchingBuddy(String buddyName) getClientsWatchingBuddy(String buddyName, boolean onlineUsersOnly) intGet the limit of BuddyVariables that each User can creategetName()getOfflineBuddyVariable(String ownerName, String varName) getOfflineBuddyVariables(String ownerName) getOfflineBuddyVariables(String ownerName, boolean bypassCache) intGet the size of the "offline" Buddy Variables cache.getRecipientNamesForUpdate(String owner) Get a reference to the instance of the BuddyStorage class, which handles the data persistencebooleanCheck if the current Zone supports temporary BuddiesgetZone()Get the parent ZonevoidhandleMessage(Object arg0) voidbooleanisActive()Check if the BuddyList management is active in the ZoneloadBuddyList(String ownerName) Use the SFSBuddyAPIremoveBuddy(String ownerName, String buddyName) Use the SFSBuddyAPIvoidremoveBuddyList(String ownerName) voidsaveAll()This is called automatically by the systemvoidsaveBuddyList(String ownerName) This is called automatically by the systemvoidsetActive(boolean value) voidsetAllowOfflineBuddyVariables(boolean value) voidsetApplyBadWordsFilter(boolean value) voidsetBuddyListMaxSize(int maxSize) voidsetBuddyStates(List<String> states) voidsetMaxBuddyVariables(int maxVariables) voidvoidsetOfflineBuddyVariablesCacheSize(int size) voidsetStorageHandler(BuddyStorage buddyStorage) voidsetUseTempBuddies(boolean value)
-
Field Details
-
log
protected final org.slf4j.Logger log -
zone
-
serviceName
-
active
protected boolean active -
offlineBuddyVariables
protected boolean offlineBuddyVariables -
useTempBuddies
protected boolean useTempBuddies -
useBadWordsFilter
protected boolean useBadWordsFilter -
maxListSize
protected int maxListSize -
maxVariables
protected int maxVariables -
bvCacheSize
protected int bvCacheSize -
buddyStorage
-
offlineVarsCache
protected com.smartfoxserver.buddylist.cache.BuddyVariablesCache offlineVarsCache -
userExitEventHandler
-
buddyLists
-
sfs
-
buddyApi
-
buddyStates
-
-
Constructor Details
-
SFSBuddyListManager
-
-
Method Details
-
init
- Specified by:
initin interfacecom.smartfoxserver.bitswarm.service.IService
-
destroy
- Specified by:
destroyin interfacecom.smartfoxserver.bitswarm.service.IService
-
allowOfflineBuddyVariables
public boolean allowOfflineBuddyVariables()Check if the "offline" (persistent) Buddy Variables are supported in the current Zone- Specified by:
allowOfflineBuddyVariablesin interfaceBuddyListManager- Returns:
- true if the "offline" (persistent) Buddy Variables are supported in the current Zone
-
setAllowOfflineBuddyVariables
public void setAllowOfflineBuddyVariables(boolean value) - Specified by:
setAllowOfflineBuddyVariablesin interfaceBuddyListManager
-
addBuddy
public Buddy addBuddy(String ownerName, String buddyName, boolean isTemp) throws SFSBuddyListException Use the SFSBuddyAPI- Specified by:
addBuddyin interfaceBuddyListManager- Throws:
SFSBuddyListException- See Also:
-
getBuddyList
Get the Buddy List of a specific user- Specified by:
getBuddyListin interfaceBuddyListManager- Parameters:
ownerName- the user name- Returns:
- the Buddy List
-
getBuddyListMaxSize
public int getBuddyListMaxSize()Get the maximum size of a BuddyList- Specified by:
getBuddyListMaxSizein interfaceBuddyListManager- Returns:
- the maximum size of a BuddyList
-
getMaxBuddyVariables
public int getMaxBuddyVariables()Get the limit of BuddyVariables that each User can create- Specified by:
getMaxBuddyVariablesin interfaceBuddyListManager- Returns:
- the limit of BuddyVariables that each User can create
-
getStorageHandler
Get a reference to the instance of the BuddyStorage class, which handles the data persistence- Specified by:
getStorageHandlerin interfaceBuddyListManager- Returns:
- a reference to the instance of the BuddyStorage class, which handles the data persistence
-
getZone
Get the parent Zone- Specified by:
getZonein interfaceBuddyListManager- Returns:
- the parent Zone
-
isActive
public boolean isActive()Check if the BuddyList management is active in the Zone- Specified by:
isActivein interfaceBuddyListManager- Returns:
- true if the BuddyList management is active in the Zone
-
loadBuddyList
Use the SFSBuddyAPI- Specified by:
loadBuddyListin interfaceBuddyListManager- Throws:
IOException- See Also:
-
removeBuddy
Use the SFSBuddyAPI- Specified by:
removeBuddyin interfaceBuddyListManager
-
removeBuddyList
- Specified by:
removeBuddyListin interfaceBuddyListManager
-
saveAll
public void saveAll()This is called automatically by the system- Specified by:
saveAllin interfaceBuddyListManager
-
saveBuddyList
This is called automatically by the system- Specified by:
saveBuddyListin interfaceBuddyListManager- Throws:
IOException
-
getBuddyStates
Get a list of custom Buddy states such as "Available", "Occupied", "Be right back" etc... These states are defined in the Zone configuration and are transmitted to the client upon Buddy List initialization.- Specified by:
getBuddyStatesin interfaceBuddyListManager- Returns:
- a list of custom Buddy states
-
setBuddyStates
- Specified by:
setBuddyStatesin interfaceBuddyListManager
-
getApplyBadWordsFilter
public boolean getApplyBadWordsFilter()Check if the current Zone applies the WordFilter to the Buddy messages- Specified by:
getApplyBadWordsFilterin interfaceBuddyListManager- Returns:
- true if the current Zone applies the WordFilter to the Buddy messages
- See Also:
-
setApplyBadWordsFilter
public void setApplyBadWordsFilter(boolean value) - Specified by:
setApplyBadWordsFilterin interfaceBuddyListManager
-
getOfflineBuddyVariable
- Specified by:
getOfflineBuddyVariablein interfaceBuddyListManager
-
getOfflineBuddyVariables
- Specified by:
getOfflineBuddyVariablesin interfaceBuddyListManager
-
getOfflineBuddyVariables
- Specified by:
getOfflineBuddyVariablesin interfaceBuddyListManager
-
setActive
public void setActive(boolean value) - Specified by:
setActivein interfaceBuddyListManager
-
setBuddyListMaxSize
public void setBuddyListMaxSize(int maxSize) - Specified by:
setBuddyListMaxSizein interfaceBuddyListManager
-
setMaxBuddyVariables
public void setMaxBuddyVariables(int maxVariables) - Specified by:
setMaxBuddyVariablesin interfaceBuddyListManager
-
getOfflineBuddyVariablesCacheSize
public int getOfflineBuddyVariablesCacheSize()Get the size of the "offline" Buddy Variables cache.- Specified by:
getOfflineBuddyVariablesCacheSizein interfaceBuddyListManager- Returns:
- the size of the "offline" Buddy Variables cache.
-
setOfflineBuddyVariablesCacheSize
public void setOfflineBuddyVariablesCacheSize(int size) - Specified by:
setOfflineBuddyVariablesCacheSizein interfaceBuddyListManager
-
setStorageHandler
- Specified by:
setStorageHandlerin interfaceBuddyListManager
-
getName
- Specified by:
getNamein interfacecom.smartfoxserver.bitswarm.service.IService
-
handleMessage
- Specified by:
handleMessagein interfacecom.smartfoxserver.bitswarm.service.IService- Throws:
Exception
-
setName
- Specified by:
setNamein interfacecom.smartfoxserver.bitswarm.service.IService
-
getUseTempBuddies
public boolean getUseTempBuddies()Check if the current Zone supports temporary Buddies- Specified by:
getUseTempBuddiesin interfaceBuddyListManager- Returns:
- true if the current Zone supports temporary Buddies
-
setUseTempBuddies
public void setUseTempBuddies(boolean value) - Specified by:
setUseTempBuddiesin interfaceBuddyListManager
-
getClientsWatchingBuddy
- Specified by:
getClientsWatchingBuddyin interfaceBuddyListManager
-
getRecipientNamesForUpdate
- Specified by:
getRecipientNamesForUpdatein interfaceBuddyListManager
-
getClientsWatchingBuddy
- Specified by:
getClientsWatchingBuddyin interfaceBuddyListManager
-