Commit 9eab1252 authored by Karel Slaný's avatar Karel Slaný

Eradicated qDebug() calls from the sources.

parent 35b1aae3
......@@ -25,6 +25,7 @@
#include <QUrl>
#include "src/accounts.h"
#include "src/datovka_shared/log/log.h"
#include "src/dialogues/dialogues.h"
#include "src/global.h"
#include "src/models/accountmodel.h"
......@@ -60,7 +61,7 @@ bool Accounts::boxEffectiveOVM(const QString &userName)
void Accounts::updateAccountCounters(const QVariant &acntModelVariant)
{
qDebug("%s()", __func__);
debugFuncCall();
AccountListModel *accountModel =
AccountListModel::fromVariant(acntModelVariant);
......@@ -76,7 +77,7 @@ void Accounts::updateAccountCounters(const QVariant &acntModelVariant)
void Accounts::updateNewMessageCounter(const QVariant &acntModelVariant,
const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -108,7 +109,7 @@ void Accounts::updateNewMessageCounter(const QVariant &acntModelVariant,
QString Accounts::fillAccountInfo(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (GlobInstcs::accountDbPtr != Q_NULLPTR) {
return GlobInstcs::accountDbPtr->accountDetailHtml(userName);
......@@ -120,7 +121,7 @@ QString Accounts::fillAccountInfo(const QString &userName)
void Accounts::getAccountData(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::acntMapPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -143,7 +144,7 @@ bool Accounts::createAccount(const QVariant &acntModelVariant,
const QString &pwd, bool isTestAccount, bool rememberPwd, bool storeToDisk,
const QString &certPath)
{
qDebug("%s()", __func__);
debugFuncCall();
AccountListModel *accountModel =
AccountListModel::fromVariant(acntModelVariant);
......@@ -187,7 +188,7 @@ bool Accounts::updateAccount(const QVariant &acntModelVariant,
const QString &pwd, bool isTestAccount, bool rememberPwd, bool storeToDisk,
const QString &certPath)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -277,7 +278,7 @@ bool Accounts::updateAccount(const QVariant &acntModelVariant,
bool Accounts::removeAccount(const QVariant &acntModelVariant,
const QString &userName, bool showDialogue)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::accountDbPtr == Q_NULLPTR) ||
......@@ -360,7 +361,7 @@ bool Accounts::removeAccount(const QVariant &acntModelVariant,
void Accounts::loadModelCounters(AccountListModel *accountModel)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......
......@@ -21,8 +21,7 @@
* the two.
*/
#ifndef _ACCOUNTS_H_
#define _ACCOUNTS_H_
#pragma once
#include <QObject>
......@@ -174,5 +173,3 @@ signals:
*/
void removeIsdsCtx(QString userName);
};
#endif /* _ACCOUNTS_H_ */
......@@ -26,14 +26,12 @@
#include <QTimer>
#include <QUrl>
#include "src/datovka_shared/log/log.h"
#include "src/datovka_shared/records_management/io/records_management_connection.h"
/* Must be set to false for production releases. */
const bool RecordsManagementConnection::ignoreSslErrorsDflt = false;
#define logFuncCall() \
qDebug("%s()", __func__)
/*!
* @brief Converts service identifier onto service name.
*/
......@@ -109,7 +107,7 @@ void RecordsManagementConnection::setConnection(const QString &baseUrl,
bool RecordsManagementConnection::communicate(enum ServiceId srvcId,
const QByteArray &requestData, QByteArray &replyData)
{
logFuncCall();
debugFuncCall();
QNetworkRequest request(createRequest(srvcId));
......@@ -127,13 +125,13 @@ bool RecordsManagementConnection::communicate(enum ServiceId srvcId,
timer.start(m_timeOut);
eventLoop.exec();
qDebug("Loop exited, reply finished: %d", reply->isFinished());
logDebugLv0NL("Loop exited, reply finished: %d", reply->isFinished());
QList<QByteArray> headerList(reply->rawHeaderList());
if (!reply->rawHeaderPairs().isEmpty()) {
qDebug("%s", "Received raw headers:");
logDebugLv0NL("%s", "Received raw headers:");
foreach (const QNetworkReply::RawHeaderPair &pair,
reply->rawHeaderPairs()) {
qDebug("%s: %s", pair.first.constData(),
logDebugLv0NL("%s: %s", pair.first.constData(),
pair.second.constData());
}
}
......@@ -194,7 +192,7 @@ bool RecordsManagementConnection::addTrustedCertificate(const QString &filePath)
}
if (readAndAddCert(certData, QSsl::Pem)) {
qDebug("Read PEN certificate '%s'.",
logDebugLv0NL("Read PEN certificate '%s'.",
filePath.toUtf8().constData());
return true;
} else {
......@@ -202,7 +200,7 @@ bool RecordsManagementConnection::addTrustedCertificate(const QString &filePath)
filePath.toUtf8().constData());
}
if (readAndAddCert(certData, QSsl::Der)) {
qDebug("Read DER certificate '%s'.",
logDebugLv0NL("Read DER certificate '%s'.",
filePath.toUtf8().constData());
return true;
} else {
......@@ -246,7 +244,7 @@ void RecordsManagementConnection::handleSslErrors(QNetworkReply *reply,
QNetworkRequest RecordsManagementConnection::createRequest(
enum ServiceId srvcId) const
{
logFuncCall();
debugFuncCall();
QNetworkRequest request;
......@@ -265,7 +263,7 @@ QNetworkRequest RecordsManagementConnection::createRequest(
QNetworkReply *RecordsManagementConnection::sendRequest(
const QNetworkRequest &request, const QByteArray &data)
{
logFuncCall();
debugFuncCall();
switch (m_nam.networkAccessible()) {
case QNetworkAccessManager::UnknownAccessibility:
......@@ -297,7 +295,7 @@ QNetworkReply *RecordsManagementConnection::sendRequest(
bool RecordsManagementConnection::processReply(QNetworkReply *reply,
QByteArray &replyData)
{
logFuncCall();
debugFuncCall();
if (reply == Q_NULLPTR) {
Q_ASSERT(0);
......
This diff is collapsed.
......@@ -21,8 +21,7 @@
* the two.
*/
#ifndef FILES_H
#define FILES_H
#pragma once
#include <QObject>
......@@ -363,5 +362,3 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Files::MsgAttachFlags)
Q_DECLARE_METATYPE(Files::FileIdType)
Q_DECLARE_METATYPE(Files::MsgAttachFlag)
Q_DECLARE_METATYPE(Files::MsgAttachFlags)
#endif // FILES_H
......@@ -373,11 +373,11 @@ int main(int argc, char *argv[])
Localisation::shortLangName(GlobInstcs::setPtr->language));
Localisation::setProgramLocale(GlobInstcs::setPtr->language);
if (!datovkaTrans.load("datovka_" + lang, ":/locale/")) {
qDebug() << "Could not load datovka localisation file...";
logErrorNL("%s", "Could not load datovka localisation file.");
}
app.installTranslator(&datovkaTrans);
if (!qtbaseTrans.load("qtbase_" + lang, ":/locale/")) {
qDebug() << "Could not load qtbase localisation file...";
logErrorNL("%s", "Could not load qtbase localisation file.");
}
app.installTranslator(&qtbaseTrans);
......@@ -529,7 +529,7 @@ int main(int argc, char *argv[])
QString dbPath(dirName + QDir::separator() + ACNT_DB_NAME);
if (!GlobInstcs::accountDbPtr->openDb(dbPath,
SQLiteDb::CREATE_MISSING)) {
logErrorNL("%s", "Account database not found!");
logWarningNL("%s", "Account database not found!");
return EXIT_FAILURE;
}
......@@ -537,7 +537,7 @@ int main(int argc, char *argv[])
QString rmDbPath(dirName + QDir::separator() + RECORDS_MANAGEMENT_DB_FILE);
if (!GlobInstcs::recMgmtDbPtr->openDb(
rmDbPath, SQLiteDb::CREATE_MISSING)) {
logErrorNL("Error opening records management db '%s'.",
logWarningNL("Error opening records management db '%s'.",
rmDbPath.toUtf8().constData());
return EXIT_FAILURE;
}
......@@ -559,7 +559,7 @@ int main(int argc, char *argv[])
*/
if (!GlobInstcs::zfoDbPtr->openDb(
ZFO_DB_NAME, (GlobInstcs::setPtr->zfoDbSizeMBs > 0))) {
qDebug() << "ERROR: zfo db not found!";
logWarningNL("%s", "ZFO db not found.");
}
/* load UI (QML) */
......
......@@ -30,6 +30,7 @@
#include "src/dialogues/dialogues.h"
#include "src/global.h"
#include "src/datovka_shared/isds/type_conversion.h"
#include "src/datovka_shared/log/log.h"
#include "src/messages.h"
#include "src/models/accountmodel.h"
#include "src/models/databoxmodel.h"
......@@ -76,7 +77,7 @@ Messages::Messages(QObject *parent) : QObject(parent)
void Messages::fillContactList(const QVariant &dbModelVariant,
const QString &userName, const QString &dbId)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -108,7 +109,7 @@ void Messages::fillContactList(const QVariant &dbModelVariant,
void Messages::fillMessageList(const QVariant &msgModelVariant,
const QString &userName, enum MessageType msgType)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -142,7 +143,7 @@ void Messages::fillMessageList(const QVariant &msgModelVariant,
QString Messages::getMessageDetail(const QString &userName,
const QString &msgIdStr)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -170,7 +171,7 @@ QString Messages::getMessageDetail(const QString &userName,
QmlIsdsEnvelope *Messages::getMsgEnvelopeDataAndSetRecipient(
const QString &userName, qint64 msgId, const QVariant &dbModelVariant)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -207,7 +208,7 @@ QmlIsdsEnvelope *Messages::getMsgEnvelopeDataAndSetRecipient(
void Messages::markMessageAsLocallyRead(const QVariant &msgModelVariant,
const QString &userName, qint64 msgId, bool isRead)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -237,7 +238,7 @@ void Messages::markMessageAsLocallyRead(const QVariant &msgModelVariant,
void Messages::markMessagesAsLocallyRead(const QVariant &msgModelVariant,
const QString &userName, enum MessageType msgType, bool isRead)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -268,7 +269,7 @@ void Messages::markMessagesAsLocallyRead(const QVariant &msgModelVariant,
void Messages::updateRmStatus(const QVariant &msgModelVariant,
const QString &userName, qint64 dmId, bool isUploadRm)
{
qDebug("%s()", __func__);
debugFuncCall();
MessageListModel *messageModel =
MessageListModel::fromVariant(msgModelVariant);
......@@ -283,7 +284,7 @@ void Messages::updateRmStatus(const QVariant &msgModelVariant,
void Messages::deleteMessageFromDbs(const QVariant &acntModelVariant,
const QVariant &msgModelVariant, const QString &userName, qint64 msgId)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -358,7 +359,7 @@ void Messages::deleteMessageFromDbs(const QVariant &acntModelVariant,
bool Messages::moveOrCreateNewDbsToNewLocation(const QString &newLocation)
{
qDebug("%s()", __func__);
debugFuncCall();
int allDbSize = 0;
......@@ -404,7 +405,7 @@ bool Messages::moveOrCreateNewDbsToNewLocation(const QString &newLocation)
void Messages::deleteExpiredMessagesFromDbs(int days)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......@@ -677,7 +678,7 @@ bool Messages::relocateDatabases(const QString &newLocationDir,
int Messages::searchMsg(const QVariant &msgModelVariant, const QString &phrase,
MessageTypes msgTypes)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::setPtr == Q_NULLPTR) ||
(GlobInstcs::messageDbsPtr == Q_NULLPTR) ||
......
......@@ -21,11 +21,11 @@
* the two.
*/
#include <QDebug>
#include <QQmlEngine> /* qmlRegisterType */
#include "src/datovka_shared/crypto/crypto_pwd.h"
#include "src/datovka_shared/crypto/crypto_wrapped.h"
#include "src/datovka_shared/log/log.h"
#include "src/global.h" // GlobInstcs::setPtr
#include "src/models/accountmodel.h"
#include "src/settings.h"
......@@ -181,7 +181,7 @@ QString AcntData::password(void) const
if (!m_pwdAlg.isEmpty() && !m_pwdSalt.isEmpty() &&
!m_pwdCode.isEmpty()) {
qDebug("Decrypting password for user name '%s'.",
logDebugLv0NL("Decrypting password for user name '%s'.",
m_userName.toUtf8().constData());
QString decrypted(decryptPwd(m_pwdCode,
GlobInstcs::setPtr->_pinVal, m_pwdAlg, m_pwdSalt, m_pwdIv));
......@@ -316,7 +316,7 @@ void AcntData::recomputePwd(const QString &oldPin, const QString &newPin)
if (!m_pwdAlg.isEmpty() && !m_pwdSalt.isEmpty() &&
!m_pwdCode.isEmpty()) {
qDebug("Decrypting password for user name '%s'.",
logDebugLv0NL("Decrypting password for user name '%s'.",
m_userName.toUtf8().constData());
QString decrypted(decryptPwd(m_pwdCode,
GlobInstcs::setPtr->_pinVal, m_pwdAlg, m_pwdSalt, m_pwdIv));
......@@ -372,9 +372,9 @@ void readPwdData(AcntData &aData, const QSettings &settings,
QString()).toString().toUtf8()));
if (!aData.password().isEmpty() && !aData.pwdCode().isEmpty()) {
qWarning() << QString(
"Account with user name '%1' has both encrypted and unencrypted password set.")
.arg(aData.userName());
logWarningNL(
"Account with username '%s' has both encrypted and unencrypted password set.",
aData.userName().toUtf8().constData());
}
}
......@@ -502,7 +502,7 @@ void storeAcntData(const QString &pinVal, QSettings &settings,
void AccountsMap::loadAccountsFromSettings(const QSettings &settings)
{
qDebug("%s()", __func__);
debugFuncCall();
QStringList groups = settings.childGroups();
QRegExp credRe(CREDENTIALS ".*");
......@@ -663,7 +663,7 @@ Qt::ItemFlags AccountListModel::flags(const QModelIndex &index) const
void AccountListModel::loadAccountsFromSettings(const QSettings &settings)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(m_accountsPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......
......@@ -21,8 +21,7 @@
* the two.
*/
#ifndef _ACCOUNTMODEL_H_
#define _ACCOUNTMODEL_H_
#pragma once
#include <QAbstractListModel>
#include <QSettings>
......@@ -318,5 +317,3 @@ private:
/* QML passes its arguments via QVariant. */
Q_DECLARE_METATYPE(AccountListModel)
Q_DECLARE_METATYPE(AccountListModel::Roles)
#endif /* _ACCOUNTMODEL_H_ */
......@@ -21,9 +21,9 @@
* the two.
*/
#include <QDebug>
#include <QFileInfo>
#include "src/datovka_shared/log/log.h"
#include "src/global.h"
#include "src/models/accountmodel.h"
#include "src/net/isds_const.h"
......@@ -36,7 +36,7 @@ IsdsSession::IsdsSession(void)
bool IsdsSession::createIsdsCtx(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::acntMapPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -73,7 +73,7 @@ bool IsdsSession::createIsdsCtx(const QString &userName)
bool IsdsSession::removeIsdsCtx(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (isdsCtxMap.contains(userName)) {
isdsCtxMap.remove(userName);
......@@ -84,11 +84,12 @@ bool IsdsSession::removeIsdsCtx(const QString &userName)
bool IsdsSession::setCertDataToCtx(IsdsContext &ctx, const QString &certPath)
{
qDebug("%s()", __func__);
debugFuncCall();
QFile certFile(certPath);
if (!certFile.open(QIODevice::ReadOnly)) {
qCritical()<< "Error: cannot open certificate from" << certPath;
logErrorNL("Cannot open certificate from '%s'.",
certPath.toUtf8().constData());
ctx.last_isds_msg = tr("Cannot open certificate");
return false;
}
......@@ -115,13 +116,14 @@ bool IsdsSession::setCertDataToCtx(IsdsContext &ctx, const QString &certPath)
ctx.certificate = cert;
ctx.key = key;
} else {
qCritical()<< "Error: cannot parse certificate from"
<< certPath;
logErrorNL("Cannot parse certificate from '%s'.",
certPath.toUtf8().constData());
ctx.last_isds_msg = tr("Cannot parse certificate");
return false;
}
} else {
qCritical()<< "Error: unknown certificate format" << certPath;
logErrorNL("Unknown format of certificate '%s'.",
certPath.toUtf8().constData());
ctx.last_isds_msg = tr("Unknown certificate format");
return false;
}
......
......@@ -21,8 +21,7 @@
* the two.
*/
#ifndef _ISDS_SESSION_H_
#define _ISDS_SESSION_H_
#pragma once
#include <QCoreApplication> /* Q_DECLARE_TR_FUNCTIONS */
#include <QNetworkCookie>
......@@ -113,5 +112,3 @@ private:
static
QUrl getUrlFromLoginMethod(const QString &loginMethod, bool isTestAcnt);
};
#endif // _ISDS_SESSION_H_
......@@ -21,7 +21,6 @@
* the two.
*/
#include <QDebug>
#include <QFileInfo>
#include "src/auxiliaries/attachment_helper.h"
......@@ -104,7 +103,7 @@ IsdsWrapper::IsdsWrapper(QObject *parent)
QString IsdsWrapper::importZfoMessages(const QString &userName,
const QStringList &fileList, bool authenticate)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
......@@ -173,7 +172,7 @@ QString IsdsWrapper::importZfoMessages(const QString &userName,
bool IsdsWrapper::changePassword(const QString &userName, const QString &oldPwd,
const QString &newPwd, const QString &otpCode)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR) ||
(GlobInstcs::acntMapPtr == Q_NULLPTR))) {
......@@ -248,7 +247,7 @@ bool IsdsWrapper::changePassword(const QString &userName, const QString &oldPwd,
void IsdsWrapper::doIsdsAction(const QString &isdsAction,
const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
/* Do sync via all accounts separately */
if (isdsAction == "syncAllAccounts") {
......@@ -297,7 +296,7 @@ void IsdsWrapper::downloadMessage(const QVariant &msgModelVariant,
void IsdsWrapper::getAccountInfo(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::workPoolPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -330,7 +329,7 @@ int IsdsWrapper::findDataboxFulltext(const QString &userName,
const QVariant &dbModelVariant, const QString &phrase,
const QString &searchType, const QString &searchScope, int page)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::workPoolPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -406,7 +405,7 @@ int IsdsWrapper::findDataboxFulltext(const QString &userName,
QString IsdsWrapper::findDatabox(const QString &userName, const QString &dbID,
const QString &dbType)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::workPoolPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -438,7 +437,7 @@ QString IsdsWrapper::findDatabox(const QString &userName, const QString &dbID,
void IsdsWrapper::getDeliveryInfo(const QString &userName, qint64 msgId)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::workPoolPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -555,7 +554,7 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID,
bool dmOVM, bool dmPublishOwnID, bool dmAllowSubstDelivery,
bool dmPersonalDelivery, const QString &dmType)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR) ||
(GlobInstcs::setPtr == Q_NULLPTR) ||
......@@ -763,7 +762,7 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID,
bool IsdsWrapper::sendSMS(const QString &userName, const QString &oldPwd)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::workPoolPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -808,7 +807,7 @@ bool IsdsWrapper::sendSMS(const QString &userName, const QString &oldPwd)
void IsdsWrapper::syncOneAccount(const QVariant &acntModelVariant,
const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
syncSingleAccountSent(acntModelVariant, QVariant(), userName);
syncSingleAccountReceived(acntModelVariant, QVariant(), userName);
......@@ -830,7 +829,7 @@ void IsdsWrapper::syncSingleAccountSent(const QVariant &acntModelVariant,
void IsdsWrapper::closeAllOtpConnections(void)
{
qDebug("%s()", __func__);
debugFuncCall();
QList<QString> usernames = m_isdsSession.isdsCtxMap.keys();
for (int i = 0; i < usernames.count(); ++i) {
......@@ -845,7 +844,7 @@ void IsdsWrapper::closeAllOtpConnections(void)
bool IsdsWrapper::isLoggedToIsdsOtp(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
bool ret = false;
......@@ -858,7 +857,7 @@ bool IsdsWrapper::isLoggedToIsdsOtp(const QString &userName)
bool IsdsWrapper::isdsLogoutOTP(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (!isLoggedToIsds(userName)) {
return false;
......@@ -1026,7 +1025,7 @@ void IsdsWrapper::removeIsdsCtx(const QString &userName)
void IsdsWrapper::doLoginAction(const QString &isdsAction,
const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
/*
* Has account all required login data?
......@@ -1090,7 +1089,7 @@ void IsdsWrapper::downloadMessage(MessageListModel *messageModel,
const QString &userName, enum Messages::MessageType messageType,
qint64 msgId)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR) ||
(GlobInstcs::setPtr == Q_NULLPTR) ||
......@@ -1126,7 +1125,7 @@ void IsdsWrapper::downloadMessage(MessageListModel *messageModel,
bool IsdsWrapper::hasCtxAllLoginData(const QString &isdsAction,
const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY(GlobInstcs::acntMapPtr == Q_NULLPTR)) {
Q_ASSERT(0);
......@@ -1189,7 +1188,7 @@ bool IsdsWrapper::hasCtxAllLoginData(const QString &isdsAction,
bool IsdsWrapper::isLoggedToIsds(const QString &userName)
{
qDebug("%s()", __func__);
debugFuncCall();
/* if exists isds context, check if logged. */
if (m_isdsSession.isdsCtxMap.contains(userName)) {
......@@ -1203,7 +1202,7 @@ bool IsdsWrapper::isLoggedToIsds(const QString &userName)
bool IsdsWrapper::loginToIsds(IsdsSession::IsdsContext &ctx)
{
qDebug("%s()", __func__);
debugFuncCall();
bool success = false;
......@@ -1235,7 +1234,7 @@ bool IsdsWrapper::loginToIsds(IsdsSession::IsdsContext &ctx)
void IsdsWrapper::runSmsLoginPhase(IsdsSession::IsdsContext &ctx,
const QString &isdsAction)
{
qDebug("%s()", __func__);
debugFuncCall();
bool success = false;
......@@ -1307,7 +1306,7 @@ void IsdsWrapper::syncSingleAccount(const QVariant &acntModelVariant,
const QVariant &msgModelVariant, const QString &userName,
enum Messages::MessageType msgDirect)
{
qDebug("%s()", __func__);
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR) ||
(GlobInstcs::setPtr == Q_NULLPTR) ||
......
......@@ -21,8 +21,7 @@
* the two.
*/
#ifndef _ISDS_WRAPPER_H_
#define _ISDS_WRAPPER_H_
#pragma once
#include <QObject>
......@@ -617,5 +616,3 @@ private:
QSet<QString> m_transactIds; /*!< Temporary transaction identifiers. */
QList<TaskSendMessage::ResultData> m_sentMsgResultList; /*!< Send status list. */
};
#endif // _ISDS_WRAPPER_H_
......@@ -21,14 +21,15 @@
* the two.
*/
#include <QDebug>
#include <QEventLoop>
#include <QNetworkAccessManager>
#include <QNetworkCookie>
#include <QNetworkReply>
#include <QObject>
#include <QSslConfiguration>
#include <QTimer>
#include "src/datovka_shared/log/log.h"
#include "src/net/isds_const.h"
#include "src/net/net_layer.h"
......@@ -194,6 +195,58 @@ QNetworkRequest NetLayer::createRequest(const QUrl &url,
return request;
}
/*!
* @brief Constructs a header listing.
*
* @param[in] reply Network reply.
* @return Raw header listing.
*/
static
QByteArray replyHeaderListing(const QNetworkReply *reply)
{
if (Q_UNLIKELY(reply == Q_NULLPTR)) {
Q_ASSERT(0);
return "\n";
}
QByteArray listing;
foreach (const QNetworkReply::RawHeaderPair &pair, reply->rawHeaderPairs()) {
listing += pair.first + ": " + pair.second + "\n";
}
return listing;
}
/*!
* @brief Print reply header and its data to stdout.
*
* @param[in] request Reply object.
* @param[in] data Reply data.
*/
static
void printReply(const QNetworkReply *reply, const QByteArray &data)
{
logDebugMlLv0("\n"
"====================REPLY===========================\n"
"URL: %s\n"
"CODE: %d\n"
"ERROR: %s\n"
"REASON: %s\n"