aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-06-07 11:01:16 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-06-07 11:01:16 +0000
commit5095697943a9d8fd7c9d875b0be842ae099c669b (patch)
tree659620d8c1f4da57df241c57b87353c53372c3f2 /source
parent68b8fe4dfe76e7873b9ec65fbe4fda3df92f8a34 (diff)
downloadqxmpp-5095697943a9d8fd7c9d875b0be842ae099c669b.tar.gz
add QXmppMucIq class for multi-user chat room configuration
Diffstat (limited to 'source')
-rw-r--r--source/QXmppMucIq.cpp62
-rw-r--r--source/QXmppMucIq.h50
-rw-r--r--source/source.pro2
3 files changed, 114 insertions, 0 deletions
diff --git a/source/QXmppMucIq.cpp b/source/QXmppMucIq.cpp
new file mode 100644
index 00000000..d33e1c41
--- /dev/null
+++ b/source/QXmppMucIq.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Bolloré telecom
+ *
+ * Author:
+ * Jeremy Lainé
+ *
+ * Source:
+ * http://code.google.com/p/qxmpp
+ *
+ * This file is a part of QXmpp library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#include <QDomElement>
+
+#include "QXmppConstants.h"
+#include "QXmppMucIq.h"
+#include "QXmppUtils.h"
+
+QXmppDataForm QXmppMucOwnerIq::form() const
+{
+ return m_form;
+}
+
+void QXmppMucOwnerIq::setForm(const QXmppDataForm &form)
+{
+ m_form = form;
+}
+
+bool QXmppMucOwnerIq::isMucOwnerIq(const QDomElement &element)
+{
+ QDomElement queryElement = element.firstChildElement("query");
+ return (queryElement.namespaceURI() == ns_muc_owner);
+}
+
+void QXmppMucOwnerIq::parse(const QDomElement &element)
+{
+ QXmppStanza::parse(element);
+ setTypeFromStr(element.attribute("type"));
+
+ QDomElement queryElement = element.firstChildElement("query");
+ m_form.parse(queryElement.firstChildElement("x"));
+}
+
+void QXmppMucOwnerIq::toXmlElementFromChild(QXmlStreamWriter *writer) const
+{
+ writer->writeStartElement("query");
+ helperToXmlAddAttribute(writer, "xmlns", ns_muc_owner);
+ m_form.toXml(writer);
+ writer->writeEndElement();
+}
+
diff --git a/source/QXmppMucIq.h b/source/QXmppMucIq.h
new file mode 100644
index 00000000..fb22c93f
--- /dev/null
+++ b/source/QXmppMucIq.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 Bolloré telecom
+ *
+ * Author:
+ * Jeremy Lainé
+ *
+ * Source:
+ * http://code.google.com/p/qxmpp
+ *
+ * This file is a part of QXmpp library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ */
+
+#ifndef QXMPPMUCIQ_H
+#define QXMPPMUCIQ_H
+
+#include "QXmppDataForm.h"
+#include "QXmppIq.h"
+
+/// \brief The QXmppClient class represents a chat room configuration IQ as
+/// defined by XEP-0045: Multi-User Chat.
+///
+/// \sa QXmppDataForm
+///
+
+class QXmppMucOwnerIq : public QXmppIq
+{
+public:
+ QXmppDataForm form() const;
+ void setForm(const QXmppDataForm &form);
+
+ static bool isMucOwnerIq(const QDomElement &element);
+ void parse(const QDomElement &element);
+ void toXmlElementFromChild(QXmlStreamWriter *writer) const;
+
+private:
+ QXmppDataForm m_form;
+};
+
+#endif
diff --git a/source/source.pro b/source/source.pro
index d2d513d6..82a26e24 100644
--- a/source/source.pro
+++ b/source/source.pro
@@ -34,6 +34,7 @@ HEADERS += QXmppUtils.h \
QXmppIq.h \
QXmppLogger.h \
QXmppMessage.h \
+ QXmppMucIq.h \
QXmppNonSASLAuth.h \
QXmppPacket.h \
QXmppPingIq.h \
@@ -72,6 +73,7 @@ SOURCES += QXmppUtils.cpp \
QXmppIq.cpp \
QXmppLogger.cpp \
QXmppMessage.cpp \
+ QXmppMucIq.cpp \
QXmppNonSASLAuth.cpp \
QXmppPacket.cpp \
QXmppPingIq.cpp \