aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppRosterIq.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-04-15 08:04:38 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-04-15 08:04:38 +0000
commitc0e76a9646b63f8135b6a4c5774c353fc7842c83 (patch)
treedc0943c64dddebfbff629e603d56d12f41a54b91 /source/QXmppRosterIq.cpp
parent9720d62c6d626fc8ef14e0fb1964ba8686e603b1 (diff)
downloadqxmpp-c0e76a9646b63f8135b6a4c5774c353fc7842c83.tar.gz
move QXmppRosterIq parsing out of QXmppStream
Diffstat (limited to 'source/QXmppRosterIq.cpp')
-rw-r--r--source/QXmppRosterIq.cpp31
1 files changed, 13 insertions, 18 deletions
diff --git a/source/QXmppRosterIq.cpp b/source/QXmppRosterIq.cpp
index 46fa6bc1..4ae4fa13 100644
--- a/source/QXmppRosterIq.cpp
+++ b/source/QXmppRosterIq.cpp
@@ -28,22 +28,6 @@
#include "QXmppConstants.h"
#include "QXmppUtils.h"
-QXmppRosterIq::QXmppRosterIq(QXmppIq::Type type)
- : QXmppIq(type)
-{
-
-}
-
-QXmppRosterIq::QXmppRosterIq(const QString& type)
- : QXmppIq(type)
-{
-}
-
-QXmppRosterIq::~QXmppRosterIq()
-{
-
-}
-
void QXmppRosterIq::addItem(const Item& item)
{
m_items.append(item);
@@ -54,6 +38,11 @@ QList<QXmppRosterIq::Item> QXmppRosterIq::items() const
return m_items;
}
+bool QXmppRosterIq::isRosterIq(const QDomElement &element)
+{
+ return (element.firstChildElement("query").namespaceURI() == ns_roster);
+}
+
void QXmppRosterIq::parse(const QDomElement &element)
{
QXmppStanza::parse(element);
@@ -71,8 +60,14 @@ void QXmppRosterIq::parse(const QDomElement &element)
itemElement.attribute("subscription"));
item.setSubscriptionStatus(
itemElement.attribute("ask"));
- item.addGroup(
- itemElement.firstChildElement("group").firstChildElement().text());
+
+ QDomElement groupElement = itemElement.firstChildElement("group");
+ while(!groupElement.isNull())
+ {
+ item.addGroup(groupElement.text());
+ groupElement = groupElement.nextSiblingElement("group");
+ }
+
m_items.append(item);
itemElement = itemElement.nextSiblingElement();
}