SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::entities::Buddy Class Referenceabstract

A buddy in the current user's buddy list. More...

#include <Buddy.h>

Inheritance diagram for sfs3::entities::Buddy:
[legend]

Public Member Functions

virtual int32_t getId () const =0
 The buddy id, equal to the id assigned by SmartFoxServer to the corresponding User.
virtual std::string getName () const =0
 The name of this buddy, equal to the login name of the corresponding User.
virtual std::string getDisplayName () const =0
 The nickname of this buddy if one is set, his name otherwise.
virtual bool isBlocked () const =0
 Indicates whether this buddy is blocked in the current user's buddies list or not.
virtual bool isOnline () const =0
 Indicates whether this buddy is online in the Buddy List system or not.
virtual bool isTemp () const =0
 Indicates whether this buddy is temporary (non-persistent) in the current user's buddies list or not.
virtual std::optional< std::string > getState () const =0
 The custom state of this buddy, such as "Available", "Busy" or "Be right back", or an empty optional if the state is not set.
virtual std::optional< std::string > getNickName () const =0
 The nickname of this buddy, or an empty optional if the nickname is not set.
virtual std::vector< std::shared_ptr< BuddyVariable > > getVariables () const =0
 Retrieves all the Buddy Variables associated with this buddy.
virtual std::shared_ptr< BuddyVariablegetVariable (const std::string &varName) const =0
 Retrieves a Buddy Variable from its name.
virtual bool containsVariable (const std::string &varName) const =0
 Indicates whether this buddy has the specified Buddy Variable set or not.
virtual std::vector< std::shared_ptr< BuddyVariable > > getOfflineVariables () const =0
 Retrieves the persistent Buddy Variables of this buddy.
virtual std::vector< std::shared_ptr< BuddyVariable > > getOnlineVariables () const =0
 Retrieves the non-persistent Buddy Variables of this buddy.

Detailed Description

A buddy in the current user's buddy list.

SFSBuddy is the standard implementation of this interface.

See also
SFSBuddy
BuddyVariable

Member Function Documentation

◆ getId()

virtual int32_t sfs3::entities::Buddy::getId ( ) const
pure virtual

The buddy id, equal to the id assigned by SmartFoxServer to the corresponding User.

It is -1 while the corresponding user is not connected, which is why a buddy is identified by name rather than by id.

See also
User::getId

Implemented in sfs3::entities::SFSBuddy.

◆ getName()

virtual std::string sfs3::entities::Buddy::getName ( ) const
pure virtual

The name of this buddy, equal to the login name of the corresponding User.

See also
User::getName

Implemented in sfs3::entities::SFSBuddy.

◆ getDisplayName()

virtual std::string sfs3::entities::Buddy::getDisplayName ( ) const
pure virtual

The nickname of this buddy if one is set, his name otherwise.

See also
Buddy::getNickName

Implemented in sfs3::entities::SFSBuddy.

◆ isBlocked()

virtual bool sfs3::entities::Buddy::isBlocked ( ) const
pure virtual

Indicates whether this buddy is blocked in the current user's buddies list or not.

A buddy is blocked with a requests::buddy::BlockBuddyRequest.

See also
requests::buddy::BlockBuddyRequest

Implemented in sfs3::entities::SFSBuddy.

◆ getState()

virtual std::optional< std::string > sfs3::entities::Buddy::getState ( ) const
pure virtual

The custom state of this buddy, such as "Available", "Busy" or "Be right back", or an empty optional if the state is not set.

The list of available custom states is the one the Buddy Manager holds.

See also
core::buddy::BuddyManager::getBuddyStates

Implemented in sfs3::entities::SFSBuddy.

◆ getNickName()

virtual std::optional< std::string > sfs3::entities::Buddy::getNickName ( ) const
pure virtual

The nickname of this buddy, or an empty optional if the nickname is not set.

See also
Buddy::getDisplayName

Implemented in sfs3::entities::SFSBuddy.

◆ getVariables()

virtual std::vector< std::shared_ptr< BuddyVariable > > sfs3::entities::Buddy::getVariables ( ) const
pure virtual

Retrieves all the Buddy Variables associated with this buddy.

See also
Buddy::getVariable
BuddyVariable

Implemented in sfs3::entities::SFSBuddy.

◆ getVariable()

virtual std::shared_ptr< BuddyVariable > sfs3::entities::Buddy::getVariable ( const std::string & varName) const
pure virtual

Retrieves a Buddy Variable from its name.

Parameters
varNameThe name of the Buddy Variable to be retrieved.
Returns
The Buddy Variable, or nullptr if no Buddy Variable with the passed name is associated with this buddy.
See also
Buddy::getVariables
requests::buddy::SetBuddyVariablesRequest

Implemented in sfs3::entities::SFSBuddy.

◆ containsVariable()

virtual bool sfs3::entities::Buddy::containsVariable ( const std::string & varName) const
pure virtual

Indicates whether this buddy has the specified Buddy Variable set or not.

Parameters
varNameThe name of the Buddy Variable whose existence must be checked.
Returns
true if a Buddy Variable with the passed name is set.

Implemented in sfs3::entities::SFSBuddy.

◆ getOfflineVariables()

virtual std::vector< std::shared_ptr< BuddyVariable > > sfs3::entities::Buddy::getOfflineVariables ( ) const
pure virtual

Retrieves the persistent Buddy Variables of this buddy.

See also
BuddyVariable::isOffline

Implemented in sfs3::entities::SFSBuddy.

◆ getOnlineVariables()

virtual std::vector< std::shared_ptr< BuddyVariable > > sfs3::entities::Buddy::getOnlineVariables ( ) const
pure virtual

Retrieves the non-persistent Buddy Variables of this buddy.

See also
BuddyVariable::isOffline

Implemented in sfs3::entities::SFSBuddy.


The documentation for this class was generated from the following file:
  • entities/Buddy.h