Fixes #682 - Core crashes on client connection
[quassel.git] / src / core / core.h
index fd67fa8..c1f397a 100644 (file)
@@ -51,8 +51,8 @@ class AbstractSqlMigrationWriter;
 class Core : public QObject {
   Q_OBJECT
 
 class Core : public QObject {
   Q_OBJECT
 
-  public:
-  static Core * instance();
+public:
+  static Core *instance();
   static void destroy();
 
   static void saveState();
   static void destroy();
 
   static void saveState();
@@ -382,12 +382,15 @@ class Core : public QObject {
 
   static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; }
 
 
   static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; }
 
+  static const int AddClientEventId;
+
 public slots:
   //! Make storage data persistent
   /** \note This method is threadsafe.
    */
   void syncStorage();
   void setupInternalClientSession(SignalProxy *proxy);
 public slots:
   //! Make storage data persistent
   /** \note This method is threadsafe.
    */
   void syncStorage();
   void setupInternalClientSession(SignalProxy *proxy);
+
 signals:
   //! Sent when a BufferInfo is updated in storage.
   void bufferInfoUpdated(UserId user, const BufferInfo &info);
 signals:
   //! Sent when a BufferInfo is updated in storage.
   void bufferInfoUpdated(UserId user, const BufferInfo &info);
@@ -395,6 +398,9 @@ signals:
   //! Relay From CoreSession::sessionState(const QVariant &). Used for internal connection only
   void sessionState(const QVariant &);
 
   //! Relay From CoreSession::sessionState(const QVariant &). Used for internal connection only
   void sessionState(const QVariant &);
 
+protected:
+  virtual void customEvent(QEvent *event);
+
 private slots:
   bool startListening();
   void stopListening(const QString &msg = QString());
 private slots:
   bool startListening();
   void stopListening(const QString &msg = QString());
@@ -418,6 +424,7 @@ private:
 
   SessionThread *createSession(UserId userId, bool restoreState = false);
   void setupClientSession(QTcpSocket *socket, UserId uid);
 
   SessionThread *createSession(UserId userId, bool restoreState = false);
   void setupClientSession(QTcpSocket *socket, UserId uid);
+  void addClientHelper(QTcpSocket *socket, UserId uid);
   void processClientMessage(QTcpSocket *socket, const QVariantMap &msg);
   //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
   QString setupCoreForInternalUsage();
   void processClientMessage(QTcpSocket *socket, const QVariantMap &msg);
   //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
   QString setupCoreForInternalUsage();