From 7bfb39fe1eb853a95929c16a2692cbb648d7387c Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Tue, 14 Mar 2023 23:17:55 +0100 Subject: Client: Don't fill empty 'to' attributes of outgoing IQs --- src/client/QXmppOutgoingClient.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/client/QXmppOutgoingClient.cpp') diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp index 20e88b9c..53c02e41 100644 --- a/src/client/QXmppOutgoingClient.cpp +++ b/src/client/QXmppOutgoingClient.cpp @@ -328,11 +328,8 @@ bool QXmppOutgoingClient::isStreamResumed() const /// QXmppTask QXmppOutgoingClient::sendIq(QXmppIq &&iq) { - // always set a to address (the QXmppStream needs this for matching) - if (iq.to().isEmpty()) { - iq.setTo(d->config.domain()); - } - return QXmppStream::sendIq(std::move(iq)); + auto to = iq.to(); + return QXmppStream::sendIq(std::move(iq), to.isEmpty() ? d->config.domain() : to); } void QXmppOutgoingClient::_q_socketDisconnected() -- cgit v1.2.3 From 98abdcac77c5fbf47ac955645995d9ff83c2a98b Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Tue, 14 Mar 2023 23:18:47 +0100 Subject: Client: Fix empty to in IQs is interpreted as server domain Empty to means account bare JID. --- src/client/QXmppOutgoingClient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/client/QXmppOutgoingClient.cpp') diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp index 53c02e41..4aaed0e7 100644 --- a/src/client/QXmppOutgoingClient.cpp +++ b/src/client/QXmppOutgoingClient.cpp @@ -328,8 +328,9 @@ bool QXmppOutgoingClient::isStreamResumed() const /// QXmppTask QXmppOutgoingClient::sendIq(QXmppIq &&iq) { + // If 'to' is empty the user's bare JID is meant implicitly (see RFC6120, section 10.3.3.). auto to = iq.to(); - return QXmppStream::sendIq(std::move(iq), to.isEmpty() ? d->config.domain() : to); + return QXmppStream::sendIq(std::move(iq), to.isEmpty() ? d->config.jidBare() : to); } void QXmppOutgoingClient::_q_socketDisconnected() -- cgit v1.2.3