Backlogdata is now made persistent every 10 minutes.
[quassel.git] / src / core / core.cpp
index 2024387..4826c3e 100644 (file)
@@ -49,6 +49,10 @@ Core::Core()
   : storage(0)
 {
   startTime = QDateTime::currentDateTime();  // for uptime :)
   : storage(0)
 {
   startTime = QDateTime::currentDateTime();  // for uptime :)
+
+  connect(&_storageSyncTimer, SIGNAL(timeout()),
+         this, SLOT(syncStorage()));
+  _storageSyncTimer.start(10 * 60 * 1000); // in msecs
 }
 
 void Core::init() {
 }
 
 void Core::init() {
@@ -95,6 +99,11 @@ Core::~Core() {
   qDeleteAll(sessions);
 }
 
   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!"));
 void Core::restoreState() {
   if(instance()->sessions.count()) {
     qWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));