aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppRosterIq.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-04-15 08:21:39 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-04-15 08:21:39 +0000
commitfa8d7ed727b892aefb3fc4741c57e0466848b6da (patch)
treebd8d58fed06bf96c3000fa4763cd09c7a174f1b0 /source/QXmppRosterIq.cpp
parentc0e76a9646b63f8135b6a4c5774c353fc7842c83 (diff)
downloadqxmpp-fa8d7ed727b892aefb3fc4741c57e0466848b6da.tar.gz
make QXmppRosterIq::Item and QXmppRosterEntry APIs converge
Diffstat (limited to 'source/QXmppRosterIq.cpp')
-rw-r--r--source/QXmppRosterIq.cpp35
1 files changed, 16 insertions, 19 deletions
diff --git a/source/QXmppRosterIq.cpp b/source/QXmppRosterIq.cpp
index 4ae4fa13..320cb8bb 100644
--- a/source/QXmppRosterIq.cpp
+++ b/source/QXmppRosterIq.cpp
@@ -54,20 +54,7 @@ void QXmppRosterIq::parse(const QDomElement &element)
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"));
-
- QDomElement groupElement = itemElement.firstChildElement("group");
- while(!groupElement.isNull())
- {
- item.addGroup(groupElement.text());
- groupElement = groupElement.nextSiblingElement("group");
- }
-
+ item.parse(itemElement);
m_items.append(item);
itemElement = itemElement.nextSiblingElement();
}
@@ -134,11 +121,6 @@ void QXmppRosterIq::Item::setSubscriptionType(SubscriptionType type)
m_type = type;
}
-void QXmppRosterIq::Item::addGroup(const QString& str)
-{
- m_groups << str;
-}
-
QString QXmppRosterIq::Item::getSubscriptionTypeStr() const
{
switch(m_type)
@@ -181,6 +163,21 @@ void QXmppRosterIq::Item::setSubscriptionTypeFromStr(const QString& type)
qWarning("QXmppRosterIq::Item::setTypeFromStr(): invalid type");
}
+void QXmppRosterIq::Item::parse(const QDomElement &element)
+{
+ m_name = element.attribute("name");
+ m_bareJid = element.attribute("jid");
+ setSubscriptionTypeFromStr(element.attribute("subscription"));
+ setSubscriptionStatus(element.attribute("ask"));
+
+ QDomElement groupElement = element.firstChildElement("group");
+ while(!groupElement.isNull())
+ {
+ m_groups << groupElement.text();
+ groupElement = groupElement.nextSiblingElement("group");
+ }
+}
+
void QXmppRosterIq::Item::toXml(QXmlStreamWriter *writer) const
{
writer->writeStartElement("item");