Commit b3daa438 authored by Martin Straka's avatar Martin Straka

Added support for zfo database size saturation

parent 6b55f327
......@@ -133,7 +133,8 @@ SOURCES += \
src/worker/task_find_databox.cpp \
src/worker/task_find_databox_fulltext.cpp \
src/worker/task_keep_alive.cpp \
src/worker/task_send_sms.cpp
src/worker/task_send_sms.cpp \
src/zfo.cpp
HEADERS += \
src/accounts.h \
......@@ -187,7 +188,8 @@ HEADERS += \
src/worker/task_find_databox.h \
src/worker/task_find_databox_fulltext.h \
src/worker/task_keep_alive.h \
src/worker/task_send_sms.h
src/worker/task_send_sms.h \
src/zfo.h
android {
SOURCES += \
......
......@@ -35,6 +35,8 @@ Item {
property var accountModel: null
property string sectionName: "storage"
property int currentZfoSize: 0
Component.onCompleted: {
settings.loadSettings(sectionName)
}
......@@ -69,6 +71,11 @@ Item {
attachLifeSpinBox.val().toString(), zfoLifeSpinBox.value.toString(),
dbPathText.text.toString())
settings.saveAllSettings(accountModel)
// if ZFO storage limit was changed and it is less,
// reduce zfo database size
if (currentZfoSize > zfoLifeSpinBox.value) {
zfo.reduceZfoDbSize(currentZfoSize-zfoLifeSpinBox.value);
}
pageView.pop(StackView.Immediate)
}
}
......@@ -235,6 +242,7 @@ Item {
messageLifeSpinBox.setVal(msgLifeDays)
attachLifeSpinBox.setVal(fileLifeDays)
zfoLifeSpinBox.value = maxZfoSizeMB
currentZfoSize = maxZfoSizeMB
dbPathText.text = dbPath
dbPathLabel.visible = showChangeDbLocation
dbPathText.visible = showChangeDbLocation
......
......@@ -56,6 +56,7 @@
#include "src/sqlite/file_db_container.h"
#include "src/sqlite/message_db_container.h"
#include "src/sqlite/zfo_db.h"
#include "src/zfo.h"
/* iOS app_delegate - for interaction with iOS action Open in... */
#if defined Q_OS_IOS
......@@ -259,6 +260,7 @@ int main(int argc, char *argv[])
Files files;
IsdsWrapper isds;
GlobalSettingsQmlWrapper settings;
Zfo zfo;
/* Connect slot for isds cxt delete when account was deleted or updated */
QObject::connect(&accounts, SIGNAL(removeIsdsCtx(QString)),
......@@ -316,6 +318,7 @@ int main(int argc, char *argv[])
ctx->setContextProperty("locker", &locker);
ctx->setContextProperty("interactionZfoFile", &interactionZfoFile);
ctx->setContextProperty("dlgEmitter", QmlDlgHelper::dlgEmitter);
ctx->setContextProperty("zfo", &zfo);
/* register and set models in QML */
ctx->setContextProperty(accountModelPtr->objectName(), accountModelPtr);
......
......@@ -26,6 +26,7 @@
#include "src/net/db_wrapper.h"
#include "src/settings.h"
#include "src/sqlite/account_db.h"
#include "src/sqlite/zfo_db.h"
DbWrapper::DbWrapper(QObject *parent)
: QObject(parent)
......@@ -336,3 +337,10 @@ bool DbWrapper::insertMesasgeDeliveryInfoToDb(const QString &userName,
return ret;
}
bool DbWrapper::insertZfoToDb(qint64 msgId, bool isTestAccount, int zfoSize,
const QByteArray &zfoData)
{
return globZfoDbPtr->insertZfoToDb(msgId, isTestAccount, zfoSize,
zfoData.toBase64());
}
......@@ -193,6 +193,18 @@ public:
bool insertMesasgeDeliveryInfoToDb(const QString &userName,
const QList<Messages::Event> &eventList, qint64 msgId,
QString &txt);
/*!
* @brief Insert or update zfo file info to db.
*
* @param[in] msgId message ID.
* @param[in] isTestAccount True if account is ISDS testing.
* @param[in] zfoSize Real size of zfo.
* @param[in] zfoData Zfo data.
* @return true if success.
*/
bool insertZfoToDb(qint64 msgId, bool isTestAccount, int zfoSize,
const QByteArray &zfoData);
};
......
......@@ -684,7 +684,8 @@ void IsdsWrapper::downloadMessage(MessageListModel *messageModel,
TaskDownloadMessage *task;
task = new (std::nothrow) TaskDownloadMessage(
m_isdsSession.isdsCtxMap[userName], &m_netLayer, &m_dbWrapper,
msgId, messageType, messageModel);
msgId, messageType, messageModel, (globSet.zfoDbSizeMBs > 0),
AccountListModel::globAccounts[userName].isTestAccount());
task->setAutoDelete(true);
m_workPool.assignLo(task);
}
......@@ -896,7 +897,9 @@ void IsdsWrapper::syncSingleAccount(const QVariant &acntModelVariant,
m_isdsSession.isdsCtxMap[userName], &m_netLayer, &m_dbWrapper,
msgDirect, (globSet.downloadOnlyNewMsgs) ? DOWNLOAD_NEW_MESSAGES : DOWNLOAD_ALL_MESSAGES,
1, MESSAGE_LIST_LIMIT, &m_workPool, messageModel, accountModel,
globSet.downloadCompleteMsgs, globSet.dbsLocation);
globSet.downloadCompleteMsgs, globSet.dbsLocation,
(globSet.zfoDbSizeMBs > 0),
AccountListModel::globAccounts[userName].isTestAccount());
task->setAutoDelete(true);
m_workPool.assignHi(task);
}
......@@ -556,7 +556,8 @@ bool XmlLayer::parseLoginResponse(const QByteArray &xmlData, QString &txt)
}
bool XmlLayer::parseSignedMessageDownloadResponse(const QByteArray &xmlData,
Messages::Message &msg, QList<Files::File> &fileList, QString &txt)
Messages::Message &msg, QList<Files::File> &fileList, QString &txt,
QByteArray &zfoData)
{
qDebug("%s()", __func__);
......@@ -585,6 +586,8 @@ bool XmlLayer::parseSignedMessageDownloadResponse(const QByteArray &xmlData,
/* decode signature from base64 and obtain something cms message */
QByteArray cmsData = QByteArray::fromBase64(signature);
zfoData = cmsData;
#ifdef Q_OS_WIN
QByteArray newRawData;
......
......@@ -285,11 +285,14 @@ public:
* @param[out] msg Envelope message structure.
* @param[out] fileList List of files structure.
* @param[out] txt Error description if something failed.
* @param[out] zfoData ZFO file content.
*
* @return true if success.
*/
static
bool parseSignedMessageDownloadResponse(const QByteArray &xmlData,
Messages::Message &msg, QList<Files::File> &fileList, QString &txt);
Messages::Message &msg, QList<Files::File> &fileList, QString &txt,
QByteArray &zfoData);
/*!
* @brief Parse getOwnerInfoFromLogin XML.
......
......@@ -395,3 +395,31 @@ namespace MsgZfoTbl {
} /* namespace MsgZfoTbl */
SQLiteTbl msgZfoTbl(MsgZfoTbl::tabName, MsgZfoTbl::knownAttrs,
MsgZfoTbl::attrProps, MsgZfoTbl::colConstraints, MsgZfoTbl::tblConstraint);
namespace ZfoSizeCntTbl {
const QString tabName("zfo_size_cnt");
const QVector< QPair<QString, enum EntryType> > knownAttrs = {
{"id", DB_INTEGER},
{"totalSize", DB_INTEGER}
};
const QMap<QString, QString> colConstraints = {
{"id", "NOT NULL"},
{"totalSize", "NOT NULL"}
};
const QString &tblConstraint(
",\n"
" PRIMARY KEY (id),\n"
" CHECK (id = 0)"
);
const QMap<QString, SQLiteTbl::AttrProp> attrProps = {
{"id", {DB_INTEGER, ""}},
{"totalSize", {DB_INTEGER, ""}}
};
} /* namespace ZfoSizeCntTbl */
SQLiteTbl zfoSizeCntTbl(ZfoSizeCntTbl::tabName, ZfoSizeCntTbl::knownAttrs,
ZfoSizeCntTbl::attrProps, ZfoSizeCntTbl::colConstraints,
ZfoSizeCntTbl::tblConstraint);
......@@ -48,4 +48,9 @@ extern SQLiteTbl flsTbl; /*!< Table 'files'. */
*/
extern SQLiteTbl msgZfoTbl; /*!< Table 'message_zfos'. */
/*
* Zfo database.
*/
extern SQLiteTbl zfoSizeCntTbl; /*!< Table 'zfo_size_cnt'. */
#endif /* _DB_TABLES_H_ */
......@@ -35,6 +35,7 @@
#include "src/sqlite/db_tables.h"
#include "src/sqlite/dbs.h"
#include "src/sqlite/zfo_db.h"
#include "src/settings.h"
ZfoDb::ZfoDb(const QString &connectionName)
: SQLiteDb(connectionName)
......@@ -55,9 +56,40 @@ bool ZfoDb::openDb(const QString &fileName, bool storeToDisk)
dirName + QDir::separator() + QDir::toNativeSeparators(fileName),
!storeToDisk, listOfTables());
qDebug() << m_db.databaseName();
if (!ret) {
return ret;
}
/* Insert zfo size count row into table if not exists */
QSqlQuery query(m_db);
QString queryStr = "SELECT count(*) FROM zfo_size_cnt";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
goto fail;
}
if (query.exec() && query.isActive() && query.first() && query.isValid()) {
if (0 == query.value(0).toInt()) {
queryStr = "INSERT INTO zfo_size_cnt (id,totalSize) "
"VALUES (0,0)";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
goto fail;
}
return query.exec();
}
return true;
} else {
qDebug() <<
"Cannot execute SQL query and/or read SQL data: %s.",
query.lastError().text().toUtf8().constData();
}
return ret;
fail:
return false;
}
bool ZfoDb::deleteCurrentDbCreateNew(const QString &newLocDir)
......@@ -212,13 +244,276 @@ bool ZfoDb::moveDb(const QString &newLocDir)
return move_ret;
}
void ZfoDb::deleteZfo(qint64 msgId, bool isTestAccount, int zfoSize)
{
QSqlQuery query(m_db);
QString queryStr = "DELETE FROM message_zfos WHERE "
"dmID = :msgId AND testEnv = :isTestAccount";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
if (!query.exec()) {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
}
queryStr = "UPDATE zfo_size_cnt SET totalSize = totalSize - :zfoSize";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return;
}
query.bindValue(":zfoSize", zfoSize);
if (!query.exec()) {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
}
}
QByteArray ZfoDb::getZfoContentFromDb(qint64 msgId, bool isTestAccount)
{
QSqlQuery query(m_db);
QString queryStr = "SELECT data FROM message_zfos WHERE "
"dmID = :msgId AND testEnv = :isTestAccount";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
goto fail;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
if (query.exec() && query.isActive() &&
query.first() && query.isValid()) {
return query.value(0).toByteArray();
}
fail:
return QByteArray();
}
int ZfoDb::getZfoSizeFromDb(qint64 msgId, bool isTestAccount)
{
QSqlQuery query(m_db);
QString queryStr = "SELECT size FROM message_zfos WHERE "
"dmID = :msgId AND testEnv = :isTestAccount";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
goto fail;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
if (query.exec() && query.isActive() &&
query.first() && query.isValid()) {
return query.value(0).toInt();
}
fail:
return 0;
}
bool ZfoDb::insertZfoToDb(qint64 msgId, bool isTestAccount, int zfoSize,
const QByteArray &zfoData)
{
QSqlQuery query(m_db);
qint64 lastAccessTime = -1;
QString queryStr = "SELECT lastAccessTime FROM message_zfos WHERE "
"dmID = :msgId AND testEnv = :isTestAccount";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
if (query.exec() && query.isActive()) {
query.first();
if (query.isValid()) {
lastAccessTime = query.value(0).toLongLong();
}
} else {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
/* ZFO is in the databse = update and return */
if (-1 != lastAccessTime) {
queryStr = "UPDATE message_zfos SET dmID = :msgId, "
"testEnv = :isTestAccount, lastAccessTime = :downloadTime, "
"size = :zfoSize, data = :zfoData "
"WHERE dmID = :msgId AND testEnv = :isTestAccount";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
query.bindValue(":downloadTime", QDateTime::currentSecsSinceEpoch());
query.bindValue(":zfoSize", zfoSize);
query.bindValue(":zfoData", zfoData);
if (!query.exec()) {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
return true;
}
/* ZFO is not in the databse = insert and release db size if needed */
// compute database size with new zfo
uint maximalSize = (globSet.zfoDbSizeMBs * 1000000) - zfoSize;
// if database is exceeded, release some oldest zfo files (based on size)
if (isDbSizeExceeded(maximalSize)) {
releaseDb(zfoSize);
}
queryStr = "INSERT INTO message_zfos ("
"dmID, testEnv, lastAccessTime, size, data) VALUES ("
":msgId, :isTestAccount, :downloadTime, :zfoSize, :zfoData)";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
query.bindValue(":downloadTime", QDateTime::currentSecsSinceEpoch());
query.bindValue(":zfoSize", zfoSize);
query.bindValue(":zfoData", zfoData);
if (!query.exec()) {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
// update db size counter
queryStr = "UPDATE zfo_size_cnt SET totalSize = totalSize + :zfoSize";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
query.bindValue(":zfoSize", zfoSize);
if (!query.exec()) {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
return true;
}
bool ZfoDb::isDbSizeExceeded(uint currentLimit)
{
QSqlQuery query(m_db);
QString queryStr = "SELECT totalSize FROM zfo_size_cnt WHERE id = :id";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return false;
}
query.bindValue(":id", 0);
if (query.exec() && query.isActive() &&
query.first() && query.isValid()) {
return (currentLimit < query.value(0).toUInt());
} else {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
}
return false;
}
void ZfoDb::updateZfoLastAccessTime(qint64 msgId, bool isTestAccount)
{
QSqlQuery query(m_db);
QString queryStr = "UPDATE message_zfos SET "
"lastAccessTime = :newTime "
"WHERE dmID = :msgId AND testEnv = :isTestAccount";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
return;
}
query.bindValue(":msgId", msgId);
query.bindValue(":isTestAccount", isTestAccount);
query.bindValue(":newTime", QDateTime::currentSecsSinceEpoch());
if (!query.exec()) {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
}
}
bool ZfoDb::releaseDb(uint releaseSpace)
{
QSqlQuery query(m_db);
uint releasedBytes = 0;
QString queryStr = "SELECT dmId, testEnv, size, lastAccessTime "
"FROM message_zfos ORDER BY lastAccessTime ASC";
if (!query.prepare(queryStr)) {
qDebug() << "Cannot prepare SQL query:" <<
query.lastError().text().toUtf8().constData();
goto fail;
}
if (query.exec() && query.isActive()) {
query.first();
while (query.isValid()) {
if (releaseSpace > releasedBytes) {
releasedBytes += query.value(2).toLongLong();
deleteZfo(query.value(0).toLongLong(),
query.value(1).toBool(),
query.value(2).toInt());
} else {
query.exec("VACUUM");
return true;
}
query.next();
}
} else {
qDebug() << "Cannot execute SQL query:" <<
query.lastError().text().toUtf8().constData();
goto fail;
}
fail:
return false;
}
QList<class SQLiteTbl *> ZfoDb::listOfTables(void)
{
static QList<class SQLiteTbl *> tables;
if (tables.isEmpty()) {
tables.append(&msgZfoTbl);
tables.append(&zfoSizeCntTbl);
}
return tables;
}
ZfoDb *globZfoDbPtr = 0;
ZfoDb *globZfoDbPtr = Q_NULLPTR;
......@@ -93,6 +93,69 @@ public:
*/
bool moveDb(const QString &newLocDir);
/*!
* @brief Delete zfo from database.
*
* @param[in] msgId String with message id.
* @param[in] isTestAccount True if account is in the ISDS testing environment.
* @param[in] zfoSize Zfo size.
*/
void deleteZfo(qint64 msgId, bool isTestAccount, int zfoSize);
/*!
* @brief Get Zfo content.
*
* @param[in] msgId String with message id.
* @param[in] isTestAccount True if account is in the ISDS testing environment.
* @return Zfo content in base64.
*/
QByteArray getZfoContentFromDb(qint64 msgId, bool isTestAccount);
/*!
* @brief Get Zfo size in bytes.
*
* @param[in] msgId String with message id.
* @param[in] isTestAccount True if account is in the ISDS testing environment.
* @return Size of zfo file in bytes.
*/
int getZfoSizeFromDb(qint64 msgId, bool isTestAccount);
/*!
* @brief Insert or update zfo file info to db.
*
* @param[in] msgId message ID.
* @param[in] isTestAccount True if account is ISDS testing.
* @param[in] zfoSize Real size of zfo.
* @param[in] zfoBase64Data Zfo data in base64.
* @return true if success.
*/
bool insertZfoToDb(qint64 msgId, bool isTestAccount, int zfoSize,
const QByteArray &zfoBase64Data);
/*!
* @brief Test if is zfo database size exceeded.
*
* @param[in] currentLimit Current database size limit.
* @return True if db size is exceeded.
*/
bool isDbSizeExceeded(uint currentLimit);
/*!
* @brief Release db - delete oldest zfo files and vacuum db.
*
* @param[in] releaseSpace How many bytes should be released.
* @return True true if success.
*/
bool releaseDb(uint releaseSpace);
/*!
* @brief Update Zfo last access time.
*
* @param[in] msgId String with message id.
* @param[in] isTestAccount True if account is in the ISDS testing environment.
*/
void updateZfoLastAccessTime(qint64 msgId, bool isTestAccount);
private:
/*!
* @brief Returns list of tables.
......
......@@ -22,6 +22,7 @@
*/
#include "src/log/log.h"
#include "src/io/filesystem.h"
#include "src/net/isds_const.h"
#include "src/net/xml_layer.h"
#include "src/worker/emitter.h"
......@@ -31,14 +32,17 @@
TaskDownloadMessage::TaskDownloadMessage(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, DbWrapper *dbWrapper, qint64 msgId,
enum Messages::MessageType msgDirect, MessageListModel *messageModel)
enum Messages::MessageType msgDirect, MessageListModel *messageModel,
bool saveZfo, bool isTestAccount)
: m_result(DL_ERR),
m_ctx(ctx),
m_netLayer(netLayer),
m_dbWrapper(dbWrapper),
m_msgId(msgId),
m_msgDirect(msgDirect),
m_messageModel(messageModel)
m_messageModel(messageModel),
m_saveZfo(saveZfo),
m_isTestAccount(isTestAccount)
{
}
......@@ -72,7 +76,7 @@ void TaskDownloadMessage::run(void)
logDebugLv1NL("%s", "-----------------------------------------------");
m_result = downloadMessage(m_ctx, m_netLayer, m_dbWrapper, m_msgId,
m_msgDirect, m_messageModel);
m_msgDirect, m_messageModel, m_saveZfo, m_isTestAccount);
/* ### Worker task end. ### */
......@@ -87,7 +91,7 @@ void TaskDownloadMessage::run(void)
enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
IsdsSession::IsdsContext &ctx, NetLayer *netLayer, DbWrapper *dbWrapper,
qint64 msgId, enum Messages::MessageType msgDirect,
MessageListModel *messageModel)
MessageListModel *messageModel, bool saveZfo, bool isTestAccount)
{
if (ctx.username.isEmpty()) {
Q_ASSERT(0);
......@@ -99,6 +103,7 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
QList<Files::File> fileList;
QList<Messages::Event> eventList;
QString userType, authorName;
QByteArray zfoData;
/* Send SOAP request to download complete message */
if (!netLayer->sendSoapRequest(ctx, LOGIN_SERVICE,
......@@ -109,7 +114,7 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
/* Parse SOAP response */
if (!XmlLayer::parseSignedMessageDownloadResponse(xmlDataOut, msg,
fileList, ctx.last_isds_msg)) {
fileList, ctx.last_isds_msg, zfoData)) {
return DL_XML_ERROR;
}
......@@ -169,5 +174,11 @@ enum TaskDownloadMessage::Result TaskDownloadMessage::downloadMessage(
ctx.last_isds_msg);
}
/* Save message ZFO to zfo database */
if (saveZfo) {
dbWrapper->insertZfoToDb(msgId, isTestAccount, zfoData.size(),
zfoData);
}
return DL_SUCCESS;
}
......@@ -50,16 +50,19 @@ public:
/*!
* @brief Constructor.
*
* @param[in] ctx Account isds context (include username).
* @param[in] netLayer Pointer to network manager.
* @param[in] dbWrapper Pointer to database wrapper.
* @param[in] msgId Message identifier.
* @param[in] msgDirect Received or sent message.
* @param[in] messageModel Pointer to message model.
* @param[in] ctx Account isds context (include username).
* @param[in] netLayer Pointer to network manager.
* @param[in] dbWrapper Pointer to database wrapper.
* @param[in] msgId Message identifier.
* @param[in] msgDirect Received or sent message.
* @param[in] messageModel Pointer to message model.
* @param[in] saveZfo Save ZFO to local storage.
* @param[in] isTestAccount True if account is ISDS testing.
*/
explicit TaskDownloadMessage(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, DbWrapper *dbWrapper, qint64 msgId,
enum Messages::MessageType msgDirect, MessageListModel *messageModel);
enum Messages::MessageType msgDirect,
MessageListModel *messageModel, bool saveZfo, bool isTestAccount);
/*!
* @brief Performs actual message download.
......@@ -70,18 +73,22 @@ public:
/*!
* @brief Download whole message (envelope, attachments, raw).
*
* @param[in] ctx Account isds context (include username).
* @param[in] netLayer Pointer to network manager.
* @param[in] dbWrapper Pointer to database wrapper.
* @param[in] msgId Message identifier.
* @param[in] msgDirect Received or sent message.
* @param[in] messageModel Pointer to message model.
* @param[in] ctx Account isds context (include username).
* @param[in] netLayer Pointer to network manager.
* @param[in] dbWrapper Pointer to database wrapper.
* @param[in] msgId Message identifier.
* @param[in] msgDirect Received or sent message.
* @param[in] messageModel Pointer to message model.
* @param[in] saveZfo Save ZFO to local storage.
* @param[in] isTestAccount True if account is ISDS testing.
* @param[out] zfoData ZFO file content.
* @return Error state.
*/
static
enum Result downloadMessage(IsdsSession::IsdsContext &ctx,
NetLayer *netLayer, DbWrapper *dbWrapper, qint64 msgId,
enum Messages::MessageType msgDirect, MessageListModel *messageModel);
enum Messages::MessageType msgDirect, MessageListModel *messageModel,
bool saveZfo, bool isTestAccount);
enum Result m_result; /*!< Return state. */