SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::core::buddy::BuddyManager Class Referenceabstract

Manages the current user's Buddy List system. More...

#include <BuddyManager.h>

Public Member Functions

virtual bool isInited () const =0
 Indicates whether the client's Buddy List system is initialized or not.
virtual bool containsBuddy (const std::string &name) const =0
 Indicates whether a buddy exists in user's buddies list or not.
virtual std::shared_ptr< entities::BuddygetBuddyById (int32_t id) const =0
 Retrieves a Buddy object from its id property.
virtual std::shared_ptr< entities::BuddygetBuddyByName (const std::string &name) const =0
 Retrieves a Buddy object from its name property.
virtual std::shared_ptr< entities::BuddygetBuddyByNickName (const std::string &nickName) const =0
 Retrieves a Buddy object from its nickName property (if set).
virtual std::vector< std::shared_ptr< entities::Buddy > > getOfflineBuddies () const =0
 Returns a list of Buddy objects representing all the offline buddies in the user's buddies list.
virtual std::vector< std::shared_ptr< entities::Buddy > > getOnlineBuddies () const =0
 Returns a list of Buddy objects representing all the online buddies in the user's buddies list.
virtual std::vector< std::shared_ptr< entities::Buddy > > getBuddyList () const =0
 Returns a list of Buddy objects representing all the buddies in the user's buddies list.
virtual std::vector< std::string > getBuddyStates () const =0
 Returns a list of strings representing the available custom buddy states.
virtual std::shared_ptr< entities::BuddyVariablegetMyVariable (const std::string &varName) const =0
 Retrieves a Buddy Variable from its name.
virtual std::vector< std::shared_ptr< entities::BuddyVariable > > getMyVariables () const =0
 Returns all the Buddy Variables associated with the current user.
virtual bool getMyOnlineState () const =0
 Returns the current user's online/offline state.
virtual std::optional< std::string > getMyNickName () const =0
 Returns the current user's nickname (if set).
virtual std::optional< std::string > getMyState () const =0
 Returns the current user's custom state (if set).
virtual std::string getMyDisplayName () const =0
 Gets the nickname of the current User, or the User's name if the nickname is not set or is empty.

Detailed Description

Manages the current user's Buddy List system.

It keeps track of all the buddies of the user, of their state and of their Buddy Variables. It also gives access to the properties of the user himself, as the other users who have him as a buddy see them.

See also
SmartFox::getBuddyManager

Member Function Documentation

◆ isInited()

virtual bool sfs3::core::buddy::BuddyManager::isInited ( ) const
pure virtual

Indicates whether the client's Buddy List system is initialized or not.

If it is not, send a requests::buddy::InitBuddyListRequest to the server to load the persistent Buddy List data.

No Buddy List related operations are allowed until the system is initialized.

See also
requests::buddy::InitBuddyListRequest

◆ containsBuddy()

virtual bool sfs3::core::buddy::BuddyManager::containsBuddy ( const std::string & name) const
pure virtual

Indicates whether a buddy exists in user's buddies list or not.

Parameters
nameThe name of the buddy whose presence in the buddies list is to be tested.
Returns
true if the specified buddy exists in the buddies list.
See also
entities::Buddy::getName()

◆ getBuddyById()

virtual std::shared_ptr< entities::Buddy > sfs3::core::buddy::BuddyManager::getBuddyById ( int32_t id) const
pure virtual

Retrieves a Buddy object from its id property.

Parameters
idThe id of the buddy to be found.
Returns
The Buddy object representing the buddy, or nullptr if no buddy with the passed id exists in the buddies list.
See also
entities::Buddy::getId()
BuddyManager::getBuddyByName
BuddyManager::getBuddyByNickName

◆ getBuddyByName()

virtual std::shared_ptr< entities::Buddy > sfs3::core::buddy::BuddyManager::getBuddyByName ( const std::string & name) const
pure virtual

Retrieves a Buddy object from its name property.

Parameters
nameThe name of the buddy to be found.
Returns
The Buddy object representing the buddy, or nullptr if no buddy with the passed name exists in the buddies list.
See also
entities::Buddy::getName()
BuddyManager::getBuddyById
BuddyManager::getBuddyByNickName

◆ getBuddyByNickName()

virtual std::shared_ptr< entities::Buddy > sfs3::core::buddy::BuddyManager::getBuddyByNickName ( const std::string & nickName) const
pure virtual

Retrieves a Buddy object from its nickName property (if set).

Parameters
nickNameThe nickName of the buddy to be found.
Returns
The Buddy object representing the buddy, or nullptr if no buddy with the passed nickName exists in the buddies list.
See also
entities::Buddy::getNickName()
BuddyManager::getBuddyById
BuddyManager::getBuddyByName

◆ getOfflineBuddies()

virtual std::vector< std::shared_ptr< entities::Buddy > > sfs3::core::buddy::BuddyManager::getOfflineBuddies ( ) const
pure virtual

Returns a list of Buddy objects representing all the offline buddies in the user's buddies list.

See also
entities::Buddy::isOnline()

◆ getOnlineBuddies()

virtual std::vector< std::shared_ptr< entities::Buddy > > sfs3::core::buddy::BuddyManager::getOnlineBuddies ( ) const
pure virtual

Returns a list of Buddy objects representing all the online buddies in the user's buddies list.

See also
entities::Buddy::isOnline()

◆ getBuddyList()

virtual std::vector< std::shared_ptr< entities::Buddy > > sfs3::core::buddy::BuddyManager::getBuddyList ( ) const
pure virtual

Returns a list of Buddy objects representing all the buddies in the user's buddies list.

Returns an empty list if the Buddy List system is not initialized.

See also
BuddyManager::isInited

◆ getBuddyStates()

virtual std::vector< std::string > sfs3::core::buddy::BuddyManager::getBuddyStates ( ) const
pure virtual

Returns a list of strings representing the available custom buddy states.

The custom states are received by the client upon initialization of the Buddy List system. They can be configured by means of the SmartFoxServer 3 Administration Tool.

See also
entities::Buddy::getState()

◆ getMyVariable()

virtual std::shared_ptr< entities::BuddyVariable > sfs3::core::buddy::BuddyManager::getMyVariable ( 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 BuddyVariable object representing the Buddy Variable, or nullptr if no Buddy Variable with the passed name is associated with the current user.
See also
BuddyManager::getMyVariables
requests::buddy::SetBuddyVariablesRequest

◆ getMyVariables()

virtual std::vector< std::shared_ptr< entities::BuddyVariable > > sfs3::core::buddy::BuddyManager::getMyVariables ( ) const
pure virtual

Returns all the Buddy Variables associated with the current user.

See also
entities::BuddyVariable
BuddyManager::getMyVariable

◆ getMyOnlineState()

virtual bool sfs3::core::buddy::BuddyManager::getMyOnlineState ( ) const
pure virtual

Returns the current user's online/offline state.

If true, the user appears to be online in the buddies list of other users who have him as a buddy.

The online state of a user in a buddy list is handled by means of a reserved Buddy Variable (see ReservedBuddyVariables class); it is changed with a requests::buddy::GoOnlineRequest.

See also
entities::Buddy::isOnline()
entities::ReservedBuddyVariables
requests::buddy::GoOnlineRequest

◆ getMyNickName()

virtual std::optional< std::string > sfs3::core::buddy::BuddyManager::getMyNickName ( ) const
pure virtual

Returns the current user's nickname (if set).

If the nickname was never set, the optional is empty.

As the nickname of a user in a buddy list is handled by means of a reserved Buddy Variable (see ReservedBuddyVariables class), it is set with a requests::buddy::SetBuddyVariablesRequest.

See also
entities::Buddy::getNickName()
entities::ReservedBuddyVariables
requests::buddy::SetBuddyVariablesRequest

◆ getMyState()

virtual std::optional< std::string > sfs3::core::buddy::BuddyManager::getMyState ( ) const
pure virtual

Returns the current user's custom state (if set).

Examples of custom states are "Available", "Busy", "Be right back", etc. If the custom state was never set, the optional is empty.

As the custom state of a user in a buddy list is handled by means of a reserved Buddy Variable (see ReservedBuddyVariables class), it is set with a requests::buddy::SetBuddyVariablesRequest.

See also
entities::Buddy::getState()
entities::ReservedBuddyVariables
requests::buddy::SetBuddyVariablesRequest

◆ getMyDisplayName()

virtual std::string sfs3::core::buddy::BuddyManager::getMyDisplayName ( ) const
pure virtual

Gets the nickname of the current User, or the User's name if the nickname is not set or is empty.

Returns
nickname of the current User, or the User's name

The documentation for this class was generated from the following file:
  • core/buddy/BuddyManager.h