Class SFSBuddyVariable

java.lang.Object
sfs3.client.entities.variables.BaseVariable
sfs3.client.entities.variables.SFSBuddyVariable
All Implemented Interfaces:
BuddyVariable, Variable

public class SFSBuddyVariable extends BaseVariable implements BuddyVariable
The SFSBuddyVariable is a custom value attached to a Buddy object in a Buddy List which is automatically synchronized between client and server on every change.

Buddy Variables work with the same principle of the User and Room Variables. The only difference is the logic by which they get propagated to other users. While Room and User Variables are usually sent to all clients in the same Room, Buddy Variables are sent to users who have the owner (of the Buddy Variable) in their Buddy Lists.

There is a special convention that allows Buddy Variables to be set as "offline". Offline Buddy Variables are persistent values which are made available to all users who have the owner in their Buddy Lists, whether that Buddy is online or not. In order to make a Buddy Variable persistent, its name should start with a dollar sign, for example: $avatarPic.

See Also:
  • Field Details

    • OFFLINE_PREFIX

      public static final String OFFLINE_PREFIX
      The prefix to be added to a Buddy Variable name to make it persistent. A persistent Buddy Variable is made available to all users who have the owner in their Buddy Lists, whether that Buddy is online or not.
      See Also:
  • Constructor Details

    • SFSBuddyVariable

      public SFSBuddyVariable(String name, Object val)
      Creates a new Buddy Variable
    • SFSBuddyVariable

      public SFSBuddyVariable(String name, Object value, VariableType type)
      Types are normally auto-detected. Please see: SFSBuddyVariable(String, Object)
      Parameters:
      name - name of the Buddy Variable
      value - value of the Buddy Variable
      type - type of the Buddy Variable
      See Also:
  • Method Details

    • fromSFSArray

      public static BuddyVariable fromSFSArray(ISFSArray sfsa)
      Internal
    • isOffline

      public boolean isOffline()
      Description copied from interface: BuddyVariable
      Indicates whether the Buddy Variable is persistent or not.

      By convention any Buddy Variable whose name starts with the dollar sign ($) will be regarded as persistent and stored locally by the server. Persistent Buddy Variables are also referred to as "offline variables" because they are available to all users who have the owner in their Buddy Lists, whether that Buddy is online or not.

      Specified by:
      isOffline in interface BuddyVariable
    • toString

      public String toString()
      Returns a string that contains the Buddy Variable name, type and value.
      Overrides:
      toString in class BaseVariable
      Returns:
      The string representation of the SFSBuddyVariable object.