X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.cpp;h=2e3da6d9f4395cf2b9a9382d37d2d21b0ba938aa;hp=2024387e640ec78bb275ae36f6243c49ba1b7e97;hb=9d4aff06284de98df1eed1179b958833221f5f85;hpb=23ebdc0a422294764ff3be3f8d7e56cc2b323185 diff --git a/src/core/core.cpp b/src/core/core.cpp index 2024387e..2e3da6d9 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -49,6 +49,10 @@ Core::Core() : storage(0) { startTime = QDateTime::currentDateTime(); // for uptime :) + + connect(&_storageSyncTimer, SIGNAL(timeout()), + this, SLOT(syncStorage())); + _storageSyncTimer.start(10 * 60 * 1000); // in msecs } void Core::init() { @@ -95,6 +99,11 @@ Core::~Core() { qDeleteAll(sessions); } +void Core::syncStorage() { + QMutexLocker locker(&mutex); + return instance()->storage->sync(); +} + void Core::restoreState() { if(instance()->sessions.count()) { qWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!")); @@ -144,7 +153,7 @@ NetworkId Core::networkId(UserId user, const QString &network) { } BufferInfo Core::bufferInfo(UserId user, const NetworkId &networkId, const QString &buffer) { - //QMutexLocker locker(&mutex); + QMutexLocker locker(&mutex); return instance()->storage->getBufferInfo(user, networkId, buffer); }