diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-19 17:59:18 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-19 17:59:18 +0200 |
| commit | 48db05496f919870f381f5b6612e8a78a5c1ae62 (patch) | |
| tree | 4c0b77164d67f22d7dd462a61a0cb620444c1b2c /src/base | |
| parent | 8626bb00697e224231227c35c2df301b3dc8f6b2 (diff) | |
| download | qxmpp-48db05496f919870f381f5b6612e8a78a5c1ae62.tar.gz | |
move some classes to private header
Diffstat (limited to 'src/base')
| -rw-r--r-- | src/base/QXmppSaslAuth.cpp | 16 | ||||
| -rw-r--r-- | src/base/QXmppSaslAuth.h | 48 | ||||
| -rw-r--r-- | src/base/QXmppSaslAuth_p.h | 84 |
3 files changed, 102 insertions, 46 deletions
diff --git a/src/base/QXmppSaslAuth.cpp b/src/base/QXmppSaslAuth.cpp index b42d71fa..b3758873 100644 --- a/src/base/QXmppSaslAuth.cpp +++ b/src/base/QXmppSaslAuth.cpp @@ -28,6 +28,7 @@ #include <QUrl> #include "QXmppSaslAuth.h" +#include "QXmppSaslAuth_p.h" #include "QXmppUtils.h" class QXmppSaslClientPrivate @@ -48,6 +49,21 @@ QXmppSaslClient::~QXmppSaslClient() delete d; } +QXmppSaslClient* QXmppSaslClient::create(const QString &mechanism) +{ + if (mechanism == "PLAIN") { + return new QXmppSaslClientPlain; + } else if (mechanism == "DIGEST-MD5") { + return new QXmppSaslClientDigestMd5; + } else if (mechanism == "ANONYMOUS") { + return new QXmppSaslClientAnonymous; + } else if (mechanism == "X-FACEBOOK-PLATFORM") { + return new QXmppSaslClientFacebook; + } else { + return 0; + } +} + /// Returns the server. QString QXmppSaslClient::server() const diff --git a/src/base/QXmppSaslAuth.h b/src/base/QXmppSaslAuth.h index 1ae20a37..cb6fc467 100644 --- a/src/base/QXmppSaslAuth.h +++ b/src/base/QXmppSaslAuth.h @@ -94,54 +94,10 @@ public: virtual QString mechanism() const = 0; virtual bool respond(const QByteArray &challenge, QByteArray &response) = 0; -private: - QXmppSaslClientPrivate *d; -}; - -class QXmppSaslClientAnonymous : public QXmppSaslClient -{ -public: - QXmppSaslClientAnonymous(); - QString mechanism() const; - bool respond(const QByteArray &challenge, QByteArray &response); - -private: - int m_step; -}; - -class QXmppSaslClientDigestMd5 : public QXmppSaslClient -{ -public: - QXmppSaslClientDigestMd5(); - QString mechanism() const; - bool respond(const QByteArray &challenge, QByteArray &response); - -private: - QXmppSaslDigestMd5 m_saslDigest; - int m_step; -}; - -class QXmppSaslClientFacebook : public QXmppSaslClient -{ -public: - QXmppSaslClientFacebook(); - QString mechanism() const; - bool respond(const QByteArray &challenge, QByteArray &response); + static QXmppSaslClient* create(const QString &mechanism); private: - int m_step; -}; - -class QXmppSaslClientPlain : public QXmppSaslClient -{ -public: - QXmppSaslClientPlain(); - QString mechanism() const; - bool respond(const QByteArray &challenge, QByteArray &response); - -private: - int m_step; + QXmppSaslClientPrivate *d; }; - #endif diff --git a/src/base/QXmppSaslAuth_p.h b/src/base/QXmppSaslAuth_p.h new file mode 100644 index 00000000..eee93322 --- /dev/null +++ b/src/base/QXmppSaslAuth_p.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2008-2012 The QXmpp developers + * + * Authors: + * Manjeet Dahiya + * 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 QXMPPSASLAUTH_P_H +#define QXMPPSASLAUTH_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QXmpp API. It exists for the convenience +// of the QXmppSaslClient class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +class QXmppSaslClientAnonymous : public QXmppSaslClient +{ +public: + QXmppSaslClientAnonymous(); + QString mechanism() const; + bool respond(const QByteArray &challenge, QByteArray &response); + +private: + int m_step; +}; + +class QXmppSaslClientDigestMd5 : public QXmppSaslClient +{ +public: + QXmppSaslClientDigestMd5(); + QString mechanism() const; + bool respond(const QByteArray &challenge, QByteArray &response); + +private: + QXmppSaslDigestMd5 m_saslDigest; + int m_step; +}; + +class QXmppSaslClientFacebook : public QXmppSaslClient +{ +public: + QXmppSaslClientFacebook(); + QString mechanism() const; + bool respond(const QByteArray &challenge, QByteArray &response); + +private: + int m_step; +}; + +class QXmppSaslClientPlain : public QXmppSaslClient +{ +public: + QXmppSaslClientPlain(); + QString mechanism() const; + bool respond(const QByteArray &challenge, QByteArray &response); + +private: + int m_step; +}; + +#endif |
