handled a case when user removes downloaded file, minor optimizations on message changing

This commit is contained in:
Blue 2021-04-28 23:26:19 +03:00
parent b44873d587
commit 50190f3eac
23 changed files with 136 additions and 40 deletions

View file

@ -429,3 +429,18 @@ void Core::MessageHandler::sendMessageWithLocalUploadedFile(Shared::Message msg,
performSending(msg);
//TODO removal/progress update
}
void Core::MessageHandler::requestChangeMessage(const QString& jid, const QString& messageId, const QMap<QString, QVariant>& data)
{
RosterItem* cnt = acc->rh->getRosterItem(jid);
if (cnt != 0) {
QMap<QString, QVariant>::const_iterator itr = data.find("attachPath");
if (data.size() == 1 && itr != data.end()) {
cnt->changeMessage(messageId, data);
emit acc->changeMessage(jid, messageId, data);
} else {
qDebug() << "A request to change message" << messageId << "of conversation" << jid << "with following data" << data;
qDebug() << "nothing but the changing of the local path is supported yet in this method, skipping";
}
}
}

View file

@ -58,6 +58,7 @@ public slots:
void onDownloadFileComplete(const std::list<Shared::MessageInfo>& msgs, const QString& path);
void onUploadFileComplete(const std::list<Shared::MessageInfo>& msgs, const QString& path);
void onLoadFileError(const std::list<Shared::MessageInfo>& msgs, const QString& path, bool up);
void requestChangeMessage(const QString& jid, const QString& messageId, const QMap<QString, QVariant>& data);
private:
bool handleChatMessage(const QXmppMessage& msg, bool outgoing = false, bool forwarded = false, bool guessing = false);