aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppIq.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-02-18 12:38:47 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-02-18 12:38:47 +0000
commit1c594fa50ba7c3fc53fe0ab5a8175a6737e0f8a7 (patch)
tree1a70b57c23da8e2b9ae4acfc839c7be2dfa2b60b /source/QXmppIq.cpp
parent54576ab2d36c6736d3720fc4cfbcfc659c279e23 (diff)
downloadqxmpp-1c594fa50ba7c3fc53fe0ab5a8175a6737e0f8a7.tar.gz
use QXmppElementList and introduce QXmppIq::parse()
Diffstat (limited to 'source/QXmppIq.cpp')
-rw-r--r--source/QXmppIq.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/source/QXmppIq.cpp b/source/QXmppIq.cpp
index a28e6f8d..981ffeb7 100644
--- a/source/QXmppIq.cpp
+++ b/source/QXmppIq.cpp
@@ -25,6 +25,7 @@
#include "QXmppUtils.h"
#include "QXmppIq.h"
+#include <QDomElement>
#include <QXmlStreamWriter>
QXmppIq::QXmppIq(QXmppIq::Type type)
@@ -55,6 +56,20 @@ void QXmppIq::setType(QXmppIq::Type type)
m_type = type;
}
+void QXmppIq::parse( QDomElement &element )
+{
+ setFrom(element.attribute("from"));
+ setTo(element.attribute("to"));
+ setTypeFromStr(element.attribute("type"));
+
+ QDomElement itemElement = element.firstChildElement();
+ while (!itemElement.isNull())
+ {
+ m_items.append(QXmppElement(itemElement));
+ itemElement = itemElement.nextSiblingElement();
+ }
+}
+
void QXmppIq::toXml( QXmlStreamWriter *xmlWriter ) const
{
xmlWriter->writeStartElement("iq");
@@ -126,12 +141,12 @@ void QXmppIq::setTypeFromStr(const QString& str)
}
}
-QList<QXmppElement> QXmppIq::getItems() const
+QXmppElementList QXmppIq::getItems() const
{
return m_items;
}
-void QXmppIq::setItems(const QList<QXmppElement> &items)
+void QXmppIq::setItems(const QXmppElementList &items)
{
m_items = items;
}