SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSBuddyVariable.h
1 //
2 // SFSBuddyVariable.h
3 // SFS2X
4 //
5 // Original development by Infosfer Game Technologies Ltd. | http://www.infosfer.com.
6 //
7 // Maintained and developed by A51 Integrated.
8 // Copyright 2012 A51 Integrated | http://a51integrated.com. All rights reserved.
9 //
10 
11 #import "Common.h"
12 #import "BuddyVariable.h"
13 #import "BaseVariable.h"
14 
15 EXTERN NSString * const SFSBuddyVariable_OFFLINE_PREFIX;
16 /** BuddyVariables are custom values attached to any Buddy in a BuddyList. They work with the same principle of the User/Room Variables.
17 
18  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.
19 
20  BuddyVariables support basic data types and nested complex objects:
21 
22  - Null
23  - Bool
24  - Int
25  - Double
26  - String
27  - SFSObject
28  - SFSArray
29 
30  Also there is a special convention that allows certain Variables to be "offline" Buddy Variables.
31  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.
32 
33  @see SFSBuddy
34  @see SetBuddyVariablesRequest
35  @see [ISFSEvents onBuddyVariablesUpdate:]
36  */
37 @interface SFSBuddyVariable : BaseVariable <BuddyVariable>
38 
39 /** Return true if this is an offline Buddy Variable
40 
41  By convention any Buddy Variable whose name starts with the dollar sign ($)
42  will be regarded as persistent and stored locally by the server.
43 
44  These variables are also referred to as "offline variables" because they are available
45  to other Users even when the Buddy is offline.
46  */
47 @property (readonly) BOOL isOffline;
48 
49 /**
50  @param name the name of the variable
51  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
52  @param type (optional -1) it's usually not necessary to pass this parameter as the variable value is auto-detected
53  */
54 +(id)variableWithName:(NSString *)name value:(id)value type:(NSInteger)type;
55 
56 /**
57  @param name the name of the variable
58  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
59  */
60 +(id)variableWithName:(NSString *)name value:(id)value;
61 
62 
63 +(id<BuddyVariable>)fromSFSArray:(id <ISFSArray>)sfsa;
64 
65 
66 @end
SFSBuddyVariable::isOffline
BOOL isOffline
Definition: SFSBuddyVariable.h:47
BaseVariable::name
NSString * name
Definition: BaseVariable.h:23
SFSBuddyVariable
Definition: SFSBuddyVariable.h:37
BaseVariable
Definition: BaseVariable.h:12
BaseVariable::type
NSString * type
Definition: BaseVariable.h:29