diff --git a/src/omemo/QXmppOmemoManager_p.cpp b/src/omemo/QXmppOmemoManager_p.cpp index e8965af45..99ac82ef0 100644 --- a/src/omemo/QXmppOmemoManager_p.cpp +++ b/src/omemo/QXmppOmemoManager_p.cpp @@ -1354,7 +1354,8 @@ QXmppTask> ManagerPrivate::decryptMessage(QXmppMessa if (const auto omemoEnvelope = omemoElement.searchEnvelope(ownBareJid(), ownDevice.id)) { QXmppPromise> interface; - const auto senderJid = QXmppUtils::jidToBareJid(stanza.from()); + const auto mixUserJid = stanza.mixUserJid(); + const auto senderJid = mixUserJid.isEmpty() ? QXmppUtils::jidToBareJid(stanza.from()) : mixUserJid; const auto senderDeviceId = omemoElement.senderDeviceId(); const auto omemoPayload = omemoElement.payload(); @@ -1474,13 +1475,14 @@ QXmppTask> ManagerPrivate::decryptStanza(T stanz q->info(u"Sender '" + senderJid + u"' of stanza does not match SCE 'from' affix element '" + sceEnvelopeReader.from() + u"'"); } - if (const auto recipientJid = QXmppUtils::jidToBareJid(stanza.to()); isMessageStanza) { - if (const auto &message = dynamic_cast(stanza); message.type() == QXmppMessage::GroupChat && (sceEnvelopeReader.to() != recipientJid)) { + if (isMessageStanza) { + // For messages from group chats, their "from" element corresponds to the SCE affix element "to". + if (const auto &message = dynamic_cast(stanza); message.type() == QXmppMessage::GroupChat && (sceEnvelopeReader.to() != QXmppUtils::jidToBareJid(stanza.from()))) { warning(QStringLiteral("Recipient of group chat message does not match SCE affix element ''")); interface.finish(std::nullopt); return; } - } else if (sceEnvelopeReader.to() != recipientJid) { + } else if (sceEnvelopeReader.to() != QXmppUtils::jidToBareJid(stanza.to())) { q->info(QStringLiteral("Recipient of IQ does not match SCE affix element ''")); }