From d9b0969ef93a927a7bf838ab7fd2a6036441c26f Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Tue, 3 Feb 2026 23:06:12 +0100 Subject: xxcc.cpp: Honour OMEMO settings --- xxcc.cpp | 22 ++++++++++++++-------- 1 file 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(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, -- cgit v1.2.3