aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-03-10 12:06:38 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-03-10 12:06:38 +0000
commit024948b71f947c1b6c8b516b40dfdacdc647e2c9 (patch)
treecdc94bc92e69a731d1dc770276f655d5fb283e6c /source
parentb4442cdcf163d96bbf0d893eddf59a5bee0c64b6 (diff)
downloadqxmpp-024948b71f947c1b6c8b516b40dfdacdc647e2c9.tar.gz
QXmppInformationRequestResult should inherit QXmppDiscoveryIq
Diffstat (limited to 'source')
-rw-r--r--source/QXmppInformationRequestResult.cpp89
-rw-r--r--source/QXmppInformationRequestResult.h5
2 files changed, 36 insertions, 58 deletions
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 <QXmlStreamWriter>
-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<QXmppElement> 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);
}
diff --git a/source/QXmppInformationRequestResult.h b/source/QXmppInformationRequestResult.h
index 56a22b83..9f4f440d 100644
--- a/source/QXmppInformationRequestResult.h
+++ b/source/QXmppInformationRequestResult.h
@@ -1,13 +1,12 @@
#ifndef QXMPPINFORMATIONREQUESTRESULT_H
#define QXMPPINFORMATIONREQUESTRESULT_H
-#include "QXmppIq.h"
+#include "QXmppDiscoveryIq.h"
-class QXmppInformationRequestResult : public QXmppIq
+class QXmppInformationRequestResult : public QXmppDiscoveryIq
{
public:
QXmppInformationRequestResult();
- virtual void toXmlElementFromChild(QXmlStreamWriter *writer) const;
};
#endif // QXMPPINFORMATIONREQUESTRESULT_H