SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSBuddyManager Class Reference

#import <SFSBuddyManager.h>

Inherits NSObject, and <IBuddyManager>.

Instance Methods

(id) - initWithSfs:
 
(void) - setInited:
 
(void) - addBuddy:
 
(id< Buddy >) - removeBuddyById:
 
(id< Buddy >) - removeBuddyByName:
 
(BOOL) - containsBuddy:
 
(id< Buddy >) - getBuddyById:
 
(id< Buddy >) - getBuddyByName:
 
(id< Buddy >) - getBuddyByNickName:
 
(id< BuddyVariable >) - getMyVariable:
 

Protected Attributes

NSMutableDictionary * _buddiesByName
 
NSMutableDictionary * _myVariables
 
BOOL _myOnlineState
 
NSString * _myNickName
 
NSString * _myState
 
BOOL _inited
 
NSMutableArray * _buddyStates
 
__weak SmartFox2XClient_sfs
 

Properties

NSArray * buddyList
 
NSArray * buddyStates
 
BOOL isInited
 
NSString * myNickName
 
BOOL myOnlineState
 
NSString * myState
 
NSArray * myVariables
 
NSArray * offlineBuddies
 
NSArray * onlineBuddies
 

Detailed Description

The class manages the current User's Buddy List

Method Documentation

◆ containsBuddy:

- (BOOL) containsBuddy: (NSString *)  name

Checks if a Buddy is present in the current User's Buddy List

Parameters
namethe Buddy name
Returns
the true if the Buddy exists
See also
SFSBuddy

◆ getBuddyById:

- (id< Buddy >) getBuddyById: (NSInteger)  id_

Find a Buddy from its User Id

Parameters
id_the user id
Returns
the Buddy, or null if not found
See also
SFSBuddy

◆ getBuddyByName:

- (id< Buddy >) getBuddyByName: (NSString *)  name

Find a Buddy from its name

Parameters
name: the Buddy name
Returns
the Buddy, or null if not found
See also
SFSBuddy

◆ getBuddyByNickName:

- (id< Buddy >) getBuddyByNickName: (NSString *)  nickName

Find a Buddy from its optional nick name

Parameters
nickName: the nickname
Returns
the Buddy, or null if not found
See also
SFSBuddy

◆ getMyVariable:

- (id< BuddyVariable >) getMyVariable: (NSString *)  varName

Get current Users' BuddyVariable by name

Parameters
varNamethe variable name

Property Documentation

◆ buddyList

- (NSArray *) buddyList
readatomicweak

Get the User's buddy list. It could be null if the Buddy List was not initialized

See also
InitBuddyListRequest

◆ buddyStates

- (NSArray *) buddyStates
readatomicweak

Get a list of Strings representing the custom Buddy states that the application can use. The custom states are sent upon initialization of the Buddy List and are configured on the server side.

◆ isInited

- (BOOL) isInited
readatomicassign

Checks if the current User's Buddy List is inited. If not you should send an InitBuddyListRequest to the server in order to retrieve your persistent Buddy List data.

See also
InitBuddyListRequest

◆ myNickName

- (NSString *) myNickName
readatomicweak

Get the current User's optional nickname This operation is valid only if the User's BuddyList has already been initialized The value is handled by a reserved Buddy Variable

Returns
return the Users' nickname or null if the nickname was never set
See also
ReservedBuddyVariables

◆ myOnlineState

- (BOOL) myOnlineState
readatomicassign

Get the current User's Online State This operation is valid only if the User's BuddyList has already been initialized The value is handled by a reserved Buddy Variable

Returns
true if the User is online, false otherwise
See also
ReservedBuddyVariables

◆ myState

- (NSString *) myState
readatomicweak

Get the current User's optional custom state (e.g. "Available"; "Busy", "Be right back"...) This operation is valid only if the User's BuddyList has already been initialized The value is handled by a reserved Buddy Variable

Returns
return the Users' state or null if the state was not set
See also
ReservedBuddyVariables

◆ myVariables

- (NSArray *) myVariables
readatomicweak

Get all current User's Buddy Variables This operation is valid only if the User's BuddyList has already been initialized

See also
SFSBuddyVariable

◆ offlineBuddies

- (NSArray *) offlineBuddies
readatomicweak

Get a list of all offline Buddies in the User's Buddy list

◆ onlineBuddies

- (NSArray *) onlineBuddies
readatomicweak

Get a list of all online Buddies in the User's Buddy list