Inherits from NSObject
Conforms to Buddy
Declared in SFSBuddy.h
SFSBuddy.m

Overview

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.

Tasks

  •   name

    The name of the Buddy

    property
  •   variables

    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.

    property
  •   id

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

    property
  •   isBlocked

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

    property
  •   isTemp

    Return true if the Buddy is temporary (not persistent)

    property
  •   isOnline

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

    property
  •   nickName

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

    property
  •   state

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

    property
  • – containsVariable:

    Return true if a BuddyVariable with the provided name exists

  • – getOfflineVariables

    Return a list of offline Buddy Variables

  • – getOnlineVariables

    Return a list of non-persistent Buddy Variables

  • – getVariable:

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

Properties

id

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

@property (nonatomic, assign) NSInteger id

Discussion

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

Declared In

SFSBuddy.h

isBlocked

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

@property (nonatomic, assign) BOOL isBlocked

Discussion

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

Declared In

SFSBuddy.h

isOnline

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

@property (readonly) BOOL isOnline

Discussion

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

Declared In

SFSBuddy.h

isTemp

Return true if the Buddy is temporary (not persistent)

@property (nonatomic, assign) BOOL isTemp

Discussion

Return true if the Buddy is temporary (not persistent)

Declared In

SFSBuddy.h

name

The name of the Buddy

@property (nonatomic, retain) NSString *name

Discussion

The name of the Buddy

Declared In

SFSBuddy.h

nickName

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

@property (readonly) NSString *nickName

Discussion

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

Declared In

SFSBuddy.h

state

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

@property (readonly) NSString *state

Discussion

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

Declared In

SFSBuddy.h

variables

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.

@property (nonatomic, retain) NSArray *variables

Discussion

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.

Declared In

SFSBuddy.h

Instance Methods

containsVariable:

Return true if a BuddyVariable with the provided name exists

- (BOOL)containsVariable:(NSString *)varName

Discussion

Return true if a BuddyVariable with the provided name exists

Declared In

SFSBuddy.h

getOfflineVariables

Return a list of offline Buddy Variables

- (NSArray *)getOfflineVariables

Discussion

Return a list of offline Buddy Variables

Declared In

SFSBuddy.h

getOnlineVariables

Return a list of non-persistent Buddy Variables

- (NSArray *)getOnlineVariables

Discussion

Return a list of non-persistent Buddy Variables

Declared In

SFSBuddy.h

getVariable:

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

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

Discussion

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

Declared In

SFSBuddy.h