aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppRosterIq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/QXmppRosterIq.cpp')
-rw-r--r--source/QXmppRosterIq.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/QXmppRosterIq.cpp b/source/QXmppRosterIq.cpp
index 1c5a4997..46fa6bc1 100644
--- a/source/QXmppRosterIq.cpp
+++ b/source/QXmppRosterIq.cpp
@@ -21,11 +21,12 @@
*
*/
+#include <QDomElement>
+#include <QXmlStreamWriter>
#include "QXmppRosterIq.h"
#include "QXmppConstants.h"
#include "QXmppUtils.h"
-#include <QXmlStreamWriter>
QXmppRosterIq::QXmppRosterIq(QXmppIq::Type type)
: QXmppIq(type)
@@ -53,6 +54,30 @@ QList<QXmppRosterIq::Item> QXmppRosterIq::items() const
return m_items;
}
+void QXmppRosterIq::parse(const QDomElement &element)
+{
+ QXmppStanza::parse(element);
+ setTypeFromStr(element.attribute("type"));
+
+ QDomElement itemElement = element.
+ firstChildElement("query").
+ firstChildElement("item");
+ while(!itemElement.isNull())
+ {
+ QXmppRosterIq::Item item;
+ item.setName(itemElement.attribute("name"));
+ item.setBareJid(itemElement.attribute("jid"));
+ item.setSubscriptionTypeFromStr(
+ itemElement.attribute("subscription"));
+ item.setSubscriptionStatus(
+ itemElement.attribute("ask"));
+ item.addGroup(
+ itemElement.firstChildElement("group").firstChildElement().text());
+ m_items.append(item);
+ itemElement = itemElement.nextSiblingElement();
+ }
+}
+
void QXmppRosterIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
{
writer->writeStartElement("query");