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.IService
o
- custom parameterspublic void destroy(java.lang.Object o)
destroy
in interface com.smartfoxserver.bitswarm.service.IService
o
- custom parameterspublic boolean allowOfflineBuddyVariables()
allowOfflineBuddyVariables
in interface BuddyListManager
public void setAllowOfflineBuddyVariables(boolean value)
setAllowOfflineBuddyVariables
in interface BuddyListManager
public Buddy addBuddy(java.lang.String ownerName, java.lang.String buddyName, boolean isTemp) throws SFSBuddyListException
addBuddy
in interface BuddyListManager
SFSBuddyListException
SFSBuddyApi.addBuddy(com.smartfoxserver.v2.entities.User, String, boolean, boolean, boolean)
public BuddyList getBuddyList(java.lang.String ownerName)
getBuddyList
in interface BuddyListManager
ownerName
- the user namepublic int getBuddyListMaxSize()
getBuddyListMaxSize
in interface BuddyListManager
public int getMaxBuddyVariables()
getMaxBuddyVariables
in interface BuddyListManager
public BuddyStorage getStorageHandler()
getStorageHandler
in interface BuddyListManager
public Zone getZone()
getZone
in interface BuddyListManager
public boolean isActive()
isActive
in interface BuddyListManager
public BuddyList loadBuddyList(java.lang.String ownerName) throws java.io.IOException
loadBuddyList
in interface BuddyListManager
java.io.IOException
SFSBuddyApi.initBuddyList(com.smartfoxserver.v2.entities.User, boolean)
public Buddy removeBuddy(java.lang.String ownerName, java.lang.String buddyName)
removeBuddy
in interface BuddyListManager
SFSBuddyApi.removeBuddy(Zone, String, String, boolean, boolean)
public void removeBuddyList(java.lang.String ownerName)
removeBuddyList
in interface BuddyListManager
public void saveAll()
saveAll
in interface BuddyListManager
public void saveBuddyList(java.lang.String ownerName) throws java.io.IOException
saveBuddyList
in interface BuddyListManager
java.io.IOException
public java.util.List<java.lang.String> getBuddyStates()
getBuddyStates
in interface BuddyListManager
public void setBuddyStates(java.util.List<java.lang.String> states)
setBuddyStates
in interface BuddyListManager
public boolean getApplyBadWordsFilter()
getApplyBadWordsFilter
in interface BuddyListManager
SFSBuddyApi.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 BuddyListManager
public BuddyVariable getOfflineBuddyVariable(java.lang.String ownerName, java.lang.String varName)
getOfflineBuddyVariable
in interface BuddyListManager
public java.util.List<BuddyVariable> getOfflineBuddyVariables(java.lang.String ownerName)
getOfflineBuddyVariables
in interface BuddyListManager
public java.util.List<BuddyVariable> getOfflineBuddyVariables(java.lang.String ownerName, boolean bypassCache)
getOfflineBuddyVariables
in interface BuddyListManager
public void setActive(boolean value)
setActive
in interface BuddyListManager
public void setBuddyListMaxSize(int maxSize)
setBuddyListMaxSize
in interface BuddyListManager
public void setMaxBuddyVariables(int maxVariables)
setMaxBuddyVariables
in interface BuddyListManager
public int getOfflineBuddyVariablesCacheSize()
getOfflineBuddyVariablesCacheSize
in interface BuddyListManager
public void setOfflineBuddyVariablesCacheSize(int size)
setOfflineBuddyVariablesCacheSize
in interface BuddyListManager
public void setStorageHandler(BuddyStorage buddyStorage)
setStorageHandler
in interface BuddyListManager
public java.lang.String getName()
com.smartfoxserver.bitswarm.service.IService
getName
in interface com.smartfoxserver.bitswarm.service.IService
public void handleMessage(java.lang.Object arg0) throws java.lang.Exception
com.smartfoxserver.bitswarm.service.IService
handleMessage
in interface com.smartfoxserver.bitswarm.service.IService
arg0
- the messagejava.lang.Exception
public void setName(java.lang.String arg0)
com.smartfoxserver.bitswarm.service.IService
setName
in interface com.smartfoxserver.bitswarm.service.IService
arg0
- the service namepublic boolean getUseTempBuddies()
getUseTempBuddies
in interface BuddyListManager
public void setUseTempBuddies(boolean value)
setUseTempBuddies
in interface BuddyListManager
public java.util.List<ISession> getClientsWatchingBuddy(java.lang.String buddyName)
getClientsWatchingBuddy
in interface BuddyListManager
public java.util.List<java.lang.String> getRecipientNamesForUpdate(java.lang.String owner)
getRecipientNamesForUpdate
in interface BuddyListManager
public java.util.List<ISession> getClientsWatchingBuddy(java.lang.String buddyName, boolean onlineUsersOnly)
getClientsWatchingBuddy
in interface BuddyListManager