Commit b1a0bd76 authored by Laurent Montel's avatar Laurent Montel 😁 Committed by Pali Rohár

Port to qCDebug

parent 07a37550
org.kde.kopete.libkopete kopete (libkopete)
org.kde.kopete.jabber kopete (jabber protocol)
org.kde.kopete.plugin.otr kopete (otr plugin)
......@@ -4,7 +4,10 @@ include_directories(${LIBOTR_INCLUDE_DIR} ${KOPETE_INCLUDES})
########### next target ###############
set(kopete_otr_PART_SRCS otrguiclient.cpp otrplugin.cpp)
set(kopete_otr_common_SRCS)
ecm_qt_declare_logging_category(kopete_otr_common_SRCS HEADER plugin_otr_debug.h IDENTIFIER KOPETE_PLUGIN_OTR_LOG CATEGORY_NAME org.kde.kopete.plugin.otr)
set(kopete_otr_PART_SRCS otrguiclient.cpp otrplugin.cpp ${kopete_otr_common_SRCS})
kconfig_add_kcfg_files(kopete_otr_PART_SRCS kopete_otr.kcfgc)
......@@ -31,6 +34,7 @@ install(TARGETS kcm_kopete_otr DESTINATION ${KDE_INSTALL_PLUGINDIR})
########### next target ###############
set(kopete_otr_shared_LIB_SRCS
${kopete_otr_common_SRCS}
otrlchatinterface.cpp
otrlconfinterface.cpp
authenticationwizard.cpp
......
......@@ -24,7 +24,7 @@
#include "authenticationwizard.h"
#include <kdebug.h>
#include "plugin_otr_debug.h"
#include <klocale.h>
#include <kopetecontact.h>
#include <knotification.h>
......@@ -269,7 +269,7 @@ int AuthenticationWizard::nextId() const
bool AuthenticationWizard::validateCurrentPage()
{
kDebug(14318) << "currentId:" << currentId();
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "currentId:" << currentId();
switch (currentId()) {
case 1:
if (initiate) {
......@@ -299,7 +299,7 @@ bool AuthenticationWizard::validateCurrentPage()
void AuthenticationWizard::cancelVerification()
{
kDebug(14318) << "cancelVerification...";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "cancelVerification...";
if (!initiate) {
OtrlChatInterface::self()->abortSMP(context, session);
}
......@@ -315,21 +315,21 @@ void AuthenticationWizard::nextState()
void AuthenticationWizard::finished(bool success, bool trust)
{
kDebug(14318) << "authWizard finished";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "authWizard finished";
if (currentId() == Page_Wait2) {
kDebug(14318) << "Yes, in wait_page2";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Yes, in wait_page2";
((WaitPage *)currentPage())->ready();
next();
if (success) {
kDebug(14318) << "auth succeeded";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "auth succeeded";
currentPage()->setTitle(i18n("Authentication successful"));
if (question != NULL || rbQA->isChecked()) {
if (initiate) {
kDebug(14318) << "initiate";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "initiate";
lFinal->setText(i18n("The authentication with %1 was completed successfully. The conversation is now secure.",
OtrlChatInterface::self()->formatContact(session->members().first()->contactId())));
} else {
kDebug(14318) << "not initiate";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "not initiate";
if (trust) {
lFinal->setText(i18n("The authentication with %1 was completed successfully. The conversation is now secure.",
OtrlChatInterface::self()->formatContact(session->members().first()->contactId())));
......@@ -388,7 +388,7 @@ void AuthenticationWizard::updateInfoBox()
void AuthenticationWizard::notificationActivated(unsigned int id)
{
kDebug(14318) << "notificationActivated. ButtonId" << id;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "notificationActivated. ButtonId" << id;
if (id == 1) {
// raise the view to bring the chatwindow + authwizard to current desktop and on top
session->view()->raise(true);
......
......@@ -28,7 +28,7 @@
#include <kopetechatsession.h>
#include <ui/kopeteview.h>
#include <kopetemessage.h>
#include <kdebug.h>
#include "plugin_otr_debug.h"
#include <kmessagebox.h>
#include <qicon.h>
......@@ -108,7 +108,7 @@ void OtrGUIClient::slotVerifyFingerprint()
void OtrGUIClient::encryptionEnabled(Kopete::ChatSession *session, int state)
{
kDebug(14318) << "OTRGUIClient switched security state to: " << state;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "OTRGUIClient switched security state to: " << state;
if (session == m_manager) {
switch (state) {
case 0:
......
......@@ -36,7 +36,7 @@
#include <kopetecontact.h>
#include <KGlobal>
#include <KLocalizedString>
#include <kdebug.h>
#include "plugin_otr_debug.h"
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <klocale.h>
......@@ -142,7 +142,7 @@ void OtrlChatInterface::inject_message(void *opdata, const char *accountname, co
Q_UNUSED(accountname)
Q_UNUSED(protocol)
// kDebug(14318) << "Sending message:" << message;
// qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Sending message:" << message;
Kopete::ChatSession *session = ((Kopete::ChatSession *)opdata);
Kopete::ContactPtrList list = session->members();
......@@ -206,7 +206,7 @@ void OtrlChatInterface::gone_secure(void *opdata, ConnContext *context)
OtrlChatInterface::self()->emitGoneSecure(((Kopete::ChatSession *)opdata), 1);
}
kDebug(14318) << "Updating otr-instag to" << context->their_instance << "for session" << session;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Updating otr-instag to" << context->their_instance << "for session" << session;
session->setProperty("otr-instag", QString::number(context->their_instance));
}
......@@ -246,13 +246,13 @@ int OtrlChatInterface::max_message_size(void *opdata, ConnContext *context)
Q_UNUSED(context)
if (!opdata) {
kDebug(14318) << "Trying to determine max message size of unknown session. Fragmentation will not work.";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Trying to determine max message size of unknown session. Fragmentation will not work.";
return 0;
}
Kopete::ChatSession *session = ((Kopete::ChatSession *)opdata);
kDebug(14318) << session->protocol()->pluginId();
qCDebug(KOPETE_PLUGIN_OTR_LOG) << session->protocol()->pluginId();
if (session->protocol()->pluginId() == QLatin1String("WlmProtocol")) {
return 1409;
......@@ -367,7 +367,7 @@ void OtrlChatInterface::handle_smp_event(void *opdata, OtrlSMPEvent smp_event, C
case OTRL_SMPEVENT_SUCCESS:
if (context->active_fingerprint->trust && context->active_fingerprint->trust[0]) {
AuthenticationWizard::findWizard(chatSession)->finished(true, true);
kDebug(14318) << "trust found";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "trust found";
Kopete::Message msg(chatSession->members().first(), chatSession->account()->myself());
msg.setHtmlBody(i18n("Authentication with <b>%1</b> successful. The conversation is now secure.", formatContact(chatSession->members().first()->contactId())));
msg.setDirection(Kopete::Message::Internal);
......@@ -375,7 +375,7 @@ void OtrlChatInterface::handle_smp_event(void *opdata, OtrlSMPEvent smp_event, C
OtrlChatInterface::self()->emitGoneSecure(chatSession, 2);
} else {
AuthenticationWizard::findWizard(chatSession)->finished(true, false);
kDebug(14318) << "trust _NOT_ found";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "trust _NOT_ found";
Kopete::Message msg(chatSession->members().first(), chatSession->account()->myself());
msg.setHtmlBody(i18n("<b>%1</b> has successfully authenticated you. You may want to authenticate this contact as well by asking your own question.",
formatContact(chatSession->members().first()->contactId())));
......@@ -434,9 +434,9 @@ void OtrlChatInterface::handle_msg_event(void *opdata, OtrlMessageEvent msg_even
}
switch (gcry_err_code(err)) {
case GPG_ERR_INV_VALUE:
kDebug(14318) << "Error setting up private conversation: Malformed message received";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Error setting up private conversation: Malformed message received";
default:
kDebug(14318) << "Error setting up private conversation:" << err;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Error setting up private conversation:" << err;
}
msg.setHtmlBody(i18n("OTR error"));
......@@ -464,10 +464,10 @@ void OtrlChatInterface::handle_msg_event(void *opdata, OtrlMessageEvent msg_even
msg.setDirection(Kopete::Message::Internal);
break;
case OTRL_MSGEVENT_LOG_HEARTBEAT_RCVD:
kDebug(14318) << "Heartbeat received from" << context->username;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Heartbeat received from" << context->username;
return;
case OTRL_MSGEVENT_LOG_HEARTBEAT_SENT:
kDebug(14318) << "Heartbeat sent to" << context->username;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Heartbeat sent to" << context->username;
return;
case OTRL_MSGEVENT_RCVDMSG_GENERAL_ERR:
msg.setHtmlBody(QLatin1String(message));
......@@ -480,7 +480,7 @@ void OtrlChatInterface::handle_msg_event(void *opdata, OtrlMessageEvent msg_even
OtrlChatInterface::self()->m_blackistIds.append(msg.id());
break;
case OTRL_MSGEVENT_RCVDMSG_UNRECOGNIZED:
kDebug(14318) << "Unrecognized OTR message received from" << context->username;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Unrecognized OTR message received from" << context->username;
return;
case OTRL_MSGEVENT_RCVDMSG_FOR_OTHER_INSTANCE:
msg.setHtmlBody(i18n("%1 has sent an encrypted message intended for a different session. If you are logged in multiple times, another session may have received the message.",
......@@ -620,7 +620,7 @@ int OtrlChatInterface::decryptMessage(Kopete::Message &message)
if (context && !ignoremessage && newMessage != NULL) {
otrl_instag_t instance = message.manager()->property("otr-instag").toUInt();
if (instance != context->their_instance && context->their_instance) {
kDebug(14318) << "Encrypted message from different instance was received";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Encrypted message from different instance was received";
gone_secure((void *)chatSession, context);
}
}
......@@ -691,7 +691,7 @@ int OtrlChatInterface::encryptMessage(Kopete::Message &message)
OtrlMessageType type = otrl_proto_message_type(msgBody.toLatin1());
if (type == OTRL_MSGTYPE_TAGGEDPLAINTEXT) {
kDebug(14318) << "Tagged plaintext!";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Tagged plaintext!";
/* Here we have a problem... libotr tags messages with whitespaces to
be recognized by other clients. Those whitespaces are discarded
......@@ -776,7 +776,7 @@ int OtrlChatInterface::privState(Kopete::ChatSession *session)
if (context) {
if (instance == OTRL_INSTAG_BEST && context->their_instance) {
kDebug(14318) << "Updating otr-instag to" << context->their_instance << "for session" << session;
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Updating otr-instag to" << context->their_instance << "for session" << session;
session->setProperty("otr-instag", QString::number(context->their_instance));
}
switch (context->msgstate) {
......@@ -892,11 +892,11 @@ void OtrlChatInterface::setTrust(Kopete::ChatSession *session, bool trust)
} else {
otrl_context_set_trust(fingerprint, NULL);
}
kDebug(14318) << "Writing fingerprints";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Writing fingerprints";
otrl_privkey_write_fingerprints(userstate, QString(QString(KGlobal::dirs()->saveLocation("data", QStringLiteral("kopete_otr/"), true)) + "fingerprints").toLocal8Bit());
emitGoneSecure(session, privState(session));
} else {
kDebug(14318) << "could not find fingerprint";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "could not find fingerprint";
}
}
......@@ -950,7 +950,7 @@ void OtrlChatInterface::initSMPQ(ConnContext *context, Kopete::ChatSession *sess
void OtrlChatInterface::respondSMP(ConnContext *context, Kopete::ChatSession *session, const QString &secret)
{
kDebug(14318) << "resonding SMP";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "resonding SMP";
otrl_message_respond_smp(userstate, &ui_ops, session, context, (unsigned char *)secret.toLocal8Bit().data(), secret.length());
......
......@@ -34,7 +34,7 @@
#include <kopeteaccount.h>
#include "kopeteuiglobal.h"
#include <kdebug.h>
#include "plugin_otr_debug.h"
#include <kstandarddirs.h>
#include <klocale.h>
#include <kglobal.h>
......@@ -144,7 +144,7 @@ void OtrlConfInterface::verifyFingerprint(const QString &strFingerprint, bool tr
}
otrl_privkey_write_fingerprints(userstate, QString(QString(KGlobal::dirs()->saveLocation("data", QStringLiteral("kopete_otr/"), true)) + "fingerprints").toLocal8Bit());
} else {
kDebug(14318) << "could not find fingerprint";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "could not find fingerprint";
}
}
......
......@@ -29,7 +29,7 @@
#include <qcolor.h>
#include <KStandardDirs>
#include <kdebug.h>
#include "plugin_otr_debug.h"
#include <qaction.h>
#include <kconfig.h>
#include <kgenericfactory.h>
......@@ -60,7 +60,7 @@ K_EXPORT_PLUGIN(OTRPluginFactory("kopete_otr"))
OTRPlugin::OTRPlugin (QObject *parent, const QVariantList & /*args*/)
: Kopete::Plugin(parent)
{
kDebug(14318) << "OTR Plugin loading...";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "OTR Plugin loading...";
if (!pluginStatic_) {
pluginStatic_ = this;
......@@ -122,7 +122,7 @@ OTRPlugin::~OTRPlugin()
{
delete m_inboundHandler;
pluginStatic_ = nullptr;
kDebug(14318) << "Exiting OTR plugin";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Exiting OTR plugin";
}
OTRPlugin *OTRPlugin::plugin()
......@@ -164,7 +164,7 @@ void OTRPlugin::slotOutgoingMessage(Kopete::Message &msg)
messageCache.insert(QStringLiteral("!OTR:MsgDelByOTR"), qMakePair(cacheBody, cachePlain));
}
kDebug(14318) << "Outgoing message after processing:" << msg.plainBody() << msg.format();
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Outgoing message after processing:" << msg.plainBody() << msg.format();
}
}
......@@ -243,7 +243,7 @@ void OtrMessageHandler::handleMessage(Kopete::MessageEvent *event)
// Kopete::ChatSession *session = msg.manager();
QMap<QString, QPair<QString, bool> > messageCache = plugin->getMessageCache();
kDebug(14318) << "OtrMessageHandler::handleMessage:" << msg.plainBody();
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "OtrMessageHandler::handleMessage:" << msg.plainBody();
if (msg.direction() == Kopete::Message::Inbound) {
if (msg.type() == Kopete::Message::TypeFileTransferRequest) {
......@@ -263,7 +263,7 @@ void OtrMessageHandler::handleMessage(Kopete::MessageEvent *event)
}
} else if (msg.direction() == Kopete::Message::Outbound) {
const QString &plainBody = msg.plainBody();
// kDebug(14318) << "searching cache for" << msg.plainBody();
// qCDebug(KOPETE_PLUGIN_OTR_LOG) << "searching cache for" << msg.plainBody();
if (messageCache.contains(plainBody)) {
if (!messageCache[plainBody].second) {
msg.setHtmlBody(messageCache[plainBody].first);
......@@ -278,7 +278,7 @@ void OtrMessageHandler::handleMessage(Kopete::MessageEvent *event)
// Check if Message is an OTR message. Should it be discarded or shown?
if (OtrlChatInterface::self()->shouldDiscard(msg.plainBody())) {
event->discard();
kDebug(14318) << "OTR: discarding message";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "OTR: discarding message";
return;
}
// If the message is sent while a Finished state libotr deletes the messagetext.
......@@ -325,12 +325,12 @@ void OTRPlugin::slotSelectionChanged(bool single)
void OTRPlugin::slotSetPolicy()
{
kDebug(14318) << "Setting contact policy";
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Setting contact policy";
Kopete::MetaContact *metaContact = Kopete::ContactList::self()->selectedMetaContacts().first();
if (metaContact) {
metaContact->setPluginData(this, QStringLiteral("otr_policy"), QString::number(otrPolicyMenu->currentItem() - 1)); // -1 because of the Separator
}
kDebug(14318) << "Selected policy: " << otrPolicyMenu->currentItem();
qCDebug(KOPETE_PLUGIN_OTR_LOG) << "Selected policy: " << otrPolicyMenu->currentItem();
}
void OTRPlugin::slotSecuritySate(Kopete::ChatSession *session, int state)
......
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