aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppDiscoveryIq.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 08:16:59 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 08:16:59 +0000
commit4c8e3957e860becd0a473ac4b8f5c839a8b18c44 (patch)
treeb2afe0eda36a601f357de39d60ad8b7a6eb83115 /source/QXmppDiscoveryIq.cpp
parent1b2786d8020acecc94a82e7cd39dde5c28813f13 (diff)
downloadqxmpp-4c8e3957e860becd0a473ac4b8f5c839a8b18c44.tar.gz
add support for XEP-0128: Service Discovery Extensions (issue #59)
Diffstat (limited to 'source/QXmppDiscoveryIq.cpp')
-rw-r--r--source/QXmppDiscoveryIq.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/source/QXmppDiscoveryIq.cpp b/source/QXmppDiscoveryIq.cpp
index 866c82f7..f7a0cae5 100644
--- a/source/QXmppDiscoveryIq.cpp
+++ b/source/QXmppDiscoveryIq.cpp
@@ -153,6 +153,26 @@ void QXmppDiscoveryIq::setItems(const QList<QXmppDiscoveryIq::Item> &items)
m_items = items;
}
+/// Returns the QXmppDataForm for this IQ, as defined by
+/// XEP-0128: Service Discovery Extensions.
+///
+
+QXmppDataForm QXmppDiscoveryIq::form() const
+{
+ return m_form;
+}
+
+/// Sets the QXmppDataForm for this IQ, as define by
+/// XEP-0128: Service Discovery Extensions.
+///
+/// \param form
+///
+
+void QXmppDiscoveryIq::setForm(const QXmppDataForm &form)
+{
+ m_form = form;
+}
+
QString QXmppDiscoveryIq::queryNode() const
{
return m_queryNode;
@@ -213,20 +233,29 @@ void QXmppDiscoveryIq::parseElementFromChild(const QDomElement &element)
if (itemElement.tagName() == "feature")
{
m_features.append(itemElement.attribute("var"));
- } else if (itemElement.tagName() == "identity") {
+ }
+ else if (itemElement.tagName() == "identity")
+ {
QXmppDiscoveryIq::Identity identity;
identity.setLanguage(itemElement.attribute("xml:lang"));
identity.setCategory(itemElement.attribute("category"));
identity.setName(itemElement.attribute("name"));
identity.setType(itemElement.attribute("type"));
m_identities.append(identity);
- } else if (itemElement.tagName() == "item") {
+ }
+ else if (itemElement.tagName() == "item")
+ {
QXmppDiscoveryIq::Item item;
item.setJid(itemElement.attribute("jid"));
item.setName(itemElement.attribute("name"));
item.setNode(itemElement.attribute("node"));
m_items.append(item);
}
+ else if (itemElement.tagName() == "x" &&
+ itemElement.namespaceURI() == ns_data)
+ {
+ m_form.parse(itemElement);
+ }
itemElement = itemElement.nextSiblingElement();
}
}
@@ -264,6 +293,8 @@ void QXmppDiscoveryIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
writer->writeEndElement();
}
+ m_form.toXml(writer);
+
writer->writeEndElement();
}