QXmpp
Version:0.9.3
|
00001 /* 00002 * Copyright (C) 2008-2014 The QXmpp developers 00003 * 00004 * Author: 00005 * Jeremy Lainé 00006 * 00007 * Source: 00008 * https://github.com/qxmpp-project/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 00029 #include "QXmppGlobal.h" 00030 00033 class QXMPP_EXPORT QXmppPasswordRequest 00034 { 00035 public: 00037 enum Type { 00038 CheckPassword = 0 00039 }; 00040 00041 QString domain() const; 00042 void setDomain(const QString &domain); 00043 00044 QString password() const; 00045 void setPassword(const QString &password); 00046 00047 QString username() const; 00048 void setUsername(const QString &username); 00049 00050 private: 00051 QString m_domain; 00052 QString m_password; 00053 QString m_username; 00054 }; 00055 00058 class QXMPP_EXPORT QXmppPasswordReply : public QObject 00059 { 00060 Q_OBJECT 00061 00062 public: 00064 enum Error { 00065 NoError = 0, 00066 AuthorizationError, 00067 TemporaryError 00068 }; 00069 00070 QXmppPasswordReply(QObject *parent = 0); 00071 00072 QByteArray digest() const; 00073 void setDigest(const QByteArray &digest); 00074 00075 QString password() const; 00076 void setPassword(const QString &password); 00077 00078 QXmppPasswordReply::Error error() const; 00079 void setError(QXmppPasswordReply::Error error); 00080 00081 bool isFinished() const; 00082 00083 public slots: 00084 void finish(); 00085 void finishLater(); 00086 00087 signals: 00089 void finished(); 00090 00091 private: 00092 QByteArray m_digest; 00093 QString m_password; 00094 QXmppPasswordReply::Error m_error; 00095 bool m_isFinished; 00096 }; 00097 00100 00101 class QXMPP_EXPORT QXmppPasswordChecker 00102 { 00103 public: 00104 virtual QXmppPasswordReply *checkPassword(const QXmppPasswordRequest &request); 00105 virtual QXmppPasswordReply *getDigest(const QXmppPasswordRequest &request); 00106 virtual bool hasGetPassword() const; 00107 00108 protected: 00109 virtual QXmppPasswordReply::Error getPassword(const QXmppPasswordRequest &request, QString &password); 00110 }; 00111 00112 #endif