Class SFSBuddyEvent

java.lang.Object
sfs3.client.core.ApiEvent
sfs3.client.core.SFSBuddyEvent

public class SFSBuddyEvent extends ApiEvent
SFSBuddyEvent is the class representing all the events related to the Buddy List system dispatched by the SmartFoxServer 3 Java client API.

The SFSBuddyEvent parent class provides a public property called params containing different values depending on the event type.

See Also:
  • Field Details

    • BUDDY_LIST_INIT

      public static final String BUDDY_LIST_INIT

      Dispatched if the Buddy List system is successfully initialized. This event is fired in response to the InitBuddyListRequest request, when successful.

      After the Buddy List system initialization, the user returns to its previous custom state (if any - see IBuddyManager.myState property). The online/offline state, nickname and persistent Buddy Variables are all loaded in the system. In particular, the online state (see IBuddyManager.myOnlineState property) determines if the user appears online or not to other users.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyListList<Buddy>A list of Buddy objects representing all the buddies in the current user's buddies list.
      myVariablesList<BuddyVariable>A list of all the Buddy Variables associated with the current user.
      See Also:
    • BUDDY_ADD

      public static final String BUDDY_ADD

      Dispatched when a buddy is added successfully to the user's buddies list. This event is fired in response to the AddBuddyRequest request.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyBuddyThe Buddy object corresponding to the buddy that was added.
      See Also:
    • BUDDY_REMOVE

      public static final String BUDDY_REMOVE

      Dispatched when a buddy is removed successfully from theuser's buddies list. This event is fired in response to the RemoveBuddyRequest request.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyBuddyThe Buddy object corresponding to the buddy that was removed.
      See Also:
    • BUDDY_BLOCK

      public static final String BUDDY_BLOCK

      Dispatched when a buddy is blocked or unblocked by the current user. This event is fired in response to the BlockBuddyRequest request.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyBuddyThe Buddy object corresponding to the buddy that was blocked/unblocked.
      See Also:
    • BUDDY_ERROR

      public static final String BUDDY_ERROR

      Dispatched if an error occurs while executing a request related to the Buddy List system. For example, this event is fired in response to a AddBuddyRequest request, the BlockBuddyRequest, in case they don't succeed.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      errorMessageStringThe message which describes the error.
      errorCodeshortThe error code.
      See Also:
    • BUDDY_ONLINE_STATE_CHANGE

      public static final String BUDDY_ONLINE_STATE_CHANGE

      Dispatched when a buddy in the current user's buddy list changes its online state. This event is fired in response to the GoOnlineRequest request.

      NOTE: this event is dispatched to those who have the user as buddy, but also to the user itself. If the latter, the value of the buddy parameter is null, the isItMe parameter should be used to check if the current user was the request sender.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyBuddyThe Buddy the buddy who changed the online state.
      isItMeBooleantrue if the online state was changed by the current user
      See Also:
    • BUDDY_VARIABLES_UPDATE

      public static final String BUDDY_VARIABLES_UPDATE

      Dispatched when a buddy (in the current buddy list) updates one or more Buddy Variables. This event is fired in response to the SetBuddyVariablesRequest request.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyBuddyThe Buddy the buddy who updated the Variables.
      isItMeBooleantrue if the Buddy Variables were updated by the current user itself
      changedVarsList<BuddyVariable>The list of Buddy Variable names that were created or changed.
      See Also:
    • BUDDY_MESSAGE

      public static final String BUDDY_MESSAGE

      Dispatched when a message from a buddy is received by the current user. This event is fired in response to the BuddyMessageRequest request.

      The properties of the arguments object contained in the event object have the following values:

      PropertyTypeDescription
      buddyBuddyThe Buddy that sent the message.
      isItMeBooleantrue if the message sender is the current user.
      messageStringThe message text
      dataISFSObjectExtra custom parameters, may be null
      See Also:
  • Constructor Details

    • SFSBuddyEvent

      public SFSBuddyEvent(String type, Map<String,Object> args)
      Creates a new SFSBuddyEvent instance.
      Parameters:
      type - The type of event.
      args - An object containing the parameters of the event.
    • SFSBuddyEvent

      public SFSBuddyEvent(String type)