From 024948b71f947c1b6c8b516b40dfdacdc647e2c9 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Wed, 10 Mar 2010 12:06:38 +0000 Subject: QXmppInformationRequestResult should inherit QXmppDiscoveryIq --- source/QXmppInformationRequestResult.cpp | 89 ++++++++++++-------------------- 1 file changed, 34 insertions(+), 55 deletions(-) (limited to 'source/QXmppInformationRequestResult.cpp') diff --git a/source/QXmppInformationRequestResult.cpp b/source/QXmppInformationRequestResult.cpp index f62a6571..c5e35dab 100644 --- a/source/QXmppInformationRequestResult.cpp +++ b/source/QXmppInformationRequestResult.cpp @@ -2,60 +2,39 @@ #include "QXmppConstants.h" #include -QXmppInformationRequestResult::QXmppInformationRequestResult() : QXmppIq(QXmppIq::Result) +QXmppInformationRequestResult::QXmppInformationRequestResult() { -} - -void QXmppInformationRequestResult::toXmlElementFromChild(QXmlStreamWriter *writer) const -{ - writer->writeStartElement("query"); - writer->writeAttribute("xmlns", ns_disco_info ); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_disco_info ); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_ibb ); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_rpc); - writer->writeEndElement(); - writer->writeStartElement("identity"); - writer->writeAttribute("category", "automation" ); - writer->writeAttribute("type", "rpc" ); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_ping); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_chat_states); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_stream_initiation); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_stream_initiation_file_transfer); - writer->writeEndElement(); - - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_bytestreams); - writer->writeEndElement(); - - // XEP-0092: Software Version - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_version); - writer->writeEndElement(); - - // XEP-0054: vcard-temp - writer->writeStartElement("feature"); - writer->writeAttribute("var", ns_vcard); - writer->writeEndElement(); - - writer->writeEndElement(); + setType(QXmppIq::Result); + setQueryType(QXmppDiscoveryIq::InfoQuery); + + QStringList features; + features + << ns_rpc // XEP-0009: Jabber-RPC + << ns_disco_info // XEP-0030: Service Discovery + << ns_ibb // XEP-0047: In-Band Bytestreams + << ns_vcard // XEP-0054: vcard-temp + << ns_bytestreams // XEP-0065: SOCKS5 Bytestreams + << ns_chat_states // XEP-0085: Chat State Notifications + << ns_version // XEP-0092: Software Version + << ns_stream_initiation // XEP-0095: Stream Initiation + << ns_stream_initiation_file_transfer // XEP-0096: SI File Transfer + << ns_ping; // XEP-0199: XMPP Ping + + // build query items + QList queryItems; + foreach (const QString &var, features) + { + QXmppElement feature; + feature.setTagName("feature"); + feature.setAttribute("var", var); + queryItems.append(feature); + } + + QXmppElement identity; + identity.setTagName("identity"); + identity.setAttribute("category", "automation"); + identity.setAttribute("type", "rpc"); + queryItems.append(identity); + + setQueryItems(queryItems); } -- cgit v1.2.3