abstractroster.cpp   abstractroster.cpp 
skipping to change at line 36 skipping to change at line 36
#include "abstractroster_p.h" #include "abstractroster_p.h"
#include "client.h" #include "client.h"
#include "jstrings.h" #include "jstrings.h"
#include "iq.h" #include "iq.h"
#include "client_p.h" #include "client_p.h"
#include "jid.h" #include "jid.h"
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include "logger.h" #include "logger.h"
#include "util.h" #include "util.h"
#define NS_ROSTER QLatin1String("jabber:iq:roster")
namespace Jreen namespace Jreen
{ {
static const char *subscription_types[] = { static const char *subscription_types[] = {
"from", "from",
"to", "to",
"both", "both",
"remove", "remove",
"none" "none"
}; };
skipping to change at line 58 skipping to change at line 60
AbstractRosterQueryFactory::AbstractRosterQueryFactory(AbstractRoster *rost er) AbstractRosterQueryFactory::AbstractRosterQueryFactory(AbstractRoster *rost er)
{ {
m_roster = roster; m_roster = roster;
m_state = AtStart; m_state = AtStart;
m_depth = 0; m_depth = 0;
} }
QStringList AbstractRosterQueryFactory::features() const QStringList AbstractRosterQueryFactory::features() const
{ {
return QStringList(QLatin1String("jabber:iq:roster")); return QStringList(NS_ROSTER);
} }
bool AbstractRosterQueryFactory::canParse(const QStringRef &name, const QSt ringRef &uri, const QXmlStreamAttributes &attributes) bool AbstractRosterQueryFactory::canParse(const QStringRef &name, const QSt ringRef &uri, const QXmlStreamAttributes &attributes)
{ {
Q_UNUSED(attributes); Q_UNUSED(attributes);
return name == QLatin1String("query") && uri == QLatin1String("jabbe r:iq:roster"); return name == QLatin1String("query") && uri == NS_ROSTER;
} }
void AbstractRosterQueryFactory::handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes) void AbstractRosterQueryFactory::handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes)
{ {
Q_UNUSED(uri); Q_UNUSED(uri);
m_depth++; m_depth++;
if (m_depth == 1) { if (m_depth == 1) {
m_items.clear(); m_items.clear();
m_ver = attributes.value(QLatin1String("ver")).toString(); m_ver = attributes.value(QLatin1String("ver")).toString();
m_state = AtQuery; m_state = AtQuery;
skipping to change at line 122 skipping to change at line 124
if (m_depth == 3 && m_state == AtGroup) if (m_depth == 3 && m_state == AtGroup)
m_groups << text.toString(); m_groups << text.toString();
} }
void AbstractRosterQueryFactory::serialize(Payload *extension, QXmlStreamWr iter *writer) void AbstractRosterQueryFactory::serialize(Payload *extension, QXmlStreamWr iter *writer)
{ {
AbstractRosterQuery *query = se_cast<AbstractRosterQuery*>(extension ); AbstractRosterQuery *query = se_cast<AbstractRosterQuery*>(extension );
if (!query) if (!query)
return; return;
writer->writeStartElement(QLatin1String("query")); writer->writeStartElement(QLatin1String("query"));
writer->writeDefaultNamespace(QLatin1String("jabber:iq:roster")); writer->writeDefaultNamespace(NS_ROSTER);
if (query->items().isEmpty()) if (query->items().isEmpty())
writer->writeAttribute(QLatin1String("ver"), query->ver()); writer->writeAttribute(QLatin1String("ver"), query->ver());
foreach (const RosterItem::Ptr &item, query->items()) { foreach (const RosterItem::Ptr &item, query->items()) {
writer->writeStartElement(QLatin1String("item")); writer->writeStartElement(QLatin1String("item"));
writeAttribute(writer,QLatin1String("name"), item->name()); writeAttribute(writer,QLatin1String("name"), item->name());
writer->writeAttribute(QLatin1String("jid"), item->jid()); writer->writeAttribute(QLatin1String("jid"), item->jid());
writer->writeAttribute(QLatin1String("ask"), item->ask()); writer->writeAttribute(QLatin1String("ask"), item->ask());
writeAttribute(writer,QLatin1String("subscription"),enumToSt r(item->subscription(),subscription_types)); writeAttribute(writer,QLatin1String("subscription"),enumToSt r(item->subscription(),subscription_types));
foreach (const QString &group, item->groups()) foreach (const QString &group, item->groups())
writer->writeTextElement(QLatin1String("group"), gro up); writer->writeTextElement(QLatin1String("group"), gro up);
 End of changes. 4 change blocks. 
3 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/