SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSBuddyManager.h
1 //
2 // SFSBuddyManager.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 <Foundation/Foundation.h>
12 #import "IBuddyManager.h"
13 
14 @class SmartFox2XClient;
15 
16 /**
17  The class manages the current User's Buddy List
18  */
19 @interface SFSBuddyManager : NSObject <IBuddyManager>{
20 @protected
21 
22  NSMutableDictionary* _buddiesByName;
23  NSMutableDictionary* _myVariables;
24 
25  BOOL _myOnlineState;
26 
27  NSString* _myNickName;
28  NSString* _myState;
29 
30  BOOL _inited;
31  NSMutableArray* _buddyStates;
32 
33  __weak SmartFox2XClient* _sfs;
34 }
35 /**
36  Get the User's buddy list. It could be null if the Buddy List was not initialized
37  @see InitBuddyListRequest
38  */
39 @property (weak, readonly) NSArray *buddyList;
40 /**
41  Get a list of Strings representing the custom Buddy states that the application can use. The custom states
42  are sent upon initialization of the Buddy List and are configured on the server side.
43  */
44 @property (weak, readonly) NSArray *buddyStates;
45 /**
46  Checks if the current User's Buddy List is inited.
47  If not you should send an InitBuddyListRequest to the server in order to retrieve your persistent Buddy List data.
48 
49  @see InitBuddyListRequest
50  */
51 @property (readonly) BOOL isInited;
52 /**
53  Get the current User's optional nickname
54  This operation is valid only if the User's BuddyList has already been initialized
55  The value is handled by a reserved Buddy Variable
56 
57  @return return the Users' nickname or null if the nickname was never set
58 
59  @see ReservedBuddyVariables
60  */
61 @property (weak, readonly) NSString *myNickName;
62 /**
63  Get the current User's Online State
64  This operation is valid only if the User's BuddyList has already been initialized
65  The value is handled by a reserved Buddy Variable
66 
67  @return true if the User is online, false otherwise
68 
69  @see ReservedBuddyVariables
70  */
71 @property (readonly) BOOL myOnlineState;
72 /**
73  Get the current User's optional custom state (e.g. "Available"; "Busy", "Be right back"...)
74  This operation is valid only if the User's BuddyList has already been initialized
75  The value is handled by a reserved Buddy Variable
76 
77  @return return the Users' state or null if the state was not set
78 
79  @see ReservedBuddyVariables
80  */
81 @property (weak, readonly) NSString *myState;
82 /**
83  Get all current User's Buddy Variables
84  This operation is valid only if the User's BuddyList has already been initialized
85 
86  @see SFSBuddyVariable
87  */
88 @property (weak, readonly) NSArray *myVariables;
89 /** Get a list of all offline Buddies in the User's Buddy list */
90 @property (weak, readonly) NSArray *offlineBuddies;
91 /** Get a list of all online Buddies in the User's Buddy list */
92 @property (weak, readonly) NSArray *onlineBuddies;
93 
94 -(id)initWithSfs:(SmartFox2XClient *)sfs;
95 
96 
97 -(void)setInited:(BOOL)value;
98 
99 -(void)addBuddy:(id <Buddy>)buddy;
100 
101 -(id <Buddy>)removeBuddyById:(NSInteger)id_;
102 
103 -(id <Buddy>)removeBuddyByName:(NSString *)name;
104 
105 /**
106  Checks if a Buddy is present in the current User's Buddy List
107  @param name the Buddy name
108  @return the true if the Buddy exists
109 
110  @see SFSBuddy
111  */
112 -(BOOL)containsBuddy:(NSString *)name;
113 
114 /**
115  Find a Buddy from its User Id
116  @param id_ the user id
117  @return the Buddy, or null if not found
118 
119  @see SFSBuddy
120  */
121 -(id <Buddy>)getBuddyById:(NSInteger)id_;
122 
123 /**
124  Find a Buddy from its name
125  @param name : the Buddy name
126  @return the Buddy, or null if not found
127 
128  @see SFSBuddy
129  */
130 -(id <Buddy>)getBuddyByName:(NSString *)name;
131 
132 /**
133  Find a Buddy from its optional nick name
134  @param nickName : the nickname
135  @return the Buddy, or null if not found
136 
137  @see SFSBuddy
138  */
139 -(id <Buddy>)getBuddyByNickName:(NSString *)nickName;
140 
141 
142 /**
143  Get current Users' BuddyVariable by name
144  @param varName the variable name
145  */
146 -(id <BuddyVariable>)getMyVariable:(NSString *)varName;
147 
148 
149 
150 
151 @end
SmartFox2XClient
Definition: SmartFox2XClient.h:113
SFSBuddyManager
Definition: SFSBuddyManager.h:19