Skip to content

Commit

Permalink
Client: Fix SCE parsing mode of encrypted messages
Browse files Browse the repository at this point in the history
By mistake all elements of encrypted messages were parsed in some cases.
If a message is encrypted, only the ScePublic elements are parsed now.
  • Loading branch information
lnjX committed Aug 7, 2023
1 parent b2649ba commit 55c33c8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/client/QXmppClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,17 @@ bool process(QXmppClient *client, const QList<QXmppClientExtension *> &extension
return false;
}

bool process(QXmppClient *client, const QList<QXmppClientExtension *> &extensions, const QDomElement &element)
bool process(QXmppClient *client, const QList<QXmppClientExtension *> &extensions, QXmppE2eeExtension *e2eeExt, const QDomElement &element)
{
if (element.tagName() != "message") {
return false;
}
QXmppMessage message;
message.parse(element);
if (e2eeExt) {
message.parse(element, e2eeExt->isEncrypted(element) ? ScePublic : SceSensitive);
} else {
message.parse(element);
}
return process(client, extensions, std::move(message));
}

Expand Down Expand Up @@ -876,7 +880,7 @@ void QXmppClient::_q_elementReceived(const QDomElement &element, bool &handled)
// The stanza comes directly from the XMPP stream, so it's not end-to-end
// encrypted and there's no e2ee metadata (std::nullopt).
handled = StanzaPipeline::process(d->extensions, element, std::nullopt) ||
MessagePipeline::process(this, d->extensions, element);
MessagePipeline::process(this, d->extensions, d->encryptionExtension, element);
}

void QXmppClient::_q_reconnect()
Expand Down

0 comments on commit 55c33c8

Please sign in to comment.