Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::ChatServicesManager Class Reference

This class provides the interface between loaded ChatHandlers and conversation messages. More...

#include <chatservicesmanager.h>

Collaboration diagram for jami::ChatServicesManager:
Collaboration graph

Public Member Functions

 ChatServicesManager (PluginManager &pluginManager)
 Constructor registers ChatHandler API services to the PluginManager instance.
 
void cleanChatSubjects (const std::string &accountId, const std::string &peerId="")
 If an account is unregistered or a contact is erased, we clear all chat subjects related to that accountId or to the accountId, peerId pair.
 
std::map< std::string, std::string > getChatHandlerDetails (const std::string &chatHandlerIdStr)
 Gets details from ChatHandler implementation.
 
std::vector< std::string > getChatHandlers () const
 List all ChatHandlers available.
 
std::vector< std::string > getChatHandlerStatus (const std::string &accountId, const std::string &peerId)
 Returns a list of active ChatHandlers for a given accountId, peerId pair.
 
bool hasHandlers () const
 
 NON_COPYABLE (ChatServicesManager)
 
void publishMessage (pluginMessagePtr message)
 Publishes every message sent or received in a conversation that has (or should have) an active ChatHandler.
 
bool setPreference (const std::string &key, const std::string &value, const std::string &rootPath)
 Sets a preference that may be changed while ChatHandler is active.
 
void toggleChatHandler (const std::string &chatHandlerId, const std::string &accountId, const std::string &peerId, const bool toggle)
 Activates or deactivate a given ChatHandler to a given accountId, peerId pair.
 

Detailed Description

This class provides the interface between loaded ChatHandlers and conversation messages.

Besides it: (1) stores pointers to all loaded ChatHandlers; (2) stores pointers to availables chat subjects, and; (3) lists ChatHandler state with respect to each accountId, peerId pair. In other words, for a given accountId, peerId pair, we store if a ChatHandler is active or not.

Definition at line 37 of file chatservicesmanager.h.

Constructor & Destructor Documentation

◆ ChatServicesManager()

jami::ChatServicesManager::ChatServicesManager ( PluginManager pluginManager)

Constructor registers ChatHandler API services to the PluginManager instance.

These services will store ChatHandler pointers, clean them from the Plugin System once a plugin is loaded or unloaded, or yet allows the plugins to send a message to a conversation.

Parameters
pluginManager

Definition at line 27 of file chatservicesmanager.cpp.

References jami::emitSignal(), and jami::PluginPreferencesUtils::getAllowDenyListPreferences().

Here is the call graph for this function:

Member Function Documentation

◆ cleanChatSubjects()

void jami::ChatServicesManager::cleanChatSubjects ( const std::string &  accountId,
const std::string &  peerId = "" 
)

If an account is unregistered or a contact is erased, we clear all chat subjects related to that accountId or to the accountId, peerId pair.

Parameters
accountId
peerId

Definition at line 174 of file chatservicesmanager.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getChatHandlerDetails()

std::map< std::string, std::string > jami::ChatServicesManager::getChatHandlerDetails ( const std::string &  chatHandlerIdStr)

Gets details from ChatHandler implementation.

Parameters
chatHandlerIdStr
Returns
Details map from the ChatHandler implementation

Definition at line 213 of file chatservicesmanager.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getChatHandlers()

std::vector< std::string > jami::ChatServicesManager::getChatHandlers ( ) const

List all ChatHandlers available.

Returns
Vector of stored ChatHandlers pointers.

Definition at line 123 of file chatservicesmanager.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ getChatHandlerStatus()

std::vector< std::string > jami::ChatServicesManager::getChatHandlerStatus ( const std::string &  accountId,
const std::string &  peerId 
)

Returns a list of active ChatHandlers for a given accountId, peerId pair.

Parameters
accountId
peerId
Returns
Vector with active ChatHandler ids for a given accountId, peerId pair.

Definition at line 197 of file chatservicesmanager.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ hasHandlers()

bool jami::ChatServicesManager::hasHandlers ( ) const

Definition at line 116 of file chatservicesmanager.cpp.

References jami::emitSignal().

Here is the call graph for this function:

◆ NON_COPYABLE()

jami::ChatServicesManager::NON_COPYABLE ( ChatServicesManager  )

◆ publishMessage()

void jami::ChatServicesManager::publishMessage ( pluginMessagePtr  message)

Publishes every message sent or received in a conversation that has (or should have) an active ChatHandler.

Parameters
message

Definition at line 134 of file chatservicesmanager.cpp.

References DIR_SEPARATOR_CH, jami::emitSignal(), jami::PluginPreferencesUtils::getAlwaysPreference(), and jami::PluginPreferencesUtils::setAllowDenyListPreferences().

Here is the call graph for this function:

◆ setPreference()

bool jami::ChatServicesManager::setPreference ( const std::string &  key,
const std::string &  value,
const std::string &  rootPath 
)

Sets a preference that may be changed while ChatHandler is active.

Parameters
key
value
rootPath
Returns
False if preference was changed.

Definition at line 225 of file chatservicesmanager.cpp.

References jami::emitSignal().

Referenced by jami::JamiPluginManager::setPluginPreference().

Here is the call graph for this function:

◆ toggleChatHandler()

void jami::ChatServicesManager::toggleChatHandler ( const std::string &  chatHandlerId,
const std::string &  accountId,
const std::string &  peerId,
const bool  toggle 
)

Activates or deactivate a given ChatHandler to a given accountId, peerId pair.

Parameters
ChatHandlerId
accountId
peerId
toggleNotify with new subjects if true, detach if false.

Definition at line 188 of file chatservicesmanager.cpp.

References jami::emitSignal(), and toggleChatHandler().

Referenced by toggleChatHandler().

Here is the call graph for this function:

The documentation for this class was generated from the following files: