modernize: Use raw string literals instead of escaped strings
[quassel.git] / src / common / authhandler.h
index 4f06840..0d30e66 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2013 by the Quassel Project                        *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -18,8 +18,9 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef AUTHHANDLER_H
-#define AUTHHANDLER_H
+#pragma once
+
+#include "common-export.h"
 
 #include <QTcpSocket>
 
 
 class Peer;
 
-class AuthHandler : public QObject
+class COMMON_EXPORT AuthHandler : public QObject
 {
     Q_OBJECT
 
 public:
-    enum State {
-        UnconnectedState,
-        HostLookupState,
-        ConnectingState,
-        ConnectedState,
-        RetryWithLegacyState,
-        AuthenticatingState,
-        AuthenticatedState,
-        ClosingState
-    };
-
-    AuthHandler(QObject *parent = 0);
-
-    State state() const;
+    AuthHandler(QObject *parent = nullptr);
+
     QTcpSocket *socket() const;
 
+    bool isLocal() const;
+
     virtual void handle(const Protocol::RegisterClient &) { invalidMessage(); }
     virtual void handle(const Protocol::ClientDenied &) { invalidMessage(); }
     virtual void handle(const Protocol::ClientRegistered &) { invalidMessage(); }
@@ -67,26 +58,19 @@ public slots:
     void close();
 
 signals:
-    void stateChanged(State state);
     void disconnected();
-
-    void socketStateChanged(QAbstractSocket::SocketState state);
     void socketError(QAbstractSocket::SocketError error, const QString &errorString);
 
 protected:
     void setSocket(QTcpSocket *socket);
-    void setState(State state);
 
-private slots:
-    void onSocketError(QAbstractSocket::SocketError error);
-    void onSocketDisconnected();
+protected slots:
+    virtual void onSocketError(QAbstractSocket::SocketError error);
+    virtual void onSocketDisconnected();
 
 private:
     void invalidMessage();
 
-    State _state;
-    QTcpSocket *_socket; // FIXME: should be a QSharedPointer? -> premature disconnect before the peer has taken over
-    bool _disconnectedSent;
+    QTcpSocket *_socket{nullptr}; // FIXME: should be a QSharedPointer? -> premature disconnect before the peer has taken over
+    bool _disconnectedSent{false};
 };
-
-#endif