X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=6c0c5e136e54d5d86ae5cb1fb0a10f379ab91e3d;hb=d399105c3cacc85e30afc28e174efefd36332bc3;hp=2ed950c0fd1bbb8895fa74ae639e525c8ba7d874;hpb=d60c5028b49a95d3c27c35b2ea1d74cdd7bb0e46;p=quassel.git diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 2ed950c0..6c0c5e13 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -27,6 +27,7 @@ #include "corebuffersyncer.h" #include "corebacklogmanager.h" #include "corebufferviewmanager.h" +#include "coreeventmanager.h" #include "coreidentity.h" #include "coreignorelistmanager.h" #include "coreirclisthelper.h" @@ -34,7 +35,7 @@ #include "corenetworkconfig.h" #include "coresessioneventprocessor.h" #include "coreusersettings.h" -#include "eventmanager.h" +#include "ctcpparser.h" #include "eventstringifier.h" #include "ircchannel.h" #include "ircparser.h" @@ -61,9 +62,10 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _ircListHelper(new CoreIrcListHelper(this)), _networkConfig(new CoreNetworkConfig("GlobalNetworkConfig", this)), _coreInfo(this), - _eventManager(new EventManager(this)), + _eventManager(new CoreEventManager(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,10 +98,13 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) initScriptEngine(); eventManager()->registerObject(ircParser(), EventManager::NormalPriority); - eventManager()->registerObject(eventStringifier(), EventManager::HighPriority, "earlyProcess"); // some need to be sent before statechange - 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(sessionEventProcessor(), EventManager::LowPriority, "lateProcess"); + eventManager()->registerObject(ctcpParser(), EventManager::LowPriority, "send"); // periodically save our session state connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), this, SLOT(saveSessionState())); @@ -400,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); @@ -456,6 +461,7 @@ void CoreSession::createNetwork(const NetworkInfo &info_, const QStringList &per connect(net, SIGNAL(displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)), SLOT(recvMessageFromServer(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags))); connect(net, SIGNAL(displayStatusMsg(QString)), SLOT(recvStatusMsgFromServer(QString))); + connect(net, SIGNAL(disconnected(NetworkId)), SIGNAL(networkDisconnected(NetworkId))); net->setNetworkInfo(info); net->setProxy(signalProxy()); @@ -475,6 +481,9 @@ void CoreSession::removeNetwork(NetworkId id) { return; if(net->connectionState() != Network::Disconnected) { + // 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 { @@ -486,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); }