modernize: Use '= default' instead of empty ctor/dtor bodies
[quassel.git] / src / core / sessionthread.h
index ee29d2e..e360754 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
  ***************************************************************************/
 
-#ifndef _SESSIONTHREAD_H_
-#define _SESSIONTHREAD_H_
+#pragma once
+
+#include <memory>
 
-#include <QMutex>
 #include <QThread>
 
 #include "types.h"
 
 class CoreSession;
-class QIODevice;
-
-class SessionThread : public QThread {
-  Q_OBJECT
-
-  public:
-    SessionThread(UserId user, QObject *parent = 0);
-    ~SessionThread();
+class Peer;
+class InternalPeer;
+class RemotePeer;
 
-    void run();
+class SessionThread : public QObject
+{
+    Q_OBJECT
 
-    CoreSession *session();
-    UserId user();
+public:
+    SessionThread(UserId user, bool restoreState, bool strictIdentEnabled, QObject *parent = nullptr);
+    ~SessionThread() override;
 
-  public slots:
-    void addClient(QIODevice *socket);
+public slots:
+    void addClient(Peer *peer);
+    void shutdown();
 
-  private slots:
-    void setSessionInitialized();
+private slots:
+    void onSessionInitialized();
+    void onSessionDestroyed();
 
-  signals:
+signals:
     void initialized();
+    void shutdownSession();
+    void shutdownComplete(SessionThread *);
 
-  private:
-    CoreSession *_session;
-    UserId _user;
-    QList<QIODevice *> clientQueue;
-    bool _sessionInitialized;
+    void addClientToWorker(Peer *peer);
 
-    bool isSessionInitialized();
-    void addClientToSession(QIODevice *socket);
-};
+private:
+    QThread _sessionThread;
+    bool _sessionInitialized{false};
 
-#endif
+    std::vector<Peer *> _clientQueue;
+};