Commit 6ec4b3e8 authored by Andreas Traczyk's avatar Andreas Traczyk

debug: connect to debug signal and forward to client

Change-Id: I0601aa7b323e2213000571481061d0eb707580de
parent f74d0201
......@@ -87,6 +87,10 @@ Q_SIGNALS:
* Emitted when the unread interaction is now read
*/
void newReadInteraction(const std::string& accountId, const std::string& conversation, uint64_t interactionId) const;
/**
* Emitted debugMessageReceived
*/
void debugMessageReceived(const std::string& message);
};
......
......@@ -49,7 +49,7 @@ public:
* get a reference on the behavior controller.
* @return a BehaviorController&.
*/
const BehaviorController& getBehaviorController() const;
BehaviorController& getBehaviorController() const;
/**
* get a reference on the DataTransfer controller.
* @return a DataTransferModel&.
......
......@@ -23,6 +23,7 @@
#include "api/lrc.h"
#include "api/newaccountmodel.h"
#include "api/datatransfermodel.h"
#include "api/behaviorcontroller.h"
// Lrc
#include "account.h"
......@@ -34,6 +35,12 @@
// DRing
#include <datatransfer_interface.h>
#ifdef ENABLE_LIBWRAP
// For the debugMessageReceived connection that queues const std::string refs
// when not using dbus
Q_DECLARE_METATYPE(std::string);
#endif
namespace lrc
{
......@@ -169,6 +176,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
this,
&CallbacksHandler::slotMigrationEnded,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::debugMessageReceived,
this,
&CallbacksHandler::slotDebugMessageReceived,
Qt::QueuedConnection);
}
CallbacksHandler::~CallbacksHandler()
......@@ -418,4 +431,18 @@ CallbacksHandler::slotMigrationEnded(const QString& accountId, const QString& st
emit migrationEnded(accountId.toStdString(), status == "SUCCESS");
}
#ifdef ENABLE_LIBWRAP
void
CallbacksHandler::slotDebugMessageReceived(const std::string& message)
{
emit parent.getBehaviorController().debugMessageReceived(message);
}
#else
void
CallbacksHandler::slotDebugMessageReceived(const QString& message)
{
emit parent.getBehaviorController().debugMessageReceived(message.toStdString());
}
#endif
} // namespace lrc
......@@ -222,6 +222,12 @@ Q_SIGNALS:
*/
void migrationEnded(const std::string& accountId, bool ok);
/**
* Debug message received
* @param message
*/
void debugMessageReceived(const std::string& message);
private Q_SLOTS:
/**
* Emit newAccountMessage
......@@ -387,6 +393,16 @@ private Q_SLOTS:
*/
void slotMigrationEnded(const QString& accountId, const QString& status);
/**
* emit debugMessageReceived
* @param message
*/
#ifdef ENABLE_LIBWRAP
void slotDebugMessageReceived(const std::string& message);
#else
void slotDebugMessageReceived(const QString& message);
#endif
private:
const api::Lrc& parent;
};
......
......@@ -64,7 +64,7 @@ Lrc::getAccountModel() const
return *lrcPimpl_->accountModel;
}
const BehaviorController&
BehaviorController&
Lrc::getBehaviorController() const
{
return *lrcPimpl_->behaviorController;
......
......@@ -53,6 +53,7 @@ public:
using DRing::ConfigurationSignal;
using DRing::AudioSignal;
using DRing::DataTransferSignal;
using DRing::DebugSignal;
setObjectName("ConfigurationManagerInterface");
confHandlers = {
......@@ -163,6 +164,10 @@ public:
[this] (const std::string& account_id, const std::string& uri, const bool& banned) {
Q_EMIT this->contactRemoved(QString(account_id.c_str()), QString(uri.c_str()), banned);
}),
exportable_callback<DebugSignal::MessageSend>(
[this](const std::string& message) {
Q_EMIT this->debugMessageReceived(message);
}),
};
dataXferHandlers = {
......@@ -700,6 +705,7 @@ Q_SIGNALS: // SIGNALS
void contactRemoved(const QString &accountID, const QString &uri, bool banned);
void dataTransferEvent(qulonglong transfer_id, uint code);
void deviceRevocationEnded(const QString& accountId, const QString& deviceId, int status);
void debugMessageReceived(const std::string& message);
};
namespace org { namespace ring { namespace Ring {
......
......@@ -39,6 +39,7 @@ InstanceManagerInterface::InstanceManagerInterface() : m_pTimer(nullptr)
using DRing::ConfigurationSignal;
using DRing::PresenceSignal;
using DRing::DataTransferSignal;
using DRing::DebugSignal;
#ifdef ENABLE_VIDEO
using DRing::VideoSignal;
......
......@@ -846,6 +846,7 @@ Q_SIGNALS: // SIGNALS
void contactRemoved(const QString &accountId, const QString &uri, bool banned);
void dataTransferEvent(uint64_t transfer_id, uint32_t code);
void deviceRevocationEnded(const QString& accountId, const QString& deviceId, int status);
void debugMessageReceived(const std::string& message);
};
namespace org {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment