[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:08:36 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=f56c045
The following commit has been merged in the master branch:
commit f56c04573730cb6077a07d8ace637f7aa1840dc2
Author: Martin Klapetek <mklapetek at kde.org>
Date: Mon Dec 15 20:28:36 2014 +0100
Port KTpProxy kdebugs to qcdebugs
---
otr-proxy/KTpProxy/CMakeLists.txt | 1 +
otr-proxy/KTpProxy/ktp-proxy-debug.cpp | 21 +++++++++++
otr-proxy/KTpProxy/ktp-proxy-debug.h | 29 ++++++++++++++++
otr-proxy/KTpProxy/main.cpp | 5 ++-
otr-proxy/KTpProxy/otr-manager.cpp | 7 ++--
otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp | 44 +++++++++++-------------
otr-proxy/KTpProxy/otr-utils.cpp | 3 +-
otr-proxy/KTpProxy/otr-utils.h | 2 --
otr-proxy/KTpProxy/proxy-observer.cpp | 5 ++-
otr-proxy/KTpProxy/proxy-service.cpp | 16 ++++-----
10 files changed, 89 insertions(+), 44 deletions(-)
diff --git a/otr-proxy/KTpProxy/CMakeLists.txt b/otr-proxy/KTpProxy/CMakeLists.txt
index d5c1a0a..858e7cb 100644
--- a/otr-proxy/KTpProxy/CMakeLists.txt
+++ b/otr-proxy/KTpProxy/CMakeLists.txt
@@ -12,6 +12,7 @@ set(ktp-proxy_SRCS
otr-message.cpp
otr-config.cpp
otr-utils.cpp
+ ktp-proxy-debug.cpp
)
kconfig_add_kcfg_files(ktp-proxy_SRCS ktp-proxy-config.kcfgc)
diff --git a/otr-proxy/KTpProxy/ktp-proxy-debug.cpp b/otr-proxy/KTpProxy/ktp-proxy-debug.cpp
new file mode 100644
index 0000000..c449a8d
--- /dev/null
+++ b/otr-proxy/KTpProxy/ktp-proxy-debug.cpp
@@ -0,0 +1,21 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Martin Klapetek <mklapetek at kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "ktp-proxy-debug.h"
+Q_LOGGING_CATEGORY(KTP_PROXY, "ktp-proxy")
diff --git a/otr-proxy/KTpProxy/ktp-proxy-debug.h b/otr-proxy/KTpProxy/ktp-proxy-debug.h
new file mode 100644
index 0000000..3b85085
--- /dev/null
+++ b/otr-proxy/KTpProxy/ktp-proxy-debug.h
@@ -0,0 +1,29 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Martin Klapetek <mklapetek at kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KTP_PROXY_DEBUG_H
+#define KTP_PROXY_DEBUG_H
+
+#include <QLoggingCategory>
+// include the QDebug here so there doesn't have to
+// be two debug includes in the files using qCDebug
+#include <QDebug>
+Q_DECLARE_LOGGING_CATEGORY(KTP_PROXY)
+
+#endif
diff --git a/otr-proxy/KTpProxy/main.cpp b/otr-proxy/KTpProxy/main.cpp
index bd0fb00..87e1df6 100644
--- a/otr-proxy/KTpProxy/main.cpp
+++ b/otr-proxy/KTpProxy/main.cpp
@@ -20,11 +20,10 @@
#include "proxy-service.h"
#include "otr-config.h"
#include "ktp_version.h"
+#include "ktp-proxy-debug.h"
#include <KTp/OTR/types.h>
-#include <KDebug>
-
#include "KTp/core.h"
#include "KTp/debug.h"
@@ -83,7 +82,7 @@ int main(int argc, char *argv[])
if(error.isValid())
{
- kError() << "Could not register ProxyService
"
+ qCCritical(KTP_PROXY) << "Could not register ProxyService
"
<< "error name: " << error.name() << "
"
<< "error message: " << error.message();
diff --git a/otr-proxy/KTpProxy/otr-manager.cpp b/otr-proxy/KTpProxy/otr-manager.cpp
index 6a63541..6cbdfdf 100644
--- a/otr-proxy/KTpProxy/otr-manager.cpp
+++ b/otr-proxy/KTpProxy/otr-manager.cpp
@@ -20,11 +20,10 @@
#include "otr-manager.h"
#include "otr-utils.h"
#include "otr-constants.h"
+#include "ktp-proxy-debug.h"
#include "KTp/OTR/constants.h"
-#include <KDebug>
-
namespace OTR
{
@@ -43,7 +42,7 @@ namespace {
{
Q_UNUSED(accountname);
Q_UNUSED(protocol);
- kDebug();
+ qCDebug(KTP_PROXY);
Session *session = reinterpret_cast<Session*>(opdata);
session->parent()->createNewPrivateKey(session);
@@ -209,7 +208,7 @@ namespace {
Q_UNUSED(progress_percent);
Session *session = reinterpret_cast<Session*>(opdata);
- kDebug() << session->context().accountName;
+ qCDebug(KTP_PROXY) << session->context().accountName;
switch (smp_event) {
case OTRL_SMPEVENT_NONE:
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
index b5c0dea..e30167f 100644
--- a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
@@ -24,6 +24,7 @@
#include "otr-manager.h"
#include "otr-utils.h"
#include "pending-curry-operation.h"
+#include "ktp-proxy-debug.h"
#include "KTp/OTR/constants.h"
@@ -33,9 +34,6 @@
#include <QDateTime>
-#include <KDebug>
-
-
class PendingSendMessageResult : public PendingCurryOperation
{
public:
@@ -103,7 +101,7 @@ OtrProxyChannel::Adaptee::Adaptee(OtrProxyChannel *pc,
isGenerating(false),
aboutToInit(false)
{
- kDebug() << "Created OTR session for context: "
+ qCDebug(KTP_PROXY) << "Created OTR session for context: "
<< "Account id: " << context.accountId
<< " Account name: " << context.accountName
<< " recipient name: " << context.recipientName
@@ -164,7 +162,7 @@ Tp::TextChannelPtr OtrProxyChannel::Adaptee::channel() const
void OtrProxyChannel::Adaptee::connectProxy(
const Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr &context)
{
- kDebug() << "Connecting proxy: " << pc->objectPath();
+ qCDebug(KTP_PROXY) << "Connecting proxy: " << pc->objectPath();
connect(chan.data(),
SIGNAL(messageReceived(const Tp::ReceivedMessage&)),
@@ -190,7 +188,7 @@ void OtrProxyChannel::Adaptee::disconnectProxy(
if(otrSes.trustLevel() != OTR::TrustLevel::NOT_PRIVATE) {
otrSes.stopSession();
}
- kDebug() << "Disconnecting proxy: " << pc->objectPath();
+ qCDebug(KTP_PROXY) << "Disconnecting proxy: " << pc->objectPath();
disconnect(chan.data(), SIGNAL(messageReceived(const Tp::ReceivedMessage&)),
this, SLOT(onMessageReceived(const Tp::ReceivedMessage&)));
@@ -209,7 +207,7 @@ void OtrProxyChannel::Adaptee::disconnectProxy(
void OtrProxyChannel::Adaptee::processOTRmessage(const OTR::Message &message)
{
- kDebug();
+ qCDebug(KTP_PROXY);
switch(message.direction()) {
case OTR::MessageDirection::INTERNAL:
case OTR::MessageDirection::FROM_PEER:
@@ -223,7 +221,7 @@ void OtrProxyChannel::Adaptee::processOTRmessage(const OTR::Message &message)
void OtrProxyChannel::Adaptee::sendOTRmessage(const OTR::Message &message)
{
- kDebug();
+ qCDebug(KTP_PROXY);
uint flags = 0;
PendingSendMessageResult *pending = new PendingSendMessageResult(
chan->send(message.parts(), (Tp::MessageSendingFlags) flags),
@@ -241,7 +239,7 @@ void OtrProxyChannel::Adaptee::sendOTRmessage(const OTR::Message &message)
void OtrProxyChannel::Adaptee::sendMessage(const Tp::MessagePartList &message, uint flags,
const Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr &context)
{
- kDebug();
+ qCDebug(KTP_PROXY);
if(!connected()) {
context->setFinishedWithError(KTP_PROXY_ERROR_NOT_CONNECTED, QString::fromLatin1("Proxy is not connected"));
@@ -251,7 +249,7 @@ void OtrProxyChannel::Adaptee::sendMessage(const Tp::MessagePartList &message, u
OTR::Message otrMessage(message);
const OTR::CryptResult cres = otrSes.encrypt(otrMessage);
if(cres == OTR::CryptResult::ERROR) {
- kDebug() << "Sending error";
+ qCDebug(KTP_PROXY) << "Sending error";
context->setFinishedWithError(KTP_PROXY_ERROR_ENCRYPTION_ERROR,
QLatin1String("Message could not be encrypted with OTR"));
return;
@@ -283,12 +281,12 @@ void OtrProxyChannel::Adaptee::acknowledgePendingMessages(const Tp::UIntList &id
return;
}
- kDebug() << "Message queue size: " << messages.size();
+ qCDebug(KTP_PROXY) << "Message queue size: " << messages.size();
QList<Tp::ReceivedMessage> toAcknowledge;
for(uint id: ids) {
auto found = messages.find(id);
if(found == messages.end()) {
- kDebug() << "Client trying to acknowledge non existing message with id" << id;
+ qCDebug(KTP_PROXY) << "Client trying to acknowledge non existing message with id" << id;
context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT,
QLatin1String("Message with given ID is not present in the message queue"));
return;
@@ -297,14 +295,14 @@ void OtrProxyChannel::Adaptee::acknowledgePendingMessages(const Tp::UIntList &id
}
}
- kDebug() << "Acknowledging " << toAcknowledge.count() << " messages";
+ qCDebug(KTP_PROXY) << "Acknowledging " << toAcknowledge.count() << " messages";
chan->acknowledge(toAcknowledge);
context->setFinished();
}
void OtrProxyChannel::Adaptee::initialize(const Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr &context)
{
- kDebug();
+ qCDebug(KTP_PROXY);
if(!connected()) {
context->setFinishedWithError(KTP_PROXY_ERROR_NOT_CONNECTED, QString::fromLatin1("Proxy is not connected"));
return;
@@ -341,7 +339,7 @@ void OtrProxyChannel::Adaptee::trustFingerprint(const QString& fingerprint, bool
return;
}
- kDebug() << "TrustFingeprint - " << trust << ": " << fingerprint << " when remote is: " << otrSes.remoteFingerprint();
+ qCDebug(KTP_PROXY) << "TrustFingeprint - " << trust << ": " << fingerprint << " when remote is: " << otrSes.remoteFingerprint();
if(otrSes.remoteFingerprint().isEmpty() || fingerprint != otrSes.remoteFingerprint()) {
context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT,
@@ -352,7 +350,7 @@ void OtrProxyChannel::Adaptee::trustFingerprint(const QString& fingerprint, bool
OTR::TrustFpResult fpRes = otrSes.trustFingerprint(trust);
if(fpRes != OTR::TrustFpResult::OK) {
// should not happend, TODO clarify
- kDebug() << "Trust error";
+ qCDebug(KTP_PROXY) << "Trust error";
context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT,
QLatin1String("No such fingerprint currently in use by remote contact"));
return;
@@ -415,7 +413,7 @@ void OtrProxyChannel::Adaptee::onMessageReceived(const Tp::ReceivedMessage &rece
return;
}
- kDebug() << "Received message with id: " << id;
+ qCDebug(KTP_PROXY) << "Received message with id: " << id;
const OTR::CryptResult cres = otrSes.decrypt(otrMsg);
if(cres == OTR::CryptResult::CHANGED || cres == OTR::CryptResult::UNCHANGED) {
@@ -425,7 +423,7 @@ void OtrProxyChannel::Adaptee::onMessageReceived(const Tp::ReceivedMessage &rece
} else {
// Error or OTR message - acknowledge right now
if(cres == OTR::CryptResult::ERROR) {
- kWarning() << "Decryption error of the message: " << otrMsg.text();
+ qCWarning(KTP_PROXY) << "Decryption error of the message: " << otrMsg.text();
}
chan->acknowledge(QList<Tp::ReceivedMessage>() << receivedMessage);
}
@@ -437,7 +435,7 @@ void OtrProxyChannel::Adaptee::onPendingMessageRemoved(const Tp::ReceivedMessage
if(messages.remove(id)) {
Q_EMIT pendingMessagesRemoved(Tp::UIntList() << id);
} else {
- kDebug() << "Text channel removed missing pending message with id or an OTR message: " << id;
+ qCDebug(KTP_PROXY) << "Text channel removed missing pending message with id or an OTR message: " << id;
}
}
@@ -479,7 +477,7 @@ void OtrProxyChannel::Adaptee::onTrustLevelChanged(TrustLevel trustLevel)
void OtrProxyChannel::Adaptee::acquirePrivateKey()
{
if(!ps->createNewPrivateKey(otrSes.context().accountId, otrSes.context().accountName)) {
- kDebug() << "Probably ongoing key generation for another session";
+ qCDebug(KTP_PROXY) << "Probably ongoing key generation for another session";
}
}
@@ -496,11 +494,11 @@ void OtrProxyChannel::Adaptee::onKeyGenerationFinished(const QString &accountId,
if(accountId != otrSes.context().accountId) {
return;
}
- kDebug() << "Finished key generation for: " << accountId;
+ qCDebug(KTP_PROXY) << "Finished key generation for: " << accountId;
isGenerating = false;
if(error) {
- kWarning() << "Could not generate private key for " << accountId;
+ qCWarning(KTP_PROXY) << "Could not generate private key for " << accountId;
return;
}
if(!enqueuedMessages.isEmpty()) {
@@ -517,7 +515,7 @@ void OtrProxyChannel::Adaptee::onKeyGenerationFinished(const QString &accountId,
void OtrProxyChannel::Adaptee::onChannelClosed()
{
- kDebug();
+ qCDebug(KTP_PROXY);
// we will not be able to send disconnect message so we just finish our own OTR session
if(isConnected) {
otrSes.forceUnencrypted();
diff --git a/otr-proxy/KTpProxy/otr-utils.cpp b/otr-proxy/KTpProxy/otr-utils.cpp
index 1a60f07..4b50622 100644
--- a/otr-proxy/KTpProxy/otr-utils.cpp
+++ b/otr-proxy/KTpProxy/otr-utils.cpp
@@ -18,6 +18,7 @@
***************************************************************************/
#include "otr-utils.h"
+#include "ktp-proxy-debug.h"
namespace OTR
{
@@ -71,7 +72,7 @@ namespace utils
instance, 0, NULL, NULL, NULL);
if(context == nullptr) {
- kWarning() << "Could not get trust level";
+ qCWarning(KTP_PROXY) << "Could not get trust level";
return TrustLevel::NOT_PRIVATE;
}
diff --git a/otr-proxy/KTpProxy/otr-utils.h b/otr-proxy/KTpProxy/otr-utils.h
index ce96c85..fd80d14 100644
--- a/otr-proxy/KTpProxy/otr-utils.h
+++ b/otr-proxy/KTpProxy/otr-utils.h
@@ -26,8 +26,6 @@
#include <QStringList>
#include <QDBusObjectPath>
-#include <KDebug>
-
extern "C" {
#include <libotr/privkey.h>
}
diff --git a/otr-proxy/KTpProxy/proxy-observer.cpp b/otr-proxy/KTpProxy/proxy-observer.cpp
index eb588f3..f8c715d 100644
--- a/otr-proxy/KTpProxy/proxy-observer.cpp
+++ b/otr-proxy/KTpProxy/proxy-observer.cpp
@@ -25,7 +25,7 @@
#include <TelepathyQt/TextChannel>
#include <TelepathyQt/PendingReady>
-#include <KDebug>
+#include <QDebug>
ProxyObserver::ProxyObserver(ProxyService *ps)
: Tp::AbstractClientObserver(Tp::ChannelClassSpecList() << Tp::ChannelClassSpec::textChat(), true),
@@ -50,7 +50,6 @@ void ProxyObserver::observeChannels(
Q_UNUSED(dispatchOperation);
Q_UNUSED(requestsSatisfied);
Q_UNUSED(observerInfo);
- kDebug() << "Observed a channel";
Q_FOREACH(const Tp::ChannelPtr &chan, channels) {
@@ -58,7 +57,7 @@ void ProxyObserver::observeChannels(
if(textChannel) {
ps->addChannel(textChannel, account);
} else {
- kWarning() << "Could not get a text channel";
+ qWarning() << "Could not get a text channel";
}
}
diff --git a/otr-proxy/KTpProxy/proxy-service.cpp b/otr-proxy/KTpProxy/proxy-service.cpp
index c9d2fd6..79c4cdc 100644
--- a/otr-proxy/KTpProxy/proxy-service.cpp
+++ b/otr-proxy/KTpProxy/proxy-service.cpp
@@ -23,6 +23,7 @@
#include "otr-config.h"
#include "otr-utils.h"
#include "pending-curry-operation.h"
+#include "ktp-proxy-debug.h"
#include "KTp/OTR/constants.h"
@@ -30,7 +31,6 @@
#include <TelepathyQt/TextChannel>
#include <TelepathyQt/PendingReady>
-#include <KDebug>
#include <KApplication>
@@ -74,7 +74,7 @@ void ProxyService::addChannel(const Tp::TextChannelPtr &channel, const Tp::Accou
proxyChannel->registerService(&error);
if(error.isValid()) {
- kError() << "Couldn't install proxy for the channel: " << channel->objectPath() << "
"
+ qCCritical(KTP_PROXY) << "Couldn't install proxy for the channel: " << channel->objectPath() << "
"
<< "error name: " << error.name() << "
"
<< "error message: " << error.message();
@@ -91,7 +91,7 @@ void ProxyService::addChannel(const Tp::TextChannelPtr &channel, const Tp::Accou
proxyChannel.data(), SIGNAL(disconnected(const QDBusObjectPath&)),
&adaptee, SLOT(onProxyDisconnected(const QDBusObjectPath&)));
- kDebug() << "Installed proxy: " << proxyChannel->objectPath() << "
"
+ qCDebug(KTP_PROXY) << "Installed proxy: " << proxyChannel->objectPath() << "
"
<< " for the channel: " << channel->objectPath() << "
"
<< "Context: " << "
"
<< " id: " << ctx.accountId << "
"
@@ -132,7 +132,7 @@ void ProxyService::setPolicy(OtrlPolicy otrPolicy)
void ProxyService::onChannelProxyClosed()
{
OtrProxyChannel *proxyChannel = dynamic_cast<OtrProxyChannel*>(QObject::sender());
- kDebug() << "Removing proxy: " << proxyChannel->objectPath()
+ qCDebug(KTP_PROXY) << "Removing proxy: " << proxyChannel->objectPath()
<< " for the channel: " << proxyChannel->wrappedChannel()->objectPath();
proxyChannel->dbusConnection().unregisterObject(proxyChannel->objectPath());
@@ -146,12 +146,12 @@ void ProxyService::onChannelProxyClosed()
bool ProxyService::createNewPrivateKey(const QString &accountId, const QString &accountName)
{
- kDebug() << "Generating new private key for " << accountId;
+ qCDebug(KTP_PROXY) << "Generating new private key for " << accountId;
OTR::KeyGenerationWorker *keyWorker = manager.createNewPrivateKey(accountId, accountName);
if(keyWorker) {
if(keyWorker->prepareCreation()) {
// alredy started creation for this account
- kDebug() << "Cannot prepare key generation for " << accountId;
+ qCDebug(KTP_PROXY) << "Cannot prepare key generation for " << accountId;
keyWorker->deleteLater();
return false;
}
@@ -193,10 +193,10 @@ bool ProxyService::forgetFingerprint(const QString &accountId, const QString &co
void ProxyService::onKeyGenerationThreadFinished()
{
OTR::KeyGenerationWorker *worker = qobject_cast<OTR::KeyGenerationWorker*>(QObject::sender());
- kDebug() << "Finished generating a new private key for " << worker->accountId;
+ qCDebug(KTP_PROXY) << "Finished generating a new private key for " << worker->accountId;
if(worker->error() || worker->finalizeCreation()) {
- kDebug() << "Error generating private key for " << worker->accountId;
+ qCDebug(KTP_PROXY) << "Error generating private key for " << worker->accountId;
Q_EMIT keyGenerationFinished(worker->accountId, true);
} else{
Q_EMIT keyGenerationFinished(worker->accountId, false);
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list