diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-03-27 08:22:34 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-03-27 08:22:34 +0000 |
| commit | a8da198b500c5c7da490b9ccd7f0d039c5e0f722 (patch) | |
| tree | d40a1892619e79b90a5f7b9ea4cea32e79233e8e /src | |
| parent | 494ea46f004f493b1158b545c679b8e8d80abdec (diff) | |
| download | qxmpp-a8da198b500c5c7da490b9ccd7f0d039c5e0f722.tar.gz | |
remove server plugins, they don't belong in a library
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/QXmppServer.cpp | 3 | ||||
| -rw-r--r-- | src/server/mod_disco.cpp | 129 | ||||
| -rw-r--r-- | src/server/mod_disco.h | 54 | ||||
| -rw-r--r-- | src/server/mod_time.cpp | 93 | ||||
| -rw-r--r-- | src/server/mod_time.h | 42 | ||||
| -rw-r--r-- | src/server/mod_version.cpp | 87 | ||||
| -rw-r--r-- | src/server/mod_version.h | 42 | ||||
| -rw-r--r-- | src/server/server.pri | 10 |
8 files changed, 1 insertions, 459 deletions
diff --git a/src/server/QXmppServer.cpp b/src/server/QXmppServer.cpp index 852b6a64..f4d99848 100644 --- a/src/server/QXmppServer.cpp +++ b/src/server/QXmppServer.cpp @@ -44,10 +44,7 @@ #include "mod_presence.h" // Core plugins -Q_IMPORT_PLUGIN(mod_disco) Q_IMPORT_PLUGIN(mod_presence) -Q_IMPORT_PLUGIN(mod_time) -Q_IMPORT_PLUGIN(mod_version) class QXmppServerPrivate { diff --git a/src/server/mod_disco.cpp b/src/server/mod_disco.cpp deleted file mode 100644 index 61caf5dc..00000000 --- a/src/server/mod_disco.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * 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 <QCoreApplication> -#include <QDomElement> - -#include "QXmppConstants.h" -#include "QXmppDiscoveryIq.h" -#include "QXmppServer.h" -#include "QXmppServerPlugin.h" -#include "QXmppStream.h" - -#include "mod_disco.h" - -QStringList QXmppServerDiscovery::items() const -{ - return m_discoveryItems; -} - -void QXmppServerDiscovery::setItems(const QStringList &items) -{ - m_discoveryItems = items; -} - -QStringList QXmppServerDiscovery::discoveryFeatures() const -{ - return QStringList() << ns_disco_info << ns_disco_items; -} - -QStringList QXmppServerDiscovery::discoveryItems() const -{ - return m_discoveryItems; -} - -bool QXmppServerDiscovery::handleStanza(const QDomElement &element) -{ - if (element.attribute("to") != server()->domain()) - return false; - - // XEP-0030: Service Discovery - const QString type = element.attribute("type"); - if (element.tagName() == "iq" && QXmppDiscoveryIq::isDiscoveryIq(element) && type == "get") - { - QXmppDiscoveryIq request; - request.parse(element); - - QXmppDiscoveryIq response; - response.setType(QXmppIq::Result); - response.setId(request.id()); - response.setFrom(request.to()); - response.setTo(request.from()); - response.setQueryType(request.queryType()); - - if (request.queryType() == QXmppDiscoveryIq::ItemsQuery) - { - QList<QXmppDiscoveryIq::Item> items; - foreach (QXmppServerExtension *extension, server()->extensions()) - { - foreach (const QString &jid, extension->discoveryItems()) - { - QXmppDiscoveryIq::Item item; - item.setJid(jid); - items.append(item); - } - } - response.setItems(items); - } else { - // identities - QList<QXmppDiscoveryIq::Identity> identities; - QXmppDiscoveryIq::Identity identity; - identity.setCategory("server"); - identity.setType("im"); - identity.setName(qApp->applicationName()); - identities.append(identity); - response.setIdentities(identities); - - // features - QStringList features; - foreach (QXmppServerExtension *extension, server()->extensions()) - features += extension->discoveryFeatures(); - response.setFeatures(features); - } - server()->sendPacket(response); - return true; - } - return false; -} - -// PLUGIN - -class QXmppServerDiscoveryPlugin : public QXmppServerPlugin -{ -public: - QXmppServerExtension *create(const QString &key) - { - if (key == QLatin1String("ping")) - return new QXmppServerDiscovery; - else - return 0; - }; - - QStringList keys() const - { - return QStringList() << QLatin1String("ping"); - }; -}; - -Q_EXPORT_STATIC_PLUGIN2(mod_disco, QXmppServerDiscoveryPlugin) - diff --git a/src/server/mod_disco.h b/src/server/mod_disco.h deleted file mode 100644 index 41791cf7..00000000 --- a/src/server/mod_disco.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * 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 QXMPP_SERVER_DISCO_H -#define QXMPP_SERVER_DISCO_H - -#include <QStringList> - -#include "QXmppServerExtension.h" - -/// \brief QXmppServer extension for XEP-0030: Service Discovery. -/// - -class QXmppServerDiscovery : public QXmppServerExtension -{ - Q_OBJECT - Q_CLASSINFO("ExtensionName", "disco"); - Q_PROPERTY(QStringList items READ items WRITE setItems); - -public: - QStringList items() const; - void setItems(const QStringList &items); - - /// \cond - QStringList discoveryFeatures() const; - QStringList discoveryItems() const; - bool handleStanza(const QDomElement &element); - /// \endcond - -private: - QStringList m_discoveryItems; -}; - -#endif diff --git a/src/server/mod_time.cpp b/src/server/mod_time.cpp deleted file mode 100644 index ec535662..00000000 --- a/src/server/mod_time.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * 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 <QCoreApplication> -#include <QDomElement> - -#include "QXmppConstants.h" -#include "QXmppEntityTimeIq.h" -#include "QXmppServer.h" -#include "QXmppServerPlugin.h" -#include "QXmppStream.h" - -#include "mod_time.h" - -QStringList QXmppServerTime::discoveryFeatures() const -{ - return QStringList() << ns_entity_time; -} - -bool QXmppServerTime::handleStanza(const QDomElement &element) -{ - if (element.attribute("to") != server()->domain()) - return false; - - // XEP-0202: Entity Time - if(QXmppEntityTimeIq::isEntityTimeIq(element)) - { - QXmppEntityTimeIq timeIq; - timeIq.parse(element); - - if (timeIq.type() == QXmppIq::Get) - { - QXmppEntityTimeIq responseIq; - responseIq.setType(QXmppIq::Result); - responseIq.setId(timeIq.id()); - responseIq.setTo(timeIq.from()); - - QDateTime currentTime = QDateTime::currentDateTime(); - QDateTime utc = currentTime.toUTC(); - responseIq.setUtc(utc); - - currentTime.setTimeSpec(Qt::UTC); - responseIq.setTzo(utc.secsTo(currentTime)); - - server()->sendPacket(responseIq); - } - return true; - } - - return false; -} - -// PLUGIN - -class QXmppServerTimePlugin : public QXmppServerPlugin -{ -public: - QXmppServerExtension *create(const QString &key) - { - if (key == QLatin1String("time")) - return new QXmppServerTime; - else - return 0; - }; - - QStringList keys() const - { - return QStringList() << QLatin1String("time"); - }; -}; - -Q_EXPORT_STATIC_PLUGIN2(mod_time, QXmppServerTimePlugin) - diff --git a/src/server/mod_time.h b/src/server/mod_time.h deleted file mode 100644 index 2935ac49..00000000 --- a/src/server/mod_time.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * 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 QXMPP_SERVER_TIME_H -#define QXMPP_SERVER_TIME_H - -#include "QXmppServerExtension.h" - -/// \brief QXmppServer extension for XEP-0202: Entity Time. -/// - -class QXmppServerTime : public QXmppServerExtension -{ - Q_OBJECT - Q_CLASSINFO("ExtensionName", "time"); - -public: - QStringList discoveryFeatures() const; - bool handleStanza(const QDomElement &element); -}; - -#endif diff --git a/src/server/mod_version.cpp b/src/server/mod_version.cpp deleted file mode 100644 index 500bd173..00000000 --- a/src/server/mod_version.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * 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 <QCoreApplication> -#include <QDomElement> - -#include "QXmppConstants.h" -#include "QXmppVersionIq.h" -#include "QXmppServer.h" -#include "QXmppServerPlugin.h" -#include "QXmppStream.h" - -#include "mod_version.h" - -QStringList QXmppServerVersion::discoveryFeatures() const -{ - return QStringList() << ns_version; -} - -bool QXmppServerVersion::handleStanza(const QDomElement &element) -{ - if (element.attribute("to") != server()->domain()) - return false; - - // XEP-0092: Software Version - if(QXmppVersionIq::isVersionIq(element)) - { - QXmppVersionIq versionIq; - versionIq.parse(element); - - if (versionIq.type() == QXmppIq::Get) - { - QXmppVersionIq responseIq; - responseIq.setType(QXmppIq::Result); - responseIq.setId(versionIq.id()); - responseIq.setTo(versionIq.from()); - responseIq.setName(qApp->applicationName()); - responseIq.setVersion(qApp->applicationVersion()); - server()->sendPacket(responseIq); - } - return true; - } - - return false; -} - -// PLUGIN - -class QXmppServerVersionPlugin : public QXmppServerPlugin -{ -public: - QXmppServerExtension *create(const QString &key) - { - if (key == QLatin1String("version")) - return new QXmppServerVersion; - else - return 0; - }; - - QStringList keys() const - { - return QStringList() << QLatin1String("version"); - }; -}; - -Q_EXPORT_STATIC_PLUGIN2(mod_version, QXmppServerVersionPlugin) - diff --git a/src/server/mod_version.h b/src/server/mod_version.h deleted file mode 100644 index 4dd1ace7..00000000 --- a/src/server/mod_version.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2008-2011 The QXmpp developers - * - * 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 QXMPP_SERVER_VERSION_H -#define QXMPP_SERVER_VERSION_H - -#include "QXmppServerExtension.h" - -/// \brief QXmppServer extension for XEP-0092: Software Version. -/// - -class QXmppServerVersion : public QXmppServerExtension -{ - Q_OBJECT - Q_CLASSINFO("ExtensionName", "version"); - -public: - QStringList discoveryFeatures() const; - bool handleStanza(const QDomElement &element); -}; - -#endif diff --git a/src/server/server.pri b/src/server/server.pri index db854eb0..604cb5c4 100644 --- a/src/server/server.pri +++ b/src/server/server.pri @@ -21,12 +21,4 @@ SOURCES += \ server/QXmppServerExtension.cpp # Plugins -HEADERS += \ - server/mod_disco.h \ - server/mod_time.h \ - server/mod_version.h -SOURCES += \ - server/mod_disco.cpp \ - server/mod_presence.cpp \ - server/mod_time.cpp \ - server/mod_version.cpp +SOURCES += server/mod_presence.cpp |
