Interface ISFSBuddyApi

All Known Implementing Classes:
SFSBuddyApi

public interface ISFSBuddyApi
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBuddy(User owner, String buddyName, boolean isTemp, boolean fireClientEvent, boolean fireServerEvent)
    Adds a new buddy to the BuddyList of the specified User.
    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
    com.smartfoxserver.api.ISFSBuddyResponseApi
     
    void
    goOnline(User user, boolean online, boolean fireServerEvent)
    Toggles the Buddy ONLINE state of the User.
    initBuddyList(User user, boolean fireServerEvent)
    Initializes the buddy list for the requested User.
    void
    removeBuddy(User owner, String buddyName, boolean fireClientEvent, boolean fireServerEvent)
    Remove a Buddy from the owner's BuddyList
    void
    sendBuddyMessage(User sender, User recipient, String message, ISFSObject params)
    Send a Buddy Message to any Buddy in your list.
    void
    setBuddyVariables(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

      BuddyList initBuddyList(User user, boolean fireServerEvent) throws IOException
      Initializes the buddy list for the requested User. This involves loading previous data from the BuddyList storage.
      Parameters:
      user - the User
      fireServerEvent - if true fires a server side event (BUDDY_LIST_INIT)
      Returns:
      the loaded BuddyList
      Throws:
      IOException
    • goOnline

      void goOnline(User user, boolean online, boolean fireServerEvent) throws SFSBuddyListException
      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 User
      online - the online status
      fireServerEvent - 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 User
      buddyName - the name of the buddy to add
      isTemp - if true, the Buddy is only temporary and will be lost when the user logs out
      fireClientEvent - if true, send a client update
      fireServerEvent - 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 User
      buddyVariables - a list of variables
      fireClientEvent - if true, send a client update
      fireServerEvent - if true, fire a server event (BUDDY_VARIABLES_UPDATE)
      Throws:
      SFSBuddyListException - an error might occur if the limit of variables allowed is exceeded
    • removeBuddy

      void removeBuddy(User owner, String buddyName, boolean fireClientEvent, boolean fireServerEvent)
      Remove a Buddy from the owner's BuddyList
      Parameters:
      owner - the owner
      buddyName - the Buddy name
      fireClientEvent - if true send a client update
      fireServerEvent - 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 owner
      buddyName - the name of the Buddy to block/unblock
      isBlocked - the 'blocked' flag
      fireClientEvent - if true send a client update
      fireServerEvent - 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 message
      recipient - the recipient of the message (must be a Buddy in the sender's BuddyList)
      message - the message
      params - custom parameters
      Throws:
      SFSBuddyListException - thrown if the Buddy is not in the sender's Buddy List or if the recipient has blocked the sender