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

#import <SFSBuddy.h>

Inherits NSObject, and <Buddy>.

Instance Methods

(id- initWithId:name:isBlocked:isTemp:
 
(BOOL) - containsVariable:
 
(NSArray *) - getOfflineVariables
 
(NSArray *) - getOnlineVariables
 
(id< BuddyVariable >) - getVariable:
 

Class Methods

(id< Buddy >) + fromSFSArray:
 

Protected Attributes

NSInteger _id
 
NSString * _name
 
BOOL _isBlocked
 
NSMutableDictionary * _variables
 
BOOL _isTemp
 

Properties

NSString * name
 
NSArray * variables
 
NSInteger id
 
BOOL isBlocked
 
BOOL isTemp
 
BOOL isOnline
 
NSString * nickName
 
NSString * state
 

Detailed Description

The SFSBuddy class represent a Buddy in the User's Buddy List.

Each Buddy has several properties:

  • name: the name of the Buddy, corresponds to the User name
  • nickname: an optional nickname (default = null)
  • isOnline: whether the Buddy is online in the Buddy system or not
  • state: a string representing a "state message", such as: Available, Busy...
  • isBlocked: whether the Buddy is blocked in the User Buddy List
  • isTemp: a temporary Buddy is not stored in the Buddy List, it will be removed at the end of the session (see below)
  • variables: the Buddy variables which can be transient or persistent (see below)

Online State
Any user can decide if they want to be online/off-line as Buddy in the Buddy system. By default a User is online every time he joins the Zone, but the User can also turn off this flag at runtime and disappear from other User's buddy lists. The Online State is persistent and based on a reserved Buddy Variable.

Blocked Buddies
Buddies that are blocked won't be able to send any messages to the User, also they won't be able to see if the Buddy is online/off-line.

Buddy State message
The state message represents a typical IM Buddy state such as Available, Busy etc... By default the system already provides 3 default states: Available, Away, Occupied which can be changed or enriched at any time The state message is based on a reserved Buddy Variable.

Temp Buddy
A temporary Buddy is added to the User List when another User adds me to his Buddy List. This way we can see each others and exchange messages. If I don't add the User as Buddy in my list the User will remain temporary and it won't be persisted.

Variables
Buddy Variables enable each Buddy to show/send updates for specific informations to each User that has the Buddy in the list. For example one could send real-time updates on his last activity (ala Twitter) or post the title of the song he's listening right now, scores, rankings and whatnot.

Method Documentation

◆ containsVariable:

- (BOOL) containsVariable: (NSString *)  varName

Return true if a BuddyVariable with the provided name exists

◆ getOfflineVariables

- (NSArray *) getOfflineVariables

Return a list of offline Buddy Variables

◆ getOnlineVariables

- (NSArray *) getOnlineVariables

Return a list of non-persistent Buddy Variables

◆ getVariable:

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

Get the BuddyVariable with the provided name. nil is returned if not BuddyVariable exists with that name

Property Documentation

◆ id

- (NSInteger) id
readwritenonatomicassign

The id of the Buddy The id corresponds to the current id of the User in the system

◆ isBlocked

- (BOOL) isBlocked
readwritenonatomicassign

Return true if the Buddy is blocked in the current Users' BuddyList

See also
BlockBuddyRequest

◆ isOnline

- (BOOL) isOnline
readatomicassign

Return true if the User is online in the BuddyList system The value is stored in a reserved Buddy Variable

See also
GoOnlineRequest
ReservedBuddyVariables

◆ isTemp

- (BOOL) isTemp
readwritenonatomicassign

Return true if the Buddy is temporary (not persistent)

◆ name

- (NSString *) name
readwritenonatomicstrong

The name of the Buddy

◆ nickName

- (NSString *) nickName
readatomicweak

An optional Buddy nickname The value is stored in a reserved Buddy Variable

See also
ReservedBuddyVariables

◆ state

- (NSString *) state
readatomicweak

The current Buddy custom state (e.g. "Available", "Busy", etc...) The value is stored in a reserved Buddy Variable

See also
ReservedBuddyVariables

◆ variables

- (NSArray *) variables
readwritenonatomicstrong

Obtain a list of BuddyVariables. Please note that by convention any 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.

See also
SFSBuddyVariable
SetBuddyVariablesRequest