aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppDiscoveryIq.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-10-16 21:54:40 +0200
committerLinus Jahn <lnj@kaidan.im>2022-10-17 16:26:03 +0200
commitc85c9c460907e26604554f1b2c6f54734bc8f303 (patch)
tree917fd8553b2606c141cc4ac0ba377e5ecf9eb242 /src/base/QXmppDiscoveryIq.cpp
parent556442eab0bdbd5b30a5fad3112d88c4b124ff5e (diff)
downloadqxmpp-c85c9c460907e26604554f1b2c6f54734bc8f303.tar.gz
Add checkIqType() function to IQs
This is required so they can be parsed just be specifying the type.
Diffstat (limited to 'src/base/QXmppDiscoveryIq.cpp')
-rw-r--r--src/base/QXmppDiscoveryIq.cpp11
1 files changed, 8 insertions, 3 deletions
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");