QXmpp Version:0.3.91
QXmppPasswordChecker.h
00001 /*
00002  * Copyright (C) 2008-2011 The QXmpp developers
00003  *
00004  * Author:
00005  *  Jeremy Lainé
00006  *
00007  * Source:
00008  *  http://code.google.com/p/qxmpp
00009  *
00010  * This file is a part of QXmpp library.
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2.1 of the License, or (at your option) any later version.
00016  *
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Lesser General Public License for more details.
00021  *
00022  */
00023 
00024 #ifndef QXMPPPASSWORDCHECKER_H
00025 #define QXMPPPASSWORDCHECKER_H
00026 
00027 #include <QObject>
00028 
00031 class QXmppPasswordRequest
00032 {
00033 public:
00034     // This enum is used to describe request types.
00035     enum Type {
00036         CheckPassword = 0,
00037     };
00038 
00039     QString domain() const;
00040     void setDomain(const QString &domain);
00041 
00042     QString password() const;
00043     void setPassword(const QString &password);
00044 
00045     QString username() const;
00046     void setUsername(const QString &username);
00047 
00048 private:
00049     QString m_domain;
00050     QString m_password;
00051     QString m_username;
00052 };
00053 
00056 class QXmppPasswordReply : public QObject
00057 {
00058     Q_OBJECT
00059 
00060 public:
00062     enum Error {
00063         NoError = 0,
00064         AuthorizationError,
00065         TemporaryError,
00066     };
00067 
00068     QXmppPasswordReply(QObject *parent = 0);
00069 
00070     QByteArray digest() const;
00071     void setDigest(const QByteArray &digest);
00072 
00073     QString password() const;
00074     void setPassword(const QString &password);
00075 
00076     QXmppPasswordReply::Error error() const;
00077     void setError(QXmppPasswordReply::Error error);
00078 
00079     bool isFinished() const;
00080 
00081 public slots:
00082     void finish();
00083     void finishLater();
00084 
00085 signals:
00086     void finished();
00087 
00088 private:
00089     QByteArray m_digest;
00090     QString m_password;
00091     QXmppPasswordReply::Error m_error;
00092     bool m_isFinished;
00093 };
00094 
00097 
00098 class QXmppPasswordChecker
00099 {
00100 public:
00101     virtual QXmppPasswordReply *checkPassword(const QXmppPasswordRequest &request);
00102     virtual QXmppPasswordReply *getDigest(const QXmppPasswordRequest &request);
00103     virtual bool hasGetPassword() const;
00104 
00105 protected:
00106     virtual QXmppPasswordReply::Error getPassword(const QXmppPasswordRequest &request, QString &password);
00107 };
00108 
00109 #endif
 All Classes Functions Enumerations Enumerator Properties