2020-04-03 22:28:15 +00:00
|
|
|
/*
|
|
|
|
* Squawk messenger.
|
|
|
|
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "message.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
Shared::Message::Message(Shared::Message::Type p_type):
|
|
|
|
jFrom(),
|
|
|
|
rFrom(),
|
|
|
|
jTo(),
|
|
|
|
rTo(),
|
|
|
|
id(),
|
|
|
|
body(),
|
|
|
|
time(),
|
|
|
|
thread(),
|
|
|
|
type(p_type),
|
|
|
|
outgoing(false),
|
|
|
|
forwarded(false),
|
|
|
|
state(State::delivered),
|
2020-05-21 15:42:40 +00:00
|
|
|
edited(false),
|
|
|
|
errorText(),
|
|
|
|
originalMessage(),
|
|
|
|
lastModified(),
|
2021-01-14 11:22:02 +00:00
|
|
|
stanzaId(),
|
2023-11-06 23:57:08 +00:00
|
|
|
attachPath(),
|
|
|
|
encryption(EncryptionProtocol::none)
|
2020-05-21 15:42:40 +00:00
|
|
|
{}
|
2020-04-03 22:28:15 +00:00
|
|
|
|
|
|
|
Shared::Message::Message():
|
|
|
|
jFrom(),
|
|
|
|
rFrom(),
|
|
|
|
jTo(),
|
|
|
|
rTo(),
|
|
|
|
id(),
|
|
|
|
body(),
|
|
|
|
time(),
|
|
|
|
thread(),
|
|
|
|
type(Message::normal),
|
|
|
|
outgoing(false),
|
|
|
|
forwarded(false),
|
|
|
|
state(State::delivered),
|
|
|
|
edited(false),
|
|
|
|
errorText(),
|
|
|
|
originalMessage(),
|
2020-05-21 15:42:40 +00:00
|
|
|
lastModified(),
|
2021-01-14 11:22:02 +00:00
|
|
|
stanzaId(),
|
2023-11-06 23:57:08 +00:00
|
|
|
attachPath(),
|
|
|
|
encryption(EncryptionProtocol::none)
|
2020-05-21 15:42:40 +00:00
|
|
|
{}
|
2020-04-03 22:28:15 +00:00
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getBody() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return body;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getFrom() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
QString from = jFrom;
|
2023-11-02 22:55:11 +00:00
|
|
|
if (rFrom.size() > 0)
|
2020-04-03 22:28:15 +00:00
|
|
|
from += "/" + rFrom;
|
2023-11-02 22:55:11 +00:00
|
|
|
|
2020-04-03 22:28:15 +00:00
|
|
|
return from;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getTo() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
QString to = jTo;
|
2023-11-02 22:55:11 +00:00
|
|
|
if (rTo.size() > 0)
|
2020-04-03 22:28:15 +00:00
|
|
|
to += "/" + rTo;
|
2023-11-02 22:55:11 +00:00
|
|
|
|
2020-04-03 22:28:15 +00:00
|
|
|
return to;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getId() const {
|
|
|
|
if (id.size() > 0)
|
2020-05-21 15:42:40 +00:00
|
|
|
return id;
|
2023-11-02 22:55:11 +00:00
|
|
|
else
|
2020-05-21 15:42:40 +00:00
|
|
|
return stanzaId;
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QDateTime Shared::Message::getTime() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return time;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setBody(const QString& p_body) {
|
2020-04-03 22:28:15 +00:00
|
|
|
body = p_body;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setFrom(const QString& from) {
|
2020-04-03 22:28:15 +00:00
|
|
|
QStringList list = from.split("/");
|
|
|
|
if (list.size() == 1) {
|
2020-07-26 19:41:30 +00:00
|
|
|
jFrom = from.toLower();
|
2020-04-03 22:28:15 +00:00
|
|
|
} else {
|
2020-07-26 19:41:30 +00:00
|
|
|
jFrom = list.front().toLower();
|
2020-04-03 22:28:15 +00:00
|
|
|
rFrom = list.back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setTo(const QString& to) {
|
2020-04-03 22:28:15 +00:00
|
|
|
QStringList list = to.split("/");
|
|
|
|
if (list.size() == 1) {
|
2020-07-26 19:41:30 +00:00
|
|
|
jTo = to.toLower();
|
2020-04-03 22:28:15 +00:00
|
|
|
} else {
|
2020-07-26 19:41:30 +00:00
|
|
|
jTo = list.front().toLower();
|
2020-04-03 22:28:15 +00:00
|
|
|
rTo = list.back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setId(const QString& p_id) {
|
2020-04-03 22:28:15 +00:00
|
|
|
id = p_id;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setTime(const QDateTime& p_time) {
|
2020-04-03 22:28:15 +00:00
|
|
|
time = p_time;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getFromJid() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return jFrom;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getFromResource() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return rFrom;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getToJid() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return jTo;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getToResource() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return rTo;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getErrorText() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return errorText;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getPenPalJid() const {
|
|
|
|
if (outgoing)
|
2020-04-03 22:28:15 +00:00
|
|
|
return jTo;
|
2023-11-02 22:55:11 +00:00
|
|
|
else
|
2020-04-03 22:28:15 +00:00
|
|
|
return jFrom;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getPenPalResource() const {
|
|
|
|
if (outgoing)
|
2020-04-03 22:28:15 +00:00
|
|
|
return rTo;
|
2023-11-02 22:55:11 +00:00
|
|
|
else
|
2020-04-03 22:28:15 +00:00
|
|
|
return rFrom;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
Shared::Message::State Shared::Message::getState() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::getEdited() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return edited;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setFromJid(const QString& from) {
|
2020-07-26 19:41:30 +00:00
|
|
|
jFrom = from.toLower();
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setFromResource(const QString& from) {
|
2020-04-03 22:28:15 +00:00
|
|
|
rFrom = from;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setToJid(const QString& to) {
|
2020-07-26 19:41:30 +00:00
|
|
|
jTo = to.toLower();
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setToResource(const QString& to) {
|
2020-04-03 22:28:15 +00:00
|
|
|
rTo = to;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setErrorText(const QString& err) {
|
|
|
|
if (state == State::error)
|
2020-04-03 22:28:15 +00:00
|
|
|
errorText = err;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::getOutgoing() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return outgoing;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setOutgoing(bool og) {
|
2020-04-03 22:28:15 +00:00
|
|
|
outgoing = og;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::getForwarded() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return forwarded;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::generateRandomId() {
|
2020-04-03 22:28:15 +00:00
|
|
|
id = generateUUID();
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getThread() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return thread;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setForwarded(bool fwd) {
|
2020-04-03 22:28:15 +00:00
|
|
|
forwarded = fwd;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setThread(const QString& p_body) {
|
2020-04-03 22:28:15 +00:00
|
|
|
thread = p_body;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QDateTime Shared::Message::getLastModified() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return lastModified;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getOriginalBody() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return originalMessage;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
Shared::Message::Type Shared::Message::getType() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setType(Shared::Message::Type t) {
|
2020-04-03 22:28:15 +00:00
|
|
|
type = t;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setState(Shared::Message::State p_state) {
|
2020-04-03 22:28:15 +00:00
|
|
|
state = p_state;
|
|
|
|
|
2023-11-06 23:57:08 +00:00
|
|
|
if (state != State::error)
|
2020-04-03 22:28:15 +00:00
|
|
|
errorText = "";
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::serverStored() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return state == State::delivered || state == State::sent;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setEdited(bool p_edited) {
|
2020-04-03 22:28:15 +00:00
|
|
|
edited = p_edited;
|
|
|
|
}
|
|
|
|
|
2023-11-05 19:29:44 +00:00
|
|
|
Shared::EncryptionProtocol Shared::Message::getEncryption() const {
|
|
|
|
return encryption;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Shared::Message::setEncryption(EncryptionProtocol encryption) {
|
|
|
|
Shared::Message::encryption = encryption;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Shared::Message::setError(const QString& text) {
|
|
|
|
state = State::error;
|
|
|
|
errorText = text;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QDataStream& operator<<(QDataStream& out, const Shared::Message& info) {
|
|
|
|
out << info.jFrom;
|
|
|
|
out << info.rFrom;
|
|
|
|
out << info.jTo;
|
|
|
|
out << info.rTo;
|
|
|
|
out << info.id;
|
|
|
|
out << info.body;
|
2023-11-10 22:26:16 +00:00
|
|
|
quint64 msecs = info.time.toMSecsSinceEpoch();
|
|
|
|
out << msecs;
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
out << info.thread;
|
|
|
|
out << (quint8)info.type;
|
|
|
|
out << info.outgoing;
|
|
|
|
out << info.forwarded;
|
|
|
|
out << info.oob;
|
|
|
|
out << (quint8)info.state;
|
|
|
|
out << info.edited;
|
|
|
|
if (info.state == Shared::Message::State::error)
|
|
|
|
out << info.errorText;
|
|
|
|
|
|
|
|
if (info.edited) {
|
|
|
|
out << info.originalMessage;
|
|
|
|
out << info.lastModified;
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
2023-11-02 22:55:11 +00:00
|
|
|
out << info.stanzaId;
|
|
|
|
out << info.attachPath;
|
2023-11-05 19:29:44 +00:00
|
|
|
out << (quint8)info.encryption;
|
2023-11-02 22:55:11 +00:00
|
|
|
|
|
|
|
return out;
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QDataStream & operator>>(QDataStream& in, Shared::Message& info) {
|
|
|
|
in >> info.jFrom;
|
|
|
|
in >> info.rFrom;
|
|
|
|
in >> info.jTo;
|
|
|
|
in >> info.rTo;
|
|
|
|
in >> info.id;
|
|
|
|
in >> info.body;
|
2023-11-10 22:26:16 +00:00
|
|
|
|
|
|
|
quint64 msecs;
|
|
|
|
in >> msecs;
|
|
|
|
info.time = QDateTime::fromMSecsSinceEpoch(msecs);
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
in >> info.thread;
|
2020-04-03 22:28:15 +00:00
|
|
|
quint8 t;
|
2023-11-02 22:55:11 +00:00
|
|
|
in >> t;
|
|
|
|
info.type = static_cast<Shared::Message::Type>(t);
|
|
|
|
in >> info.outgoing;
|
|
|
|
in >> info.forwarded;
|
|
|
|
in >> info.oob;
|
2020-04-03 22:28:15 +00:00
|
|
|
quint8 s;
|
2023-11-02 22:55:11 +00:00
|
|
|
in >> s;
|
|
|
|
info.state = static_cast<Shared::Message::State>(s);
|
|
|
|
in >> info.edited;
|
|
|
|
if (info.state == Shared::Message::State::error)
|
|
|
|
in >> info.errorText;
|
|
|
|
|
|
|
|
if (info.edited) {
|
|
|
|
in >> info.originalMessage;
|
|
|
|
in >> info.lastModified;
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
2023-11-02 22:55:11 +00:00
|
|
|
in >> info.stanzaId;
|
|
|
|
in >> info.attachPath;
|
2023-11-05 19:29:44 +00:00
|
|
|
quint8 e;
|
|
|
|
in >> e;
|
|
|
|
info.encryption = static_cast<Shared::EncryptionProtocol>(e);
|
2023-11-02 22:55:11 +00:00
|
|
|
|
|
|
|
return in;
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Shared::Message::change(const QMap<QString, QVariant>& data)
|
|
|
|
{
|
|
|
|
QMap<QString, QVariant>::const_iterator itr = data.find("state");
|
2023-11-02 22:55:11 +00:00
|
|
|
if (itr != data.end())
|
2020-04-03 22:28:15 +00:00
|
|
|
setState(static_cast<State>(itr.value().toUInt()));
|
|
|
|
|
2021-01-14 11:22:02 +00:00
|
|
|
itr = data.find("outOfBandUrl");
|
2023-11-02 22:55:11 +00:00
|
|
|
if (itr != data.end())
|
2021-01-14 11:22:02 +00:00
|
|
|
setOutOfBandUrl(itr.value().toString());
|
|
|
|
|
|
|
|
itr = data.find("attachPath");
|
2023-11-02 22:55:11 +00:00
|
|
|
if (itr != data.end())
|
2021-01-14 11:22:02 +00:00
|
|
|
setAttachPath(itr.value().toString());
|
|
|
|
|
2020-04-03 22:28:15 +00:00
|
|
|
if (state == State::error) {
|
|
|
|
itr = data.find("errorText");
|
2023-11-02 22:55:11 +00:00
|
|
|
if (itr != data.end())
|
2020-04-03 22:28:15 +00:00
|
|
|
setErrorText(itr.value().toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool idChanged = false;
|
|
|
|
itr = data.find("id");
|
|
|
|
if (itr != data.end()) {
|
|
|
|
QString newId = itr.value().toString();
|
|
|
|
if (id != newId) {
|
|
|
|
setId(newId);
|
|
|
|
idChanged = true;
|
|
|
|
}
|
|
|
|
}
|
2020-05-21 15:42:40 +00:00
|
|
|
|
|
|
|
itr = data.find("stanzaId");
|
|
|
|
if (itr != data.end()) {
|
|
|
|
QString newId = itr.value().toString();
|
|
|
|
if (stanzaId != newId) {
|
|
|
|
setStanzaId(newId);
|
2023-11-02 22:55:11 +00:00
|
|
|
if (id.size() == 0)
|
2020-05-21 15:42:40 +00:00
|
|
|
idChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-03 22:28:15 +00:00
|
|
|
itr = data.find("body");
|
|
|
|
if (itr != data.end()) {
|
2021-04-28 20:26:19 +00:00
|
|
|
QString b = itr.value().toString();
|
|
|
|
if (body != b) {
|
|
|
|
QMap<QString, QVariant>::const_iterator dItr = data.find("stamp");
|
|
|
|
QDateTime correctionDate;
|
2023-11-02 22:55:11 +00:00
|
|
|
if (dItr != data.end())
|
2021-04-28 20:26:19 +00:00
|
|
|
correctionDate = dItr.value().toDateTime();
|
2023-11-02 22:55:11 +00:00
|
|
|
else
|
2021-04-28 20:26:19 +00:00
|
|
|
correctionDate = QDateTime::currentDateTimeUtc(); //in case there is no information about time of this correction it's applied
|
2023-11-02 22:55:11 +00:00
|
|
|
|
2021-04-28 20:26:19 +00:00
|
|
|
if (!edited || lastModified < correctionDate) {
|
2023-11-02 22:55:11 +00:00
|
|
|
if (!edited)
|
2022-03-28 20:25:33 +00:00
|
|
|
originalMessage = body;
|
2023-11-02 22:55:11 +00:00
|
|
|
|
2021-04-28 20:26:19 +00:00
|
|
|
lastModified = correctionDate;
|
2022-03-27 19:05:31 +00:00
|
|
|
setBody(b);
|
2021-04-28 20:26:19 +00:00
|
|
|
setEdited(true);
|
|
|
|
}
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
2021-05-07 18:26:02 +00:00
|
|
|
} else {
|
|
|
|
QMap<QString, QVariant>::const_iterator dItr = data.find("stamp");
|
|
|
|
if (dItr != data.end()) {
|
|
|
|
QDateTime ntime = dItr.value().toDateTime();
|
2023-11-02 22:55:11 +00:00
|
|
|
if (time != ntime)
|
2021-05-07 18:26:02 +00:00
|
|
|
setTime(ntime);
|
|
|
|
}
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return idChanged;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setCurrentTime() {
|
2020-04-03 22:28:15 +00:00
|
|
|
time = QDateTime::currentDateTimeUtc();
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getOutOfBandUrl() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return oob;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::hasOutOfBandUrl() const {
|
2020-04-03 22:28:15 +00:00
|
|
|
return oob.size() > 0;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setOutOfBandUrl(const QString& url) {
|
2020-04-03 22:28:15 +00:00
|
|
|
oob = url;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::storable() const {
|
2021-05-07 18:26:02 +00:00
|
|
|
return id.size() > 0 && (body.size() > 0 || oob.size() > 0 || attachPath.size() > 0);
|
2020-04-03 22:28:15 +00:00
|
|
|
}
|
2020-05-21 15:42:40 +00:00
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setStanzaId(const QString& sid) {
|
2020-05-21 15:42:40 +00:00
|
|
|
stanzaId = sid;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getStanzaId() const {
|
2020-05-21 15:42:40 +00:00
|
|
|
return stanzaId;
|
|
|
|
}
|
2021-01-14 11:22:02 +00:00
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
QString Shared::Message::getAttachPath() const {
|
2021-01-14 11:22:02 +00:00
|
|
|
return attachPath;
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::setAttachPath(const QString& path) {
|
2021-01-14 11:22:02 +00:00
|
|
|
attachPath = path;
|
|
|
|
}
|
2021-04-19 21:49:24 +00:00
|
|
|
|
|
|
|
Shared::Message::Change::Change(const QMap<QString, QVariant>& _data):
|
|
|
|
data(_data),
|
|
|
|
idModified(false) {}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::Change::operator()(Shared::Message& msg) {
|
2021-04-19 21:49:24 +00:00
|
|
|
idModified = msg.change(data);
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
void Shared::Message::Change::operator()(Shared::Message* msg) {
|
2021-04-19 21:49:24 +00:00
|
|
|
idModified = msg->change(data);
|
|
|
|
}
|
|
|
|
|
2023-11-02 22:55:11 +00:00
|
|
|
bool Shared::Message::Change::hasIdBeenModified() const {
|
2021-04-19 21:49:24 +00:00
|
|
|
return idModified;
|
|
|
|
}
|
|
|
|
|