some refactoring, some improvements
This commit is contained in:
parent
be466fbad1
commit
e31ef78e71
13 changed files with 188 additions and 147 deletions
|
@ -358,8 +358,8 @@ std::pair<Shared::Message::State, QString> Core::MessageHandler::scheduleSending
|
|||
const QXmppE2eeExtension::MessageEncryptResult& res = task.result();
|
||||
if (std::holds_alternative<std::unique_ptr<QXmppMessage>>(res)) {
|
||||
const std::unique_ptr<QXmppMessage>& encrypted = std::get<std::unique_ptr<QXmppMessage>>(res);
|
||||
encrypted->setBody("This message is encrypted with OMEMO 2 but could not be decrypted");
|
||||
encrypted->setOutOfBandUrl("");
|
||||
encrypted->setBody(QString());
|
||||
encrypted->setOutOfBandUrl(QString());
|
||||
bool success = acc->client.sendPacket(*encrypted.get());
|
||||
if (success)
|
||||
return {Shared::Message::State::sent, ""};
|
||||
|
@ -375,8 +375,8 @@ std::pair<Shared::Message::State, QString> Core::MessageHandler::scheduleSending
|
|||
task.then(this, [this, id] (QXmppE2eeExtension::MessageEncryptResult&& result) {
|
||||
if (std::holds_alternative<std::unique_ptr<QXmppMessage>>(result)) {
|
||||
const std::unique_ptr<QXmppMessage>& encrypted = std::get<std::unique_ptr<QXmppMessage>>(result);
|
||||
encrypted->setBody("This message is encrypted with OMEMO 2 but could not be decrypted");
|
||||
encrypted->setOutOfBandUrl("");
|
||||
encrypted->setBody(QString());
|
||||
encrypted->setOutOfBandUrl(QString());
|
||||
bool success = acc->client.sendPacket(*encrypted.get());
|
||||
if (success) {
|
||||
std::tuple<bool, QString, QString> ids = getOriginalPendingMessageId(id, false);
|
||||
|
@ -602,7 +602,7 @@ void Core::MessageHandler::onUploadFileComplete(const std::list<Shared::MessageI
|
|||
|
||||
void Core::MessageHandler::sendMessageWithLocalUploadedFile(Shared::Message msg, const QString& url, bool newMessage) {
|
||||
msg.setOutOfBandUrl(url);
|
||||
if (msg.getBody().size() == 0) //not sure why, but most messages do that
|
||||
if (msg.getBody().size() == 0) //not sure why, but most messengers do that
|
||||
msg.setBody(url); //they duplicate oob in body, some of them wouldn't even show an attachment if you don't do that
|
||||
|
||||
performSending(msg, pendingCorrectionMessages.at(msg.getId()), newMessage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue