1
by Vsevolod Velichko
Import upstream version 1.1.0 |
1 |
/****************************************************************************
|
2 |
**
|
|
3 |
** Jreen
|
|
4 |
**
|
|
5 |
** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
|
|
6 |
**
|
|
7 |
*****************************************************************************
|
|
8 |
**
|
|
9 |
** $JREEN_BEGIN_LICENSE$
|
|
10 |
** This program is free software: you can redistribute it and/or modify
|
|
11 |
** it under the terms of the GNU General Public License as published by
|
|
12 |
** the Free Software Foundation, either version 2 of the License, or
|
|
13 |
** (at your option) any later version.
|
|
14 |
**
|
|
15 |
** This program is distributed in the hope that it will be useful,
|
|
16 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
18 |
** See the GNU General Public License for more details.
|
|
19 |
**
|
|
20 |
** You should have received a copy of the GNU General Public License
|
|
21 |
** along with this program. If not, see http://www.gnu.org/licenses/.
|
|
22 |
** $JREEN_END_LICENSE$
|
|
23 |
**
|
|
24 |
****************************************************************************/
|
|
25 |
||
26 |
#ifndef NONSASLAUTH_H
|
|
27 |
#define NONSASLAUTH_H
|
|
28 |
||
29 |
#include "streamfeature_p.h" |
|
30 |
#include "stanzaextension.h" |
|
31 |
||
32 |
namespace Jreen |
|
33 |
{
|
|
34 |
||
35 |
class IQ; |
|
36 |
||
37 |
class JREEN_EXPORT NonSaslAuth : public QObject, public StreamFeature |
|
38 |
{
|
|
39 |
J_FEATURE("/stream:features/auth[@xmlns='http://jabber.org/features/iq-auth']") |
|
40 |
Q_OBJECT
|
|
41 |
public: |
|
42 |
enum Step |
|
43 |
{
|
|
44 |
RequestFields, |
|
45 |
ProvideInformation, |
|
46 |
WaitingForResults, |
|
47 |
Completed
|
|
48 |
};
|
|
49 |
NonSaslAuth(); |
|
50 |
int priority() { return 10; } |
|
51 |
void setStreamInfo(StreamInfo *info); |
|
52 |
void reset(); |
|
53 |
bool canParse(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); |
|
54 |
void handleStartElement(const QStringRef &name, const QStringRef &uri, const QXmlStreamAttributes &attributes); |
|
55 |
void handleEndElement(const QStringRef &name, const QStringRef &uri); |
|
56 |
void handleCharacterData(const QStringRef &text); |
|
57 |
bool isActivatable(); |
|
58 |
bool activate(); |
|
59 |
public slots: |
|
60 |
void handleIq(const IQ &iq, int context); |
|
61 |
private: |
|
62 |
class Query : public Payload |
|
63 |
{
|
|
64 |
J_PAYLOAD(Jreen::NonSaslAuth::Query) |
|
65 |
public: |
|
66 |
Query(); |
|
67 |
Query *instance(const JID &jid, const QString &password, const QString &sid) const; |
|
68 |
private: |
|
69 |
QString m_username; |
|
70 |
QString m_password; |
|
71 |
QString m_resource; |
|
72 |
bool m_is_digest; |
|
73 |
};
|
|
74 |
Step m_current_step; |
|
75 |
};
|
|
76 |
||
77 |
}
|
|
78 |
||
79 |
#endif // NONSASLAUTH_H |