SFSBuddyVariable Class Reference
Inherits from | NSObject |
Conforms to | BuddyVariable |
Declared in | SFSBuddyVariable.h SFSBuddyVariable.m |
Overview
BuddyVariables are custom values attached to any Buddy in a BuddyList. They work with the same principle of the User/Room Variables.
The only difference is the logic by which they get propagated to other Users. While RoomVariables are broadcast to all clients in the same Room, BuddyVariables are updated to all Users who have the BuddyVariable owner in their BuddyLists.
BuddyVariables support basic data types and nested complex objects:
- Null
- Bool
- Int
- Double
- String
- SFSObject
- SFSArray
Also there is a special convention that allows certain Variables to be “offline” Buddy Variables. All variable names starting with a dollar sign ($) will set the BuddyVariable as persistent and make them available at any time whether the owner is online or not.
Tasks
-
name
The Variable name
property -
type
The Variable Type
property -
isOffline
Return true if this is an offline Buddy Variable
property -
+ variableWithName:value:type:
the name of the variable
-
– getValue
The Variable value
-
– getBoolValue
The Variable value as BOOL
-
– getIntValue
The Variable value as NSInteger
-
– getDoubleValue
The Variable value as Number
-
– getStringValue
The Variable value as NSString
-
– getSFSObjectValue
The Variable value as SFSObject
-
– getSFSArrayValue
The Variable value as SFSArray
-
– isNull
Checks if the variable value is null
Properties
isOffline
Return true if this is an offline Buddy Variable
@property (readonly) BOOL isOffline
Discussion
Return true if this is an offline Buddy Variable
By convention any Buddy Variable whose name starts with the dollar sign ($) will be regarded as persistent and stored locally by the server.
These variables are also referred to as “offline variables” because they are available to other Users even when the Buddy is offline.
Declared In
SFSBuddyVariable.h
Class Methods
variableWithName:value:type:
the name of the variable
+ (id)variableWithName:(NSString *)name value:(id)value type:(NSInteger)type
Parameters
- name
the name of the variable
- value
the variable value ( can be Boolean, int, Number, String, SFSObject, SFSArray )
- type
it’s usually not necessary to pass this parameter as the variable value is auto-detected (optional: pass -1 or use variableWithName:value:)
Declared In
SFSBuddyVariable.h
Instance Methods
getBoolValue
The Variable value as BOOL
- (BOOL)getBoolValue
Discussion
The Variable value as BOOL
Declared In
SFSBuddyVariable.h
getDoubleValue
The Variable value as Number
- (NSNumber *)getDoubleValue
Discussion
The Variable value as Number
Declared In
SFSBuddyVariable.h
getIntValue
The Variable value as NSInteger
- (NSInteger)getIntValue
Discussion
The Variable value as NSInteger
Declared In
SFSBuddyVariable.h
getSFSArrayValue
The Variable value as SFSArray
- (id<ISFSArray>)getSFSArrayValue
Discussion
The Variable value as SFSArray
Declared In
SFSBuddyVariable.h
getSFSObjectValue
The Variable value as SFSObject
- (id<ISFSObject>)getSFSObjectValue
Discussion
The Variable value as SFSObject
See Also
Declared In
SFSBuddyVariable.h
getStringValue
The Variable value as NSString
- (NSString *)getStringValue
Discussion
The Variable value as NSString
Declared In
SFSBuddyVariable.h