Commit 5c08cab6 authored by Martin Straka's avatar Martin Straka

Updated code for using of new message envelope class

parent 5f1cff0a
......@@ -37,6 +37,7 @@
#include "src/io/filesystem.h"
#include "ios/src/url_opener.h"
#include "src/models/accountmodel.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/sqlite/file_db_container.h"
#include "src/sqlite/message_db_container.h"
#include "src/net/xml_layer.h"
......@@ -873,7 +874,7 @@ bool Files::parseAndShowXmlData(enum MsgInfo::ZfoType type, QString *idStr,
QXmlStreamReader xml;
XmlLayer xmlLayer;
Messages::Message msg;
MsgEnvelope msg;
QList<Files::File> fileList;
QList<Messages::Event> eventList;
......@@ -919,65 +920,65 @@ bool Files::parseAndShowXmlData(enum MsgInfo::ZfoType type, QString *idStr,
QString html = divStart;
html += "<h3>" + QObject::tr("General") + "</h3>";
html += strongInfoLine(QObject::tr("Subject"), msg.dmAnnotation);
QString size = QString::number(msg.dmAttachmentSize);
html += strongInfoLine(QObject::tr("Subject"), msg.dmAnnotation());
QString size = QString::number(msg.dmAttachmentSize());
html += strongInfoLine(QObject::tr("Attachment size"),
(size == "0") ? "&lt;1 KB" : "~" + size + " KB");
html += strongInfoLine(QObject::tr("Personal delivery"),
(msg.dmPersonalDelivery) ? QObject::tr("Yes") : QObject::tr("No"));
(msg.dmPersonalDelivery()) ? QObject::tr("Yes") : QObject::tr("No"));
html += strongInfoLine(QObject::tr("Delivery by fiction"),
(msg.dmAllowSubstDelivery) ? QObject::tr("Yes") : QObject::tr("No"));
(msg.dmAllowSubstDelivery()) ? QObject::tr("Yes") : QObject::tr("No"));
html += "<h3>" + QObject::tr("Sender") + "</h3>";
html += strongInfoLine(QObject::tr("Databox ID"), msg.dbIDSender);
html += strongInfoLine(QObject::tr("Name"), msg.dmSender);
html += strongInfoLine(QObject::tr("Address"),msg.dmSenderAddress);
html += strongInfoLine(QObject::tr("Databox ID"), msg.dbIDSender());
html += strongInfoLine(QObject::tr("Name"), msg.dmSender());
html += strongInfoLine(QObject::tr("Address"),msg.dmSenderAddress());
html += "<h3>" + QObject::tr("Recipient") + "</h3>";
html += strongInfoLine(QObject::tr("Databox ID"), msg.dbIDRecipient);
html += strongInfoLine(QObject::tr("Name"), msg.dmRecipient);
html += strongInfoLine(QObject::tr("Address"),msg.dmRecipientAddress);
if (!msg.dmToHands.isEmpty()) {
html += strongInfoLine(QObject::tr("Databox ID"), msg.dbIDRecipient());
html += strongInfoLine(QObject::tr("Name"), msg.dmRecipient());
html += strongInfoLine(QObject::tr("Address"),msg.dmRecipientAddress());
if (!msg.dmToHands().isEmpty()) {
html += strongInfoLine(QObject::tr("To hands"),
msg.dmToHands);
msg.dmToHands());
}
QString tmpHtml;
if (!msg.dmSenderIdent.isEmpty()) {
if (!msg.dmSenderIdent().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Our file mark"),
msg.dmSenderIdent);
msg.dmSenderIdent());
}
if (!msg.dmSenderRefNumber.isEmpty()) {
if (!msg.dmSenderRefNumber().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Our reference number"),
msg.dmSenderRefNumber);
msg.dmSenderRefNumber());
}
if (!msg.dmRecipientIdent.isEmpty()) {
if (!msg.dmRecipientIdent().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Your file mark"),
msg.dmRecipientIdent);
msg.dmRecipientIdent());
}
if (!msg.dmRecipientRefNumber.isEmpty()) {
if (!msg.dmRecipientRefNumber().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Your reference number"),
msg.dmRecipientRefNumber);
msg.dmRecipientRefNumber());
}
if (!msg.dmLegalTitleLaw.isEmpty()) {
if (!msg.dmLegalTitleLaw().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Law"),
msg.dmLegalTitleLaw);
msg.dmLegalTitleLaw());
}
if (!msg.dmLegalTitleYear.isEmpty()) {
if (!msg.dmLegalTitleYear().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Year"),
msg.dmLegalTitleYear);
msg.dmLegalTitleYear());
}
if (!msg.dmLegalTitleSect.isEmpty()) {
if (!msg.dmLegalTitleSect().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Section"),
msg.dmLegalTitleSect);
msg.dmLegalTitleSect());
}
if (!msg.dmLegalTitlePar.isEmpty()) {
if (!msg.dmLegalTitlePar().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Paragraph"),
msg.dmLegalTitlePar);
msg.dmLegalTitlePar());
}
if (!msg.dmLegalTitlePoint.isEmpty()) {
if (!msg.dmLegalTitlePoint().isEmpty()) {
tmpHtml += strongInfoLine(QObject::tr("Letter"),
msg.dmLegalTitlePoint);
msg.dmLegalTitlePoint());
}
if (!tmpHtml.isEmpty()) {
html += "<h3>" + QObject::tr("Additional info") + "</h3>";
......@@ -987,14 +988,14 @@ bool Files::parseAndShowXmlData(enum MsgInfo::ZfoType type, QString *idStr,
html += "<h3>" + QObject::tr("Message state") + "</h3>";
html += strongInfoLine(QObject::tr("Delivery time"),
dateTimeStrFromDbFormat(
dateTimeStrToUTCDbFormat(msg.dmDeliveryTime),
dateTimeStrToUTCDbFormat(msg.dmDeliveryTime()),
DATETIME_QML_FORMAT));
html += strongInfoLine(QObject::tr("Accetance time"),
dateTimeStrFromDbFormat(
dateTimeStrToUTCDbFormat(msg.dmAcceptanceTime),
dateTimeStrToUTCDbFormat(msg.dmAcceptanceTime()),
DATETIME_QML_FORMAT));
html += strongInfoLine(QObject::tr("Status"),
QString::number(msg.dmMessageStatus));
QString::number(msg.dmMessageStatus()));
if (type == MsgInfo::TYPE_DELIVERY_INFO) {
html += "<h3>" + QObject::tr("Events") + "</h3>";
......@@ -1011,26 +1012,26 @@ bool Files::parseAndShowXmlData(enum MsgInfo::ZfoType type, QString *idStr,
// Create body for email
QString body = QObject::tr("ID") + ": ";
body += QString::number(msg.dmID) + "\n";
body += QString::number(msg.dmID()) + "\n";
body += QObject::tr("FROM") + ": ";
body += msg.dmSender + "\n";
body += msg.dmSender() + "\n";
body += QObject::tr("TO") + ": ";
body += msg.dmRecipient + "\n";
body += msg.dmRecipient() + "\n";
body += QObject::tr("DELIVERED") + ": ";
body += dateTimeStrFromDbFormat(
dateTimeStrToUTCDbFormat(msg.dmAcceptanceTime),
dateTimeStrToUTCDbFormat(msg.dmAcceptanceTime()),
DATETIME_QML_FORMAT)
+ "\n\n---\n";
body += QObject::tr("This email has been generated with Datovka "
"application based on a data message (%1) delivered "
"to databox.").arg(msg.dmID);
"to databox.").arg(msg.dmID());
body += "\n";
if (idStr != Q_NULLPTR) {
*idStr = QString::number(msg.dmID);
*idStr = QString::number(msg.dmID());
}
if (annotation != Q_NULLPTR) {
*annotation = msg.dmAnnotation;
*annotation = msg.dmAnnotation();
}
if (msgDescrHtml != Q_NULLPTR) {
*msgDescrHtml = html;
......
......@@ -132,64 +132,6 @@ public:
*/
void deleteExpiredMessagesFromDbs(int days);
class Message {
public:
Message(void)
: dmID(-1), dmSender(), dmSenderAddress(), dmSenderType(),
dmRecipient(), dmRecipientAddress(), dmAmbiguousRecipient(),
dmSenderOrgUnit(), dmSenderOrgUnitNum(), dbIDRecipient(),
dmRecipientOrgUnit(), dmRecipientOrgUnitNum(), dmToHands(),
dmAnnotation(), dmRecipientRefNumber(), dmSenderRefNumber(),
dmRecipientIdent(), dmSenderIdent(), dmLegalTitleLaw(),
dmLegalTitleYear(), dmLegalTitleSect(), dmLegalTitlePar(),
dmLegalTitlePoint(), dmPersonalDelivery(false),
dmAllowSubstDelivery(false), dmQTimestamp(),
dmDeliveryTime(), dmAcceptanceTime(), dmMessageStatus(-1),
dmAttachmentSize(-1), dmType(), _dmMessageType(-1),
_dmDownloadDate(), _dmCustomData(),
_dmAttachDownloaded(false), _dmReadLocally(false)
{
}
qint64 dmID;
QString dbIDSender;
QString dmSender;
QString dmSenderAddress;
QString dmSenderType;
QString dmRecipient;
QString dmRecipientAddress;
QString dmAmbiguousRecipient;
QString dmSenderOrgUnit;
QString dmSenderOrgUnitNum;
QString dbIDRecipient;
QString dmRecipientOrgUnit;
QString dmRecipientOrgUnitNum;
QString dmToHands;
QString dmAnnotation;
QString dmRecipientRefNumber;
QString dmSenderRefNumber;
QString dmRecipientIdent;
QString dmSenderIdent;
QString dmLegalTitleLaw;
QString dmLegalTitleYear;
QString dmLegalTitleSect;
QString dmLegalTitlePar;
QString dmLegalTitlePoint;
bool dmPersonalDelivery;
bool dmAllowSubstDelivery;
QString dmQTimestamp;
QString dmDeliveryTime;
QString dmAcceptanceTime;
int dmMessageStatus;
int dmAttachmentSize;
QString dmType;
int _dmMessageType;
QString _dmDownloadDate;
QString _dmCustomData;
bool _dmAttachDownloaded;
bool _dmReadLocally;
};
class Event {
public:
QString dmEventTime;
......
......@@ -119,7 +119,7 @@ QString DbWrapper::createAccountInfoStringForQml(
*/
bool DbWrapper::insertMessageListToDb(const QString &userName,
enum MessageDb::MessageType messageType,
const QList<Messages::Message> &messages,
const QList<MsgEnvelope> &messages,
QList<qint64> &messageChangedStatusList, QString &txt,
QList<qint64> &listOfNewMsgIds)
/* ========================================================================= */
......@@ -138,34 +138,37 @@ bool DbWrapper::insertMessageListToDb(const QString &userName,
int msgs = messages.count();
msgDb->beginTransaction();
for (int i = 0; i < msgs; ++i) {
bool hasFiles;
int msgStatus =
msgDb->getMessageStatusFromDb(messages.at(i).dmID, hasFiles);
msgDb->getMessageStatusFromDb(messages.at(i).dmID(), hasFiles);
// -1 = message is not in the database, mesasge is new
if (-1 == msgStatus) {
newMsgs++;
if (!msgDb->insertOrUpdateMessageEnvelopeInDb(messages.at(i))) {
txt = tr("Message %1 envelope insertion failed!").
arg(messages.at(i).dmID);
arg(messages.at(i).dmID());
} else {
// New message envelope has been saved into
// database. Append message id to list
// of complete messages to be downloaded.
listOfNewMsgIds.append(messages.at(i).dmID);
listOfNewMsgIds.append(messages.at(i).dmID());
}
} else {
if (!msgDb->updateMessageEnvelopeInDb(messages.at(i))) {
txt = tr("Message %1 envelope update failed!").
arg(messages.at(i).dmID);
arg(messages.at(i).dmID());
}
if (isSentMessage) {
if (msgStatus != messages.at(i).dmMessageStatus && hasFiles) {
messageChangedStatusList.append(messages.at(i).dmID);
if (msgStatus != messages.at(i).dmMessageStatus() && hasFiles) {
messageChangedStatusList.append(messages.at(i).dmID());
}
}
}
}
msgDb->commitTransaction();
if (!isSentMessage) {
......@@ -181,7 +184,7 @@ bool DbWrapper::insertMessageListToDb(const QString &userName,
}
bool DbWrapper::insertCompleteMessageToDb(const QString &userName,
Messages::Message &msg, QList<Files::File> &fileList, QString &txt)
MsgEnvelope &msg, QList<Files::File> &fileList, QString &txt)
{
bool ret = true;
......@@ -215,17 +218,17 @@ bool DbWrapper::insertCompleteMessageToDb(const QString &userName,
/* Update message envelope data in messages database */
if (ret) {
msg._dmReadLocally = true;
msg._dmAttachDownloaded = true;
msg._setDmReadLocally(true);
msg._setDmAttachDownloaded(true);
if (!msgDb->insertOrUpdateMessageEnvelopeInDb(msg)) {
txt = tr("Message %1 envelope update failed!").
arg(msg.dmID);
arg(msg.dmID());
ret = ret * false;
}
}
if (ret) {
msgDb->setAttachmentDownloaded(msg.dmID, true);
msgDb->setAttachmentDownloaded(msg.dmID(), true);
}
txt = tr("Message has been downloaded");
......
......@@ -26,6 +26,7 @@
#include <QObject>
#include "src/qml_interaction/message_envelope.h"
#include "src/sqlite/message_db_container.h"
#include "src/sqlite/file_db_container.h"
......@@ -125,7 +126,7 @@ public:
*/
bool insertMessageListToDb(const QString &userName,
enum MessageDb::MessageType messageType,
const QList<Messages::Message> &messages,
const QList<MsgEnvelope> &messages,
QList<qint64> &messageChangedStatusList, QString &txt,
QList<qint64> &listOfNewMsgIds);
......@@ -139,7 +140,7 @@ public:
* @return true if success.
*/
bool insertCompleteMessageToDb(const QString &userName,
Messages::Message &msg, QList<Files::File> &fileList,
MsgEnvelope &msg, QList<Files::File> &fileList,
QString &txt);
/*!
......
......@@ -31,6 +31,7 @@
#include "src/models/messagemodel.h"
#include "src/net/isds_wrapper.h"
#include "src/net/xml_layer.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/settings.h"
#include "src/worker/emitter.h"
#include "src/worker/task_change_password.h"
......@@ -465,21 +466,21 @@ void IsdsWrapper::sendMessage(const QString &userName,
return;
}
Messages::Message msg;
MsgEnvelope msg;
/* Fill message envelope */
msg.dmAnnotation = dmAnnotation;
msg.dmLegalTitleLaw = dmLegalTitleLaw;
msg.dmLegalTitleYear = dmLegalTitleYear;
msg.dmLegalTitleSect = dmLegalTitleSect;
msg.dmLegalTitlePar = dmLegalTitlePar;
msg.dmLegalTitlePoint = dmLegalTitlePoint;
msg.dmToHands = dmToHands;
msg.dmRecipientRefNumber = dmRecipientRefNumber;
msg.dmRecipientIdent = dmRecipientIdent;
msg.dmSenderRefNumber = dmSenderRefNumber;
msg.dmSenderIdent = dmSenderIdent;
msg.dmAllowSubstDelivery = dmAllowSubstDelivery;
msg.dmPersonalDelivery =dmPersonalDelivery;
msg.setDmAnnotation(dmAnnotation);
msg.setDmLegalTitleLaw(dmLegalTitleLaw);
msg.setDmLegalTitleYear(dmLegalTitleYear);
msg.setDmLegalTitleSect(dmLegalTitleSect);
msg.setDmLegalTitlePar(dmLegalTitlePar);
msg.setDmLegalTitlePoint(dmLegalTitlePoint);
msg.setDmToHands(dmToHands);
msg.setDmRecipientRefNumber(dmRecipientRefNumber);
msg.setDmRecipientIdent(dmRecipientIdent);
msg.setDmSenderRefNumber(dmSenderRefNumber);
msg.setDmSenderIdent(dmSenderIdent);
msg.setDmAllowSubstDelivery(dmAllowSubstDelivery);
msg.setDmPersonalDelivery(dmPersonalDelivery);
int totalAttachmentSizeKBs = 0;
QList<Files::File> attachList;
......@@ -502,16 +503,16 @@ void IsdsWrapper::sendMessage(const QString &userName,
attachList.append(attach);
}
msg.dmAttachmentSize = totalAttachmentSizeKBs;
msg.setDmAttachmentSize(totalAttachmentSizeKBs);
emit statusBarTextChanged(tr("%1: sending message").arg(userName),
true, true);
/* Send message to all recipients */
foreach (const DataboxModelEntry &db, databoxModel->allEntries()) {
msg.dbIDRecipient = db.dbID();
msg.dmRecipient = db.dbName();
msg.dmRecipientAddress = db.dbAddress();
msg.setDbIDRecipient(db.dbID());
msg.setDmRecipient(db.dbName());
msg.setDmRecipientAddress(db.dbAddress());
TaskSendMessage *task;
task = new (std::nothrow) TaskSendMessage(
m_isdsSession.isdsCtxMap[userName], &m_netLayer,
......
This diff is collapsed.
......@@ -30,6 +30,7 @@
#include "src/models/databoxmodel.h"
#include "src/net/db_wrapper.h"
#include "src/qml_interaction/message_envelope.h"
/*
* Class XmlLayer realizes XML layer of SOAP.
......@@ -180,7 +181,7 @@ public:
* @return Soap request string as byte array.
*/
static
QByteArray xmlCreateSendMessageSoapRequest(const Messages::Message &msg,
QByteArray xmlCreateSendMessageSoapRequest(const MsgEnvelope &msg,
const QList<Files::File> &fileList, bool dmOVM, bool dmPublishOwnID);
/*!
......@@ -218,7 +219,7 @@ public:
* @return true if success.
*/
static
bool completeMessageParse(QXmlStreamReader &xml, Messages::Message &msg,
bool completeMessageParse(QXmlStreamReader &xml, MsgEnvelope &msg,
QList<Files::File> &fileList);
/*!
......@@ -282,7 +283,7 @@ public:
*/
static
bool parseGetListOfMessagesResponse(enum MessageDb::MessageType messageType,
const QByteArray &xmlData, QList<Messages::Message> &messages,
const QByteArray &xmlData, QList<MsgEnvelope> &messages,
QString &txt);
/*!
......@@ -297,7 +298,7 @@ public:
*/
static
bool parseSignedMessageDownloadResponse(const QByteArray &xmlData,
Messages::Message &msg, QList<Files::File> &fileList, QString &txt,
MsgEnvelope &msg, QList<Files::File> &fileList, QString &txt,
QByteArray &zfoData);
/*!
......@@ -408,7 +409,7 @@ public:
* @return Message envelope structure.
*/
static
Messages::Message msgEnvelopeParse(QXmlStreamReader &xml,
MsgEnvelope msgEnvelopeParse(QXmlStreamReader &xml,
enum MessageDb::MessageType messageType);
/*!
......
......@@ -174,7 +174,7 @@ MsgEnvelope::MsgEnvelope(qint64 dmID, const QString &dmAnnotation,
{
}
qint64 MsgEnvelope::dmID(void)
qint64 MsgEnvelope::dmID(void) const
{
return m_dmID;
}
......@@ -224,7 +224,7 @@ void MsgEnvelope::setDmSenderAddress(const QString &dmSenderAddress)
m_dmSenderAddress = dmSenderAddress;
}
int MsgEnvelope::dmSenderType(void)
int MsgEnvelope::dmSenderType(void) const
{
return m_dmSenderType;
}
......@@ -464,7 +464,7 @@ void MsgEnvelope::setDmAcceptanceTime(const QString &dmAcceptanceTime)
m_dmAcceptanceTime = dmAcceptanceTime;
}
int MsgEnvelope::dmMessageStatus(void)
int MsgEnvelope::dmMessageStatus(void) const
{
return m_dmMessageStatus;
}
......@@ -474,7 +474,7 @@ void MsgEnvelope::setDmMessageStatus(int dmMessageStatus)
m_dmMessageStatus = dmMessageStatus;
}
int MsgEnvelope::dmAttachmentSize(void)
int MsgEnvelope::dmAttachmentSize(void) const
{
return m_dmAttachmentSize;
}
......@@ -493,7 +493,7 @@ void MsgEnvelope::setDmType(const QString &dmType)
m_dmType = dmType;
}
int MsgEnvelope::_dmMessageType(void)
int MsgEnvelope::_dmMessageType(void) const
{
return m_dmMessageType;
}
......
......@@ -143,7 +143,7 @@ public:
bool _dmReadLocally,
QObject *parent = Q_NULLPTR);
qint64 dmID(void);
qint64 dmID(void) const;
void setDmID(qint64 dmID);
QString dmAnnotation(void) const;
void setDmAnnotation(const QString &dmAnnotation);
......@@ -154,7 +154,7 @@ public:
void setDmSender(const QString &dmSender);
QString dmSenderAddress(void) const;
void setDmSenderAddress(const QString &dmSenderAddress);
int dmSenderType(void);
int dmSenderType(void) const;
void setDmSenderType(int dmSenderType);
QString dmSenderOrgUnit(void) const;
void setDmSenderOrgUnit(const QString &dmSenderOrgUnit);
......@@ -205,14 +205,14 @@ public:
void setDmDeliveryTime(const QString &dmDeliveryTime);
QString dmAcceptanceTime(void) const;
void setDmAcceptanceTime(const QString &dmAcceptanceTime);
int dmMessageStatus(void);
int dmMessageStatus(void) const;
void setDmMessageStatus(int dmMessageStatus);
int dmAttachmentSize(void);
int dmAttachmentSize(void) const;
void setDmAttachmentSize(int dmAttachmentSize);
QString dmType(void) const;
void setDmType(const QString &dmType);
int _dmMessageType(void);
int _dmMessageType(void) const;
void _setDmMessageType(int _dmMessageType);
QString _dmDownloadDate(void) const;
void _setDmDownloadDate(const QString &_dmDownloadDate);
......
This diff is collapsed.
......@@ -31,6 +31,7 @@
#include "src/common.h"
#include "src/io/sqlite/db.h"
#include "src/messages.h"
#include "src/qml_interaction/message_envelope.h"
class MessageListModel; /* Forward declaration. */
......@@ -180,7 +181,7 @@ public:
* @return True on success.
*/
bool insertOrUpdateMessageEnvelopeInDb(
const Messages::Message &msgEnvelopeData);
const MsgEnvelope &msgEnvelopeData);
/*!
* @brief Set message in database as localy read.
......@@ -262,7 +263,7 @@ public:
* @param[in] msgEnvelopeData Contains message envelope data.
* @return True on success.
*/
bool updateMessageEnvelopeInDb(const Messages::Message &msgEnvelopeData);
bool updateMessageEnvelopeInDb(const MsgEnvelope &msgEnvelopeData);
private:
static
......
......@@ -25,6 +25,7 @@
#include "src/io/filesystem.h"
#include "src/net/isds_const.h"
#include "src/net/xml_layer.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/worker/emitter.h"
#include "src/worker/pool.h" /* List with whole messages. */
#include "src/worker/task_download_message.h"
......@@ -98,7 +99,7 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
return DL_ERR;
}
Messages::Message msg;
MsgEnvelope msg;
QByteArray xmlDataOut;
QList<Files::File> fileList;
QList<Messages::Event> eventList;
......
......@@ -24,6 +24,7 @@
#include "src/log/log.h"
#include "src/net/isds_const.h"
#include "src/net/xml_layer.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/worker/emitter.h"
#include "src/worker/pool.h" /* List with whole messages. */
#include "src/worker/task_download_message.h"
......@@ -113,7 +114,7 @@ enum TaskDownloadMessageList::Result TaskDownloadMessageList::downloadMessageLis
}
QByteArray xmlDataOut;
QList<Messages::Message> messages;
QList<MsgEnvelope> messages;
QList<qint64> listOfNewMsgIds;
/* Send SOAP request */
......
......@@ -30,7 +30,7 @@
#include "src/worker/task_send_message.h"
TaskSendMessage::TaskSendMessage(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, DbWrapper *dbWrapper, Messages::Message &msg,
NetLayer *netLayer, DbWrapper *dbWrapper, MsgEnvelope &msg,
QList<Files::File> &fileList, bool dmOVM, bool dmPublishOwnID)
: m_result(DL_ERR),
m_msgID(0),
......@@ -68,7 +68,7 @@ void TaskSendMessage::run(void)
/* ### Worker task end. ### */
emit globMsgProcEmitter.sendMessageFinishedSignal(m_ctx.username,
m_msg.dbIDRecipient, m_msg.dmRecipient, m_msgID,
m_msg.dbIDRecipient(), m_msg.dmRecipient(), m_msgID,
TaskSendMessage::DL_SUCCESS == m_result, m_lastError);
logDebugLv0NL("Send message task finished in thread '%p'",
......@@ -77,7 +77,7 @@ void TaskSendMessage::run(void)
enum TaskSendMessage::Result TaskSendMessage::sendMessage(
IsdsSession::IsdsContext &ctx, NetLayer *netLayer, DbWrapper *dbWrapper,
Messages::Message &msg, QList<Files::File> &fileList,
MsgEnvelope &msg, QList<Files::File> &fileList,
bool dmOVM, bool dmPublishOwnID, qint64 &msgID, QString &lastError)
{
if (ctx.username.isEmpty()) {
......@@ -106,13 +106,13 @@ enum TaskSendMessage::Result TaskSendMessage::sendMessage(
lastError = ctx.last_isds_msg;
/* Fill missing message envelope data */
msg.dmID = msgID;
msg.dmQTimestamp = "";
msg.dmMessageStatus = 1;
msg._dmCustomData = "";
msg._dmReadLocally = true;
msg._dmAttachDownloaded = true;
msg._dmMessageType = Messages::TYPE_SENT;
msg.setDmID(msgID);
msg.setDmQTimestamp("");
msg.setDmMessageStatus(1);
msg._setDmCustomData("");
msg._setDmReadLocally(true);
msg._setDmAttachDownloaded(true);
msg._setDmMessageType(Messages::TYPE_SENT);
/* Fill missing message id to file list */
QList<Files::File>::iterator it_file;
......
......@@ -27,6 +27,7 @@
#include "src/net/db_wrapper.h"
#include "src/net/isds_session.h"
#include "src/net/net_layer.h"
#include "src/qml_interaction/message_envelope.h"
#include "src/worker/task.h"
/*!
......@@ -58,7 +59,7 @@ public:
*/
explicit TaskSendMessage(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, DbWrapper *dbWrapper,
Messages::Message &msg, QList<Files::File> &fileList,
MsgEnvelope &msg, QList<Files::File> &fileList,
bool dmOVM, bool dmPublishOwnID);
/*!
......@@ -83,7 +84,7 @@ public:
*/
static
enum Result sendMessage(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, DbWrapper *dbWrapper, Messages::Message &msg,
NetLayer *netLayer, DbWrapper *dbWrapper, MsgEnvelope &msg,
QList<Files::File> &fileList, bool dmOVM, bool dmPublishOwnID,
qint64 &msgID, QString &lastError);
......@@ -101,7 +102,7 @@ private:
IsdsSession::IsdsContext m_ctx; /*!< Account isds context. */
NetLayer *m_netLayer; /*!< Pointer to network manager to send request. */
DbWrapper *m_dbWrapper; /*!< Pointer to database wrapper to store reply. */
Messages::Message m_msg; /*!< Message subject string. */
MsgEnvelope m_msg; /*!< Message subject string. */
QList<Files::File> m_fileList; /*!< List of files. */
bool m_dmOVM; /*!< True if send message as OVM. */
bool m_dmPublishOwnID; /*!< True if add sender name to message. */
......
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