aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xxcc.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/xxcc.cpp b/xxcc.cpp
index 2585608..cf456c8 100644
--- a/xxcc.cpp
+++ b/xxcc.cpp
@@ -228,18 +228,12 @@ void xxcc::send(void)
const auto from = selected->jidBare(),
to = ui.jid->text(), msg = ui.chatinput->toPlainText();
- const bool enc = ui.omemo->isChecked();
QXmppMessage out(from, to, msg);
const auto dt = QDateTime::currentDateTimeUtc();
- out.setE2eeFallbackBody("[xxcc: This is an OMEMO-encrypted message]");
out.setStamp(dt);
- // TODO: QXmpp forces OMEMO 2 (XEP-0384 version >= 0.8.0).
- // This breaks compatibility with Dino and Gajim, who still use 0.1.0.
- // out.setEncryptionMethod(QXmpp::Omemo0);
- selected->sendSensitive(std::move(out)).then(this,
- [=](const QXmpp::SendResult &&result) mutable
+ auto fn = [=](const QXmpp::SendResult &&result) mutable
{
qDebug() << "result.index(): " << result.index();
@@ -256,7 +250,19 @@ void xxcc::send(void)
const auto &error = std::get<QXmppError>(result);
qDebug() << error.description;
}
- });
+ };
+
+ if (ui.omemo->isChecked())
+ {
+ out.setE2eeFallbackBody("[xxcc: This is an OMEMO-encrypted message]");
+ // TODO: QXmpp forces OMEMO 2 (XEP-0384 version >= 0.8.0).
+ // This breaks compatibility with Dino and Gajim, who still use 0.1.0.
+ // out.setEncryptionMethod(QXmpp::Omemo0);
+
+ selected->sendSensitive(std::move(out)).then(this, fn);
+ }
+ else
+ selected->send(std::move(out)).then(this, fn);
}
void xxcc::storeMessage(const QString &from, const QString &to,