Ring Daemon 16.0.0
|
Manages channels for exchanging messages between peers. More...
#include <message_channel_handler.h>
Classes | |
struct | Impl |
struct | Message |
Public Types | |
using | OnMessage = std::function< void(const std::shared_ptr< dht::crypto::Certificate > &, std::string &, const std::string &)> |
using | OnPeerStateChanged = std::function< void(const std::string &, bool)> |
Public Member Functions | |
void | closeChannel (const std::string &peer, const DeviceId &device, const std::shared_ptr< dhtnet::ChannelSocket > &conn) |
void | connect (const DeviceId &deviceId, const std::string &, ConnectCb &&cb, const std::string &connectionType, bool forceNewConnection=false) override |
Ask for a new message channel. | |
std::shared_ptr< dhtnet::ChannelSocket > | getChannel (const std::string &peer, const DeviceId &deviceId) const |
std::vector< std::shared_ptr< dhtnet::ChannelSocket > > | getChannels (const std::string &peer) const |
MessageChannelHandler (dhtnet::ConnectionManager &cm, OnMessage onMessage, OnPeerStateChanged onPeer) | |
void | onReady (const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name, std::shared_ptr< dhtnet::ChannelSocket > channel) override |
Launch message process. | |
bool | onRequest (const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name) override |
Determine if we accept or not the message request. | |
~MessageChannelHandler () | |
![]() | |
virtual void | connect (const dht::InfoHash &, const std::string &, ConnectCallbackLegacy &&) |
virtual | ~ChannelHandlerInterface () |
Static Public Member Functions | |
static bool | sendMessage (const std::shared_ptr< dhtnet::ChannelSocket > &, const Message &message) |
Manages channels for exchanging messages between peers.
Definition at line 28 of file message_channel_handler.h.
using jami::MessageChannelHandler::OnMessage = std::function<void(const std::shared_ptr<dht::crypto::Certificate>&, std::string&, const std::string&)> |
Definition at line 31 of file message_channel_handler.h.
using jami::MessageChannelHandler::OnPeerStateChanged = std::function<void(const std::string&, bool)> |
Definition at line 32 of file message_channel_handler.h.
jami::MessageChannelHandler::MessageChannelHandler | ( | dhtnet::ConnectionManager & | cm, |
OnMessage | onMessage, | ||
OnPeerStateChanged | onPeer | ||
) |
Definition at line 44 of file message_channel_handler.cpp.
jami::MessageChannelHandler::~MessageChannelHandler | ( | ) |
Definition at line 50 of file message_channel_handler.cpp.
void jami::MessageChannelHandler::closeChannel | ( | const std::string & | peer, |
const DeviceId & | device, | ||
const std::shared_ptr< dhtnet::ChannelSocket > & | conn | ||
) |
Definition at line 193 of file message_channel_handler.cpp.
References jami::emitSignal().
|
overridevirtual |
Ask for a new message channel.
deviceId | The device to connect |
name | (Unused, generated from deviceId) |
cb | The callback to call when connected (can be immediate if already connected) |
connectionType | for iOS notifications |
forceNewConnection | If we want a new SIP connection |
Implements jami::ChannelHandlerInterface.
Definition at line 53 of file message_channel_handler.cpp.
References jami::emitSignal(), JAMI_LOG, and MESSAGE_SCHEME.
std::shared_ptr< dhtnet::ChannelSocket > jami::MessageChannelHandler::getChannel | ( | const std::string & | peer, |
const DeviceId & | deviceId | ||
) | const |
Definition at line 98 of file message_channel_handler.cpp.
References jami::emitSignal().
std::vector< std::shared_ptr< dhtnet::ChannelSocket > > jami::MessageChannelHandler::getChannels | ( | const std::string & | peer | ) | const |
Definition at line 113 of file message_channel_handler.cpp.
References jami::emitSignal().
Referenced by jami::JamiAccount::sendPresenceNote().
|
overridevirtual |
Launch message process.
deviceId | Device who asked |
name | Name asked |
channel | Channel used to message |
Implements jami::ChannelHandlerInterface.
Definition at line 139 of file message_channel_handler.cpp.
References jami::emitSignal(), and JAMI_WARNING.
|
overridevirtual |
Determine if we accept or not the message request.
deviceId | Device who asked |
name | Name asked |
Implements jami::ChannelHandlerInterface.
Definition at line 130 of file message_channel_handler.cpp.
References jami::emitSignal().
|
static |
Definition at line 217 of file message_channel_handler.cpp.
References jami::emitSignal(), and JAMI_WARNING.