Fix Quassel not rejoining newly joined channels
[quassel.git] / src / core / coresession.cpp
index d81f9c0..3c8e20c 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "core.h"
 #include "coresession.h"
-#include "userinputhandler.h"
+#include "coreuserinputhandler.h"
 #include "signalproxy.h"
 #include "corebuffersyncer.h"
 #include "corebacklogmanager.h"
@@ -84,8 +84,8 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent)
   loadSettings();
   initScriptEngine();
 
-  connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferSyncer, SLOT(storeDirtyIds()));
-  connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferViewManager, SLOT(saveBufferViews()));
+  // periodically save our session state
+  connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), this, SLOT(saveSessionState()));
 
   p->synchronize(_bufferSyncer);
   p->synchronize(&aliasManager());
@@ -248,8 +248,9 @@ void CoreSession::processMessages() {
     const RawMessage &rawMsg = _messageQueue.first();
     BufferInfo bufferInfo = Core::bufferInfo(user(), rawMsg.networkId, rawMsg.bufferType, rawMsg.target);
     Message msg(bufferInfo, rawMsg.type, rawMsg.text, rawMsg.sender, rawMsg.flags);
-    
-    networkName = _networks.value(bufferInfo.networkId())->networkName();
+
+    CoreNetwork *currentNetwork = network(bufferInfo.networkId());
+    networkName = currentNetwork ? currentNetwork->networkName() : QString("");
     // if message is ignored with "HardStrictness" we discard it here
     if(_ignoreListManager.match(msg, networkName) != IgnoreListManager::HardStrictness) {
       Core::storeMessage(msg);
@@ -269,7 +270,8 @@ void CoreSession::processMessages() {
       }
 
       Message msg(bufferInfo, rawMsg.type, rawMsg.text, rawMsg.sender, rawMsg.flags);
-      networkName = _networks.value(bufferInfo.networkId())->networkName();
+      CoreNetwork *currentNetwork = network(bufferInfo.networkId());
+      networkName = currentNetwork ? currentNetwork->networkName() : QString("");
       // if message is ignored with "HardStrictness" we discard it here
       if(_ignoreListManager.match(msg, networkName) == IgnoreListManager::HardStrictness)
         continue;