From c85c9c460907e26604554f1b2c6f54734bc8f303 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sun, 16 Oct 2022 21:54:40 +0200 Subject: Add checkIqType() function to IQs This is required so they can be parsed just be specifying the type. --- src/base/QXmppDiscoveryIq.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/base/QXmppDiscoveryIq.cpp') diff --git a/src/base/QXmppDiscoveryIq.cpp b/src/base/QXmppDiscoveryIq.cpp index 99860c9b..414a2d0f 100644 --- a/src/base/QXmppDiscoveryIq.cpp +++ b/src/base/QXmppDiscoveryIq.cpp @@ -433,12 +433,17 @@ QByteArray QXmppDiscoveryIq::verificationString() const /// bool QXmppDiscoveryIq::isDiscoveryIq(const QDomElement &element) { - QDomElement queryElement = element.firstChildElement("query"); - return (queryElement.namespaceURI() == ns_disco_info || - queryElement.namespaceURI() == ns_disco_items); + QDomElement queryElement = element.firstChildElement(); + return checkIqType(queryElement.tagName(), queryElement.namespaceURI()); } /// \cond +bool QXmppDiscoveryIq::checkIqType(const QString &tagName, const QString &xmlNamespace) +{ + return tagName == QStringLiteral("query") && + (xmlNamespace == ns_disco_info || xmlNamespace == ns_disco_items); +} + void QXmppDiscoveryIq::parseElementFromChild(const QDomElement &element) { QDomElement queryElement = element.firstChildElement("query"); -- cgit v1.2.3