public class SFSBuddyListManager extends java.lang.Object implements BuddyListManager
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active |
protected ISFSBuddyApi |
buddyApi |
protected java.util.Map<java.lang.String,BuddyList> |
buddyLists |
protected java.util.List<java.lang.String> |
buddyStates |
protected BuddyStorage |
buddyStorage |
protected int |
bvCacheSize |
protected org.slf4j.Logger |
log |
protected int |
maxListSize |
protected int |
maxVariables |
protected boolean |
offlineBuddyVariables |
protected com.smartfoxserver.v2.buddylist.cache.BuddyVariablesCache |
offlineVarsCache |
protected java.lang.String |
serviceName |
protected SmartFoxServer |
sfs |
protected boolean |
useBadWordsFilter |
protected ISFSEventListener |
userExitEventHandler |
protected boolean |
useTempBuddies |
protected Zone |
zone |
| Constructor and Description |
|---|
SFSBuddyListManager(Zone parentZone,
boolean isActive) |
| Modifier and Type | Method and Description |
|---|---|
Buddy |
addBuddy(java.lang.String ownerName,
java.lang.String buddyName,
boolean isTemp)
Use the SFSBuddyAPI
|
boolean |
allowOfflineBuddyVariables()
Check if the "offline" (persistent) Buddy Variables are supported in the current Zone
|
void |
destroy(java.lang.Object o)
Destroy service
|
boolean |
getApplyBadWordsFilter()
Check if the current Zone applies the WordFilter to the Buddy messages
|
BuddyList |
getBuddyList(java.lang.String ownerName)
Get the Buddy List of a specific user
|
int |
getBuddyListMaxSize()
Get the maximum size of a BuddyList
|
java.util.List<java.lang.String> |
getBuddyStates()
Get a list of custom Buddy states such as "Available", "Occupied", "Be right back" etc...
|
java.util.List<ISession> |
getClientsWatchingBuddy(java.lang.String buddyName) |
java.util.List<ISession> |
getClientsWatchingBuddy(java.lang.String buddyName,
boolean onlineUsersOnly) |
int |
getMaxBuddyVariables()
Get the limit of BuddyVariables that each User can create
|
java.lang.String |
getName()
Get the service name
|
BuddyVariable |
getOfflineBuddyVariable(java.lang.String ownerName,
java.lang.String varName) |
java.util.List<BuddyVariable> |
getOfflineBuddyVariables(java.lang.String ownerName) |
java.util.List<BuddyVariable> |
getOfflineBuddyVariables(java.lang.String ownerName,
boolean bypassCache) |
int |
getOfflineBuddyVariablesCacheSize()
Get the size of the "offline" Buddy Variables cache.
|
java.util.List<java.lang.String> |
getRecipientNamesForUpdate(java.lang.String owner) |
BuddyStorage |
getStorageHandler()
Get a reference to the instance of the BuddyStorage class, which handles the data persistence
|
boolean |
getUseTempBuddies()
Check if the current Zone supports temporary Buddies
|
Zone |
getZone()
Get the parent Zone
|
void |
handleMessage(java.lang.Object arg0)
Send message to service
|
void |
init(java.lang.Object o)
Initialize service
|
boolean |
isActive()
Check if the BuddyList management is active in the Zone
|
BuddyList |
loadBuddyList(java.lang.String ownerName)
Use the SFSBuddyAPI
|
Buddy |
removeBuddy(java.lang.String ownerName,
java.lang.String buddyName)
Use the SFSBuddyAPI
|
void |
removeBuddyList(java.lang.String ownerName) |
void |
saveAll()
This is called automatically by the system
|
void |
saveBuddyList(java.lang.String ownerName)
This is called automatically by the system
|
void |
setActive(boolean value) |
void |
setAllowOfflineBuddyVariables(boolean value) |
void |
setApplyBadWordsFilter(boolean value) |
void |
setBuddyListMaxSize(int maxSize) |
void |
setBuddyStates(java.util.List<java.lang.String> states) |
void |
setMaxBuddyVariables(int maxVariables) |
void |
setName(java.lang.String arg0)
Set the service name
|
void |
setOfflineBuddyVariablesCacheSize(int size) |
void |
setStorageHandler(BuddyStorage buddyStorage) |
void |
setUseTempBuddies(boolean value) |
protected final org.slf4j.Logger log
protected final Zone zone
protected final java.lang.String serviceName
protected boolean active
protected boolean offlineBuddyVariables
protected boolean useTempBuddies
protected boolean useBadWordsFilter
protected int maxListSize
protected int maxVariables
protected int bvCacheSize
protected BuddyStorage buddyStorage
protected com.smartfoxserver.v2.buddylist.cache.BuddyVariablesCache offlineVarsCache
protected final ISFSEventListener userExitEventHandler
protected final java.util.Map<java.lang.String,BuddyList> buddyLists
protected final SmartFoxServer sfs
protected final ISFSBuddyApi buddyApi
protected java.util.List<java.lang.String> buddyStates
public SFSBuddyListManager(Zone parentZone, boolean isActive)
public void init(java.lang.Object o)
init in interface com.smartfoxserver.bitswarm.service.IServiceo - custom parameterspublic void destroy(java.lang.Object o)
destroy in interface com.smartfoxserver.bitswarm.service.IServiceo - custom parameterspublic boolean allowOfflineBuddyVariables()
allowOfflineBuddyVariables in interface BuddyListManagerpublic void setAllowOfflineBuddyVariables(boolean value)
setAllowOfflineBuddyVariables in interface BuddyListManagerpublic Buddy addBuddy(java.lang.String ownerName, java.lang.String buddyName, boolean isTemp) throws SFSBuddyListException
addBuddy in interface BuddyListManagerSFSBuddyListExceptionSFSBuddyApi.addBuddy(com.smartfoxserver.v2.entities.User, String, boolean, boolean, boolean)public BuddyList getBuddyList(java.lang.String ownerName)
getBuddyList in interface BuddyListManagerownerName - the user namepublic int getBuddyListMaxSize()
getBuddyListMaxSize in interface BuddyListManagerpublic int getMaxBuddyVariables()
getMaxBuddyVariables in interface BuddyListManagerpublic BuddyStorage getStorageHandler()
getStorageHandler in interface BuddyListManagerpublic Zone getZone()
getZone in interface BuddyListManagerpublic boolean isActive()
isActive in interface BuddyListManagerpublic BuddyList loadBuddyList(java.lang.String ownerName) throws java.io.IOException
loadBuddyList in interface BuddyListManagerjava.io.IOExceptionSFSBuddyApi.initBuddyList(com.smartfoxserver.v2.entities.User, boolean)public Buddy removeBuddy(java.lang.String ownerName, java.lang.String buddyName)
removeBuddy in interface BuddyListManagerSFSBuddyApi.removeBuddy(Zone, String, String, boolean, boolean)public void removeBuddyList(java.lang.String ownerName)
removeBuddyList in interface BuddyListManagerpublic void saveAll()
saveAll in interface BuddyListManagerpublic void saveBuddyList(java.lang.String ownerName)
throws java.io.IOException
saveBuddyList in interface BuddyListManagerjava.io.IOExceptionpublic java.util.List<java.lang.String> getBuddyStates()
getBuddyStates in interface BuddyListManagerpublic void setBuddyStates(java.util.List<java.lang.String> states)
setBuddyStates in interface BuddyListManagerpublic boolean getApplyBadWordsFilter()
getApplyBadWordsFilter in interface BuddyListManagerSFSBuddyApi.sendBuddyMessage(com.smartfoxserver.v2.entities.User, com.smartfoxserver.v2.entities.User, String, com.smartfoxserver.v2.entities.data.ISFSObject)public void setApplyBadWordsFilter(boolean value)
setApplyBadWordsFilter in interface BuddyListManagerpublic BuddyVariable getOfflineBuddyVariable(java.lang.String ownerName, java.lang.String varName)
getOfflineBuddyVariable in interface BuddyListManagerpublic java.util.List<BuddyVariable> getOfflineBuddyVariables(java.lang.String ownerName)
getOfflineBuddyVariables in interface BuddyListManagerpublic java.util.List<BuddyVariable> getOfflineBuddyVariables(java.lang.String ownerName, boolean bypassCache)
getOfflineBuddyVariables in interface BuddyListManagerpublic void setActive(boolean value)
setActive in interface BuddyListManagerpublic void setBuddyListMaxSize(int maxSize)
setBuddyListMaxSize in interface BuddyListManagerpublic void setMaxBuddyVariables(int maxVariables)
setMaxBuddyVariables in interface BuddyListManagerpublic int getOfflineBuddyVariablesCacheSize()
getOfflineBuddyVariablesCacheSize in interface BuddyListManagerpublic void setOfflineBuddyVariablesCacheSize(int size)
setOfflineBuddyVariablesCacheSize in interface BuddyListManagerpublic void setStorageHandler(BuddyStorage buddyStorage)
setStorageHandler in interface BuddyListManagerpublic java.lang.String getName()
com.smartfoxserver.bitswarm.service.IServicegetName in interface com.smartfoxserver.bitswarm.service.IServicepublic void handleMessage(java.lang.Object arg0)
throws java.lang.Exception
com.smartfoxserver.bitswarm.service.IServicehandleMessage in interface com.smartfoxserver.bitswarm.service.IServicearg0 - the messagejava.lang.Exceptionpublic void setName(java.lang.String arg0)
com.smartfoxserver.bitswarm.service.IServicesetName in interface com.smartfoxserver.bitswarm.service.IServicearg0 - the service namepublic boolean getUseTempBuddies()
getUseTempBuddies in interface BuddyListManagerpublic void setUseTempBuddies(boolean value)
setUseTempBuddies in interface BuddyListManagerpublic java.util.List<ISession> getClientsWatchingBuddy(java.lang.String buddyName)
getClientsWatchingBuddy in interface BuddyListManagerpublic java.util.List<java.lang.String> getRecipientNamesForUpdate(java.lang.String owner)
getRecipientNamesForUpdate in interface BuddyListManagerpublic java.util.List<ISession> getClientsWatchingBuddy(java.lang.String buddyName, boolean onlineUsersOnly)
getClientsWatchingBuddy in interface BuddyListManager