Cleanup netsplits on disconnect correctly
authorSebastian Goth <seezer@roath.org>
Thu, 10 Dec 2009 12:01:17 +0000 (13:01 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 18 Jan 2010 19:15:55 +0000 (20:15 +0100)
src/core/ircserverhandler.cpp
src/core/ircserverhandler.h

index 5c3fe82..d51bb0d 100644 (file)
@@ -36,11 +36,11 @@ IrcServerHandler::IrcServerHandler(CoreNetwork *parent)
   : BasicHandler(parent),
     _whois(false)
 {
   : BasicHandler(parent),
     _whois(false)
 {
+  connect(parent, SIGNAL(disconnected(NetworkId)), this, SLOT(destroyNetsplits()));
 }
 
 IrcServerHandler::~IrcServerHandler() {
 }
 
 IrcServerHandler::~IrcServerHandler() {
-  if(!_netsplits.empty())
-    qDeleteAll(_netsplits);
+  destroyNetsplits();
 }
 
 /*! Handle a raw message string sent by the server. We try to find a suitable handler, otherwise we call a default handler. */
 }
 
 /*! Handle a raw message string sent by the server. We try to find a suitable handler, otherwise we call a default handler. */
@@ -1164,6 +1164,11 @@ bool IrcServerHandler::checkParamCount(const QString &methodName, const QList<QB
   }
 }
 
   }
 }
 
+void IrcServerHandler::destroyNetsplits() {
+  qDebug() << "destroyNetsplits()";
+  qDeleteAll(_netsplits);
+  _netsplits.clear();
+}
 
 /***********************************************************************************/
 
 
 /***********************************************************************************/
 
index 0d725f6..4ad28de 100644 (file)
@@ -107,6 +107,12 @@ private slots:
 
   void handleEarlyNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes);
 
 
   void handleEarlyNetsplitJoin(const QString &channel, const QStringList &users, const QStringList &modes);
 
+  //! Destroy any existing netsplits
+  /** This slot deletes all netsplit objects
+    * Used to get rid of existing netsplits on network reconnect
+    */
+  void destroyNetsplits();
+
 private:
   void tryNextNick(const QString &errnick, bool erroneus = false);
   bool checkParamCount(const QString &methodName, const QList<QByteArray> &params, int minParams);
 private:
   void tryNextNick(const QString &errnick, bool erroneus = false);
   bool checkParamCount(const QString &methodName, const QList<QByteArray> &params, int minParams);