Package com.smartfoxserver.api
Interface ISFSBuddyApi
- All Known Implementing Classes:
SFSBuddyApi
public interface ISFSBuddyApi
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuddy(User owner, String buddyName, boolean isTemp, boolean fireClientEvent, boolean fireServerEvent) Adds a new buddy to the BuddyList of the specified User.voidblockBuddy(User owner, String buddyName, boolean isBlocked, boolean fireClientEvent, boolean fireServerEvent) Block/Unblock a Buddy in the owner's BuddyList Blocked buddies won't be able to see the owner online status or send messages to that Usercom.smartfoxserver.api.ISFSBuddyResponseApivoidToggles the Buddy ONLINE state of the User.initBuddyList(User user, boolean fireServerEvent) Initializes the buddy list for the requested User.voidremoveBuddy(User owner, String buddyName, boolean fireClientEvent, boolean fireServerEvent) Remove a Buddy from the owner's BuddyListvoidsendBuddyMessage(User sender, User recipient, String message, ISFSObject params) Send a Buddy Message to any Buddy in your list.voidsetBuddyVariables(User owner, List<BuddyVariable> buddyVariables, boolean fireClientEvent, boolean fireServerEvent) Set any number of BuddyVariables for the specified owner
-
Method Details
-
getResponseAPI
com.smartfoxserver.api.ISFSBuddyResponseApi getResponseAPI() -
initBuddyList
Initializes the buddy list for the requested User. This involves loading previous data from the BuddyList storage.- Parameters:
user- the UserfireServerEvent- if true fires a server side event (BUDDY_LIST_INIT)- Returns:
- the loaded BuddyList
- Throws:
IOException
-
goOnline
Toggles the Buddy ONLINE state of the User. All clients who have this User as their Buddy will be notified about the change.- Parameters:
user- the Useronline- the online statusfireServerEvent- if true fires a server side event (BUDDY_ONLINE)- Throws:
SFSBuddyListException
-
addBuddy
void addBuddy(User owner, String buddyName, boolean isTemp, boolean fireClientEvent, boolean fireServerEvent) throws SFSBuddyListException Adds a new buddy to the BuddyList of the specified User.- Parameters:
owner- the owner UserbuddyName- the name of the buddy to addisTemp- if true, the Buddy is only temporary and will be lost when the user logs outfireClientEvent- if true, send a client updatefireServerEvent- if true, fire a server event (BUDDY_ADDED)- Throws:
SFSBuddyListException- an error might occur if the BuddyList is full or the buddy was already added
-
setBuddyVariables
void setBuddyVariables(User owner, List<BuddyVariable> buddyVariables, boolean fireClientEvent, boolean fireServerEvent) throws SFSBuddyListException Set any number of BuddyVariables for the specified owner- Parameters:
owner- the owner UserbuddyVariables- a list of variablesfireClientEvent- if true, send a client updatefireServerEvent- if true, fire a server event (BUDDY_VARIABLES_UPDATE)- Throws:
SFSBuddyListException- an error might occur if the limit of variables allowed is exceeded
-
removeBuddy
Remove a Buddy from the owner's BuddyList- Parameters:
owner- the ownerbuddyName- the Buddy namefireClientEvent- if true send a client updatefireServerEvent- if true fire a server side event (BUDDY_REMOVED)
-
blockBuddy
void blockBuddy(User owner, String buddyName, boolean isBlocked, boolean fireClientEvent, boolean fireServerEvent) Block/Unblock a Buddy in the owner's BuddyList Blocked buddies won't be able to see the owner online status or send messages to that User- Parameters:
owner- the BuddyList ownerbuddyName- the name of the Buddy to block/unblockisBlocked- the 'blocked' flagfireClientEvent- if true send a client updatefireServerEvent- if true fire a server side event (BUDDY_BLOCK_UPDATE)
-
sendBuddyMessage
void sendBuddyMessage(User sender, User recipient, String message, ISFSObject params) throws SFSBuddyListException Send a Buddy Message to any Buddy in your list. A Buddy message is similar to a Private Message but it is meant to work with the BuddyList taking into account the Buddy states (online/offline/blocked etc.)- Parameters:
sender- the sender of the messagerecipient- the recipient of the message (must be a Buddy in the sender's BuddyList)message- the messageparams- custom parameters- Throws:
SFSBuddyListException- thrown if the Buddy is not in the sender's Buddy List or if the recipient has blocked the sender
-