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

The standard implementation of Buddy: a buddy in the current user's buddy list. More...

#include <SFSBuddy.h>

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

Public Member Functions

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

Detailed Description

The standard implementation of Buddy: a buddy in the current user's buddy list.

NOTE: you never create an SFSBuddy yourself. The API does it for you.

See also
Buddy
SmartFox::getBuddyManager
BuddyVariable

Member Function Documentation

◆ getId()

int32_t sfs3::entities::SFSBuddy::getId ( ) const
inlineoverridevirtual

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

Implements sfs3::entities::Buddy.

◆ getName()

std::string sfs3::entities::SFSBuddy::getName ( ) const
inlineoverridevirtual

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

See also
User::getName

Implements sfs3::entities::Buddy.

◆ getDisplayName()

std::string sfs3::entities::SFSBuddy::getDisplayName ( ) const
overridevirtual

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

See also
Buddy::getNickName

Implements sfs3::entities::Buddy.

◆ isBlocked()

bool sfs3::entities::SFSBuddy::isBlocked ( ) const
inlineoverridevirtual

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

Implements sfs3::entities::Buddy.

◆ getState()

std::optional< std::string > sfs3::entities::SFSBuddy::getState ( ) const
overridevirtual

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

Implements sfs3::entities::Buddy.

◆ getNickName()

std::optional< std::string > sfs3::entities::SFSBuddy::getNickName ( ) const
overridevirtual

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

See also
Buddy::getDisplayName

Implements sfs3::entities::Buddy.

◆ getVariables()

std::vector< std::shared_ptr< BuddyVariable > > sfs3::entities::SFSBuddy::getVariables ( ) const
overridevirtual

Retrieves all the Buddy Variables associated with this buddy.

See also
Buddy::getVariable
BuddyVariable

Implements sfs3::entities::Buddy.

◆ getVariable()

std::shared_ptr< BuddyVariable > sfs3::entities::SFSBuddy::getVariable ( const std::string & varName) const
overridevirtual

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

Implements sfs3::entities::Buddy.

◆ containsVariable()

bool sfs3::entities::SFSBuddy::containsVariable ( const std::string & varName) const
overridevirtual

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.

Implements sfs3::entities::Buddy.

◆ getOfflineVariables()

std::vector< std::shared_ptr< BuddyVariable > > sfs3::entities::SFSBuddy::getOfflineVariables ( ) const
overridevirtual

Retrieves the persistent Buddy Variables of this buddy.

See also
BuddyVariable::isOffline

Implements sfs3::entities::Buddy.

◆ getOnlineVariables()

std::vector< std::shared_ptr< BuddyVariable > > sfs3::entities::SFSBuddy::getOnlineVariables ( ) const
overridevirtual

Retrieves the non-persistent Buddy Variables of this buddy.

See also
BuddyVariable::isOffline

Implements sfs3::entities::Buddy.


The documentation for this class was generated from the following files:
  • entities/SFSBuddy.h
  • entities/SFSBuddy.cpp