Commit 4a705e64 authored by Karel Slaný's avatar Karel Slaný
Browse files

Removed unused code.

parent d032b52f
......@@ -230,7 +230,6 @@ SOURCES += \
src/worker/task_import_zfo.cpp \
src/worker/task_keep_alive.cpp \
src/worker/task_pdz_info.cpp \
src/worker/task_pdz_send_info.cpp \
src/worker/task_records_management_stored_messages.cpp \
src/worker/task_send_message.cpp \
src/worker/task_send_sms.cpp \
......@@ -400,7 +399,6 @@ HEADERS += \
src/worker/task_import_zfo.h \
src/worker/task_keep_alive.h \
src/worker/task_pdz_info.h \
src/worker/task_pdz_send_info.h \
src/worker/task_records_management_stored_messages.h \
src/worker/task_send_message.h \
src/worker/task_send_sms.h \
......
......@@ -52,7 +52,6 @@
#include "src/worker/task_find_databox_fulltext.h"
#include "src/worker/task_import_zfo.h"
#include "src/worker/task_pdz_info.h"
#include "src/worker/task_pdz_send_info.h"
#include "src/worker/task_send_message.h"
#include "src/worker/task_send_sms.h"
......@@ -628,30 +627,6 @@ void Isds::Tasks::downloadPdzInfo(const AcntId &acntId,
GlobInstcs::workPoolPtr->assignHi(task);
}
void Isds::Tasks::downloadPdzSendInfo(const AcntId &acntId, const QString &dbID,
bool &canSendNormal, bool &canSendInitiatory)
{
debugFuncCall();
if (Q_UNLIKELY((GlobInstcs::workPoolPtr == Q_NULLPTR) ||
dbID.isEmpty())) {
Q_ASSERT(0);
return;
}
TaskPDZSendInfo *task =
new (::std::nothrow) TaskPDZSendInfo(acntId, dbID);
if (Q_UNLIKELY(task == Q_NULLPTR)) {
Q_ASSERT(0);
return;
}
task->setAutoDelete(false);
GlobInstcs::workPoolPtr->runSingle(task);
canSendNormal = task->m_canSendNormal;
canSendInitiatory = task->m_canSendInitiatory;
delete task; task = Q_NULLPTR;
}
QList<Isds::CreditEvent> Isds::Tasks::downloadCreditInfo(const AcntId &acntId,
const QString &dbID, const QDate &fromDate, const QDate &toDate,
qint64 &currentCredit, QString &notifEmail)
......
......@@ -243,21 +243,6 @@ namespace Isds {
static
void downloadPdzInfo(const AcntId &acntId, const QString &dbID);
/*!
* @brief Download pdz send info.
*
* @param[in] acntId Account identifier.
* @param[in] dbID Data box id.
* @param[out] canSendNormal True of such commercial message
* can be sent.
* @param[out] canSendInitiatory True of such initiatory
* commercial message can be sent.
*/
static
void downloadPdzSendInfo(const AcntId &acntId,
const QString &dbID, bool &canSendNormal,
bool &canSendInitiatory);
/*!
* @brief Download credit event information.
*
......
/*
* Copyright (C) 2014-2021 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#include <QThread>
#include "src/datovka_shared/isds/error.h"
#include "src/datovka_shared/log/log.h"
#include "src/global.h"
#include "src/isds/services/box_interface.h"
#include "src/isds/session/isds_session.h"
#include "src/isds/session/isds_sessions.h"
#include "src/worker/task_pdz_send_info.h"
TaskPDZSendInfo::TaskPDZSendInfo(const AcntId &acntId, const QString &dbId)
: m_result(DL_ERR),
m_lastError(),
m_canSendNormal(false),
m_canSendInitiatory(false),
m_acntId(acntId),
m_dbId(dbId)
{
Q_ASSERT(m_acntId.isValid());
Q_ASSERT(!m_dbId.isEmpty());
}
void TaskPDZSendInfo::run(void)
{
logDebugLv0NL("%s", "----------DOWNLOAD PDZ-SEND-INFO TASK----------");
logDebugLv0NL("Starting in thread '%p'", QThread::currentThreadId());
/* ### Worker task begin. ### */
m_result = pdzSendInfo(m_acntId, m_dbId, Isds::Type::PMT_NORMAL,
m_canSendNormal, m_lastError);
/* Don't ask for initiatory if cannot send normal. */
if (m_result == TaskPDZSendInfo::DL_SUCCESS) {
pdzSendInfo(m_acntId, m_dbId, Isds::Type::PMT_INIT,
m_canSendInitiatory, m_lastError);
}
logDebugLv0NL("Finished in thread '%p'", QThread::currentThreadId());
logDebugLv0NL("%s", "-----------------------------------------------");
/* ### Worker task end. ### */
}
/*!
* @brief Translate communication error onto task error.
*/
static
enum TaskPDZSendInfo::Result error2result(enum Isds::Type::Error error)
{
switch (error) {
case Isds::Type::ERR_SUCCESS:
return TaskPDZSendInfo::DL_SUCCESS;
break;
case Isds::Type::ERR_ISDS:
return TaskPDZSendInfo::DL_ISDS_ERROR;
break;
case Isds::Type::ERR_SOAP:
case Isds::Type::ERR_XML:
return TaskPDZSendInfo::DL_XML_ERROR;
break;
default:
return TaskPDZSendInfo::DL_ERR;
break;
}
}
enum TaskPDZSendInfo::Result TaskPDZSendInfo::pdzSendInfo(const AcntId &acntId,
const QString &dbId, enum Isds::Type::PdzMessageType type, bool &canSend,
QString &lastError)
{
if (Q_UNLIKELY((!acntId.isValid()) ||
(GlobInstcs::isdsSessionsPtr == Q_NULLPTR) ||
(!GlobInstcs::isdsSessionsPtr->holdsSession(acntId)))) {
Q_ASSERT(0);
return DL_ERR;
}
Isds::Session *session = GlobInstcs::isdsSessionsPtr->session(acntId);
if (Q_UNLIKELY(session == Q_NULLPTR)) {
Q_ASSERT(0);
return DL_ERR;
}
logDebugLv1NL("Sending from account '%s'",
acntId.username().toUtf8().constData());
enum Isds::Type::Error error = Isds::pdzSendInfo(*session, dbId, type,
canSend, Q_NULLPTR, &lastError);
if (Q_UNLIKELY(error != Isds::Type::ERR_SUCCESS)) {
return error2result(error);
}
return DL_SUCCESS;
}
/*
* Copyright (C) 2014-2021 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* In addition, as a special exception, the copyright holders give
* permission to link the code of portions of this program with the
* OpenSSL library under certain conditions as described in each
* individual source file, and distribute linked combinations including
* the two.
*/
#pragma once
#include <QString>
#include "src/datovka_shared/identifiers/account_id.h"
#include "src/datovka_shared/isds/types.h"
#include "src/worker/task.h"
/*!
* @brief Task describing download PDZ send information.
*/
class TaskPDZSendInfo : public Task {
public:
/*!
* @brief Return state describing what happened.
*/
enum Result {
DL_SUCCESS, /*!< Operation was successful. */
DL_ISDS_ERROR, /*!< Error communicating with ISDS. */
DL_XML_ERROR, /*!< Error parsing XML. */
DL_DB_INS_ERR, /*!< Error inserting into database. */
DL_ERR /*!< Other error. */
};
/*!
* @brief Constructor.
*
* @param[in] acntId Sender account identifier.
* @param[in] dbId Recipient data box identifier.
*/
explicit TaskPDZSendInfo(const AcntId &acntId, const QString &dbId);
/*!
* @brief Performs action.
*/
virtual
void run(void) Q_DECL_OVERRIDE;
enum Result m_result; /*!< Return state. */
QString m_lastError; /*!< Last ISDS error message. */
bool m_canSendNormal; /*!< True if a normal commercial messages can be sent. */
bool m_canSendInitiatory; /*!< True if an initiatory commercial messages can be sent. */
private:
/*!
* Disable copy and assignment.
*/
TaskPDZSendInfo(const TaskPDZSendInfo &);
TaskPDZSendInfo &operator=(const TaskPDZSendInfo &);
/*!
* @brief Download PDZ information from ISDS.
*
* @param[in] acntId Account identifier.
* @param[in] dbId Data box identifier.
* @param[in] type Whether to send normal or initiatory
* commercial messages.
* @param[out] canSend True of such commercial message can be sent.
* @param[out] lastError Last ISDS error message.
* @return Error state.
*/
static
enum Result pdzSendInfo(const AcntId &acntId, const QString &dbId,
enum Isds::Type::PdzMessageType type, bool &canSend,
QString &lastError);
const AcntId m_acntId; /*!< Sender account identifier. */
const QString m_dbId; /*!< Recipient data box identifier. */
};
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