1 /***************************************************************************
2 * Copyright (C) 2005-2014 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef CLIENTAUTHHANDLER_H
22 #define CLIENTAUTHHANDLER_H
24 #include "compressor.h"
25 #include "authhandler.h"
26 #include "coreaccount.h"
32 class ClientAuthHandler : public AuthHandler
37 ClientAuthHandler(CoreAccount account, QObject *parent = 0);
42 void login(const QString &previousError = QString());
43 void login(const QString &user, const QString &password, bool remember);
44 void setupCore(const Protocol::SetupData &setupData);
47 void statusMessage(const QString &message);
48 void errorMessage(const QString &message);
49 void errorPopup(const QString &message);
50 void transferProgress(int current, int max);
52 void requestDisconnect(const QString &errorString = QString(), bool wantReconnect = false);
54 void connectionReady();
55 void loginSuccessful(const CoreAccount &account);
56 void handshakeComplete(RemotePeer *peer, const Protocol::SessionState &sessionState);
58 // These signals MUST be handled synchronously!
59 void userAuthenticationRequired(CoreAccount *account, bool *valid, const QString &errorMessage = QString());
60 void handleNoSslInClient(bool *accepted);
61 void handleNoSslInCore(bool *accepted);
63 void handleSslErrors(const QSslSocket *socket, bool *accepted, bool *permanently);
66 void encrypted(bool isEncrypted = true);
67 void startCoreSetup(const QVariantList &backendInfo);
68 void coreSetupSuccessful();
69 void coreSetupFailed(const QString &error);
72 using AuthHandler::handle;
74 void handle(const Protocol::ClientDenied &msg);
75 void handle(const Protocol::ClientRegistered &msg);
76 void handle(const Protocol::SetupFailed &msg);
77 void handle(const Protocol::SetupDone &msg);
78 void handle(const Protocol::LoginFailed &msg);
79 void handle(const Protocol::LoginSuccess &msg);
80 void handle(const Protocol::SessionState &msg);
82 void setPeer(RemotePeer *peer);
83 void checkAndEnableSsl(bool coreSupportsSsl);
84 void startRegistration();
87 void onSocketConnected();
88 void onSocketStateChanged(QAbstractSocket::SocketState state);
89 void onSocketError(QAbstractSocket::SocketError);
90 void onSocketDisconnected();
94 void onSslSocketEncrypted();
98 void onProtocolVersionMismatch(int actual, int expected);
100 void onConnectionReady();
104 bool _coreConfigured;
105 QVariantList _backendInfo;
106 CoreAccount _account;
109 quint8 _connectionFeatures;