X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=603d291ff7096c7366fc87076379fbe4d74cc00e;hp=504fdab02f032abe052e1a000af929ceca284869;hb=11cecc112915cd9940e7612c05091f9b5bb18b00;hpb=712781ef33198acb7267e02ee6f8f9bfc8598d5a diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 504fdab0..603d291f 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -34,6 +34,7 @@ #include "corenetworkconfig.h" #include "coresessioneventprocessor.h" #include "coreusersettings.h" +#include "ctcpparser.h" #include "eventmanager.h" #include "eventstringifier.h" #include "ircchannel.h" @@ -63,7 +64,8 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _coreInfo(this), _eventManager(new EventManager(this)), _eventStringifier(new EventStringifier(this)), - _eventProcessor(new CoreSessionEventProcessor(this)), + _sessionEventProcessor(new CoreSessionEventProcessor(this)), + _ctcpParser(new CtcpParser(this)), _ircParser(new IrcParser(this)), scriptEngine(new QScriptEngine(this)), _processMessages(false), @@ -96,11 +98,13 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) initScriptEngine(); eventManager()->registerObject(ircParser(), EventManager::NormalPriority); - eventManager()->registerObject(eventProcessor(), EventManager::HighPriority); // needs to process events *before* the stringifier! + eventManager()->registerObject(sessionEventProcessor(), EventManager::HighPriority); // needs to process events *before* the stringifier! + eventManager()->registerObject(ctcpParser(), EventManager::NormalPriority); eventManager()->registerObject(eventStringifier(), EventManager::NormalPriority); eventManager()->registerObject(this, EventManager::LowPriority); // for sending MessageEvents to the client // some events need to be handled after msg generation - eventManager()->registerObject(eventProcessor(), EventManager::LowPriority, "lateProcess"); + eventManager()->registerObject(sessionEventProcessor(), EventManager::LowPriority, "lateProcess"); + eventManager()->registerObject(ctcpParser(), EventManager::LowPriority, "send"); // periodically save our session state connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), this, SLOT(saveSessionState())); @@ -401,7 +405,7 @@ void CoreSession::createIdentity(const Identity &identity, const QVariantMap &ad void CoreSession::createIdentity(const CoreIdentity &identity) { CoreIdentity *coreIdentity = new CoreIdentity(identity, this); _identities[identity.id()] = coreIdentity; - // CoreIdentity has it's own synchronize method since it's "private" sslManager needs to be synced aswell + // CoreIdentity has its own synchronize method since its "private" sslManager needs to be synced as well coreIdentity->synchronize(signalProxy()); connect(coreIdentity, SIGNAL(updated()), this, SLOT(updateIdentityBySender())); emit identityCreated(*coreIdentity); @@ -477,7 +481,10 @@ void CoreSession::removeNetwork(NetworkId id) { return; if(net->connectionState() != Network::Disconnected) { - connect(net, SIGNAL(disconnected(NetworkId)), SLOT(destroyNetwork(NetworkId))); + // make sure we no longer receive data from the tcp buffer + disconnect(net, SIGNAL(displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)), this, 0); + disconnect(net, SIGNAL(displayStatusMsg(QString)), this, 0); + connect(net, SIGNAL(disconnected(NetworkId)), this, SLOT(destroyNetwork(NetworkId))); net->disconnectFromIrc(); } else { destroyNetwork(id); @@ -488,6 +495,16 @@ void CoreSession::destroyNetwork(NetworkId id) { QList removedBuffers = Core::requestBufferIdsForNetwork(user(), id); Network *net = _networks.take(id); if(net && Core::removeNetwork(user(), id)) { + // make sure that all unprocessed RawMessages from this network are removed + QList::iterator messageIter = _messageQueue.begin(); + while(messageIter != _messageQueue.end()) { + if(messageIter->networkId == id) { + messageIter = _messageQueue.erase(messageIter); + } else { + messageIter++; + } + } + // remove buffers from syncer foreach(BufferId bufferId, removedBuffers) { _bufferSyncer->removeBuffer(bufferId); }