aboutsummaryrefslogtreecommitdiff
path: root/xxcc.cpp
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-02-03 23:06:12 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-03 23:06:12 +0100
commitd9b0969ef93a927a7bf838ab7fd2a6036441c26f (patch)
tree9c62dccc8584d4bf0496ca8f4d823210219a8590 /xxcc.cpp
parent5f43d03b050ce303853f22cee6e1a23f9e1b1ffc (diff)
xxcc.cpp: Honour OMEMO settingsHEADmaster
Diffstat (limited to 'xxcc.cpp')
-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,