22 dhtnet::ConnectionManager&
cm)
25 , connectionManager_(
cm)
37 connectionManager_.connectDevice(deviceId,
44 const std::string& name)
46 auto acc = account_.lock();
52 auto sep = name.find_last_of(
'/');
53 auto conversationId = name.substr(
sep + 1);
55 if (
auto acc = account_.lock()) {
56 if (
auto convModule = acc->convModule(
true)) {
57 auto res = !convModule->isBanned(conversationId,
cert->issuer->getId().toString());
59 JAMI_WARNING(
"[Account {}] Received ConversationChannel request for '{}' but user {} is banned", acc->getAccountID(), name,
cert->issuer->getId().toString());
61 res &= !convModule->isBanned(conversationId,
cert->getLongId().toString());
63 JAMI_WARNING(
"[Account {}] Received ConversationChannel request for '{}' but device {} is banned", acc->getAccountID(), name,
cert->getLongId().toString());
68 JAMI_ERROR(
"Received ConversationChannel request but conversation module is unavailable");
77 std::shared_ptr<dhtnet::ChannelSocket>)
A Channel handler is used to make the link between JamiAccount and ConnectionManager Its role is to m...
ConversationChannelHandler(const std::shared_ptr< JamiAccount > &acc, dhtnet::ConnectionManager &cm)
bool onRequest(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name) override
Determine if we accept or not the git request.
void connect(const DeviceId &deviceId, const std::string &name, ConnectCb &&cb, const std::string &connectionType="", bool forceNewConnection=false) override
Ask for a new git channel.
~ConversationChannelHandler()
void onReady(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name, std::shared_ptr< dhtnet::ChannelSocket > channel) override
TODO, this needs to extract gitservers from JamiAccount.
#define JAMI_ERROR(formatstr,...)
#define JAMI_WARNING(formatstr,...)
std::function< void(std::shared_ptr< dhtnet::ChannelSocket >, const DeviceId &)> ConnectCb
void emitSignal(Args... args)