X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=491e99a882ff82c97deb4feb837042b37b06c1c5;hp=fd9a872e60c4adf03d2caab2862d1157f5375d15;hb=558260f52de5a9b1364f5672ace17554efc10a74;hpb=3c2914faeb01f3bc32e29f40179ae88040fbcf59 diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index fd9a872e..491e99a8 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -51,7 +51,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _coreInfo(this), scriptEngine(new QScriptEngine(this)) { - SignalProxy *p = signalProxy(); connect(p, SIGNAL(peerRemoved(QIODevice *)), this, SLOT(removeClient(QIODevice *))); @@ -75,30 +74,18 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) loadSettings(); initScriptEngine(); - // init BufferSyncer - QHash lastSeenHash = Core::bufferLastSeenMsgIds(user()); - foreach(BufferId id, lastSeenHash.keys()) - _bufferSyncer->requestSetLastSeenMsg(id, lastSeenHash[id]); - - // connect(_bufferSyncer, SIGNAL(lastSeenMsgSet(BufferId, MsgId)), this, SLOT(storeBufferLastSeenMsg(BufferId, MsgId))); connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferSyncer, SLOT(storeDirtyIds())); - p->synchronize(_bufferSyncer); + connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), _bufferViewManager, SLOT(saveBufferViews())); - - // init alias manager + p->synchronize(_bufferSyncer); p->synchronize(&aliasManager()); - - // init BacklogManager p->synchronize(_backlogManager); - - // init IrcListHelper p->synchronize(ircListHelper()); - - // init CoreInfo p->synchronize(&_coreInfo); // Restore session state - if(restoreState) restoreSessionState(); + if(restoreState) + restoreSessionState(); emit initialized(); } @@ -160,6 +147,7 @@ void CoreSession::loadSettings() { void CoreSession::saveSessionState() const { _bufferSyncer->storeDirtyIds(); + _bufferViewManager->saveBufferViews(); } void CoreSession::restoreSessionState() { @@ -265,10 +253,6 @@ QVariant CoreSession::sessionState() { return v; } -void CoreSession::storeBufferLastSeenMsg(BufferId buffer, const MsgId &msgId) { - Core::setBufferLastSeenMsg(user(), buffer, msgId); -} - void CoreSession::initScriptEngine() { signalProxy()->attachSlot(SIGNAL(scriptRequest(QString)), this, SLOT(scriptRequest(QString))); signalProxy()->attachSignal(this, SIGNAL(scriptResult(QString))); @@ -386,8 +370,10 @@ void CoreSession::destroyNetwork(NetworkId id) { } void CoreSession::renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName) { - BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName); - _bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName); + BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName, false); + if(bufferInfo.isValid()) { + _bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName); + } } void CoreSession::clientsConnected() {