Fixed some indentation issues (and a typo).
[quassel.git] / src / core / core.h
index 6d743e8..fd67fa8 100644 (file)
@@ -45,6 +45,9 @@ class SessionThread;
 class SignalProxy;
 struct NetworkInfo;
 
+class AbstractSqlMigrationReader;
+class AbstractSqlMigrationWriter;
+
 class Core : public QObject {
   Q_OBJECT
 
@@ -256,16 +259,26 @@ class Core : public QObject {
     return instance()->_storage->getBufferInfo(user, bufferId);
   }
 
-  //! Store a Message in the backlog.
+  //! Store a Message in the storage backend and set it's unique Id.
   /** \note This method is threadsafe.
    *
-   *  \param msg  The message object to be stored
-   *  \return The globally unique id for the stored message
+   *  \param message The message object to be stored
+   *  \return true on success
    */
-  static inline MsgId storeMessage(const Message &message) {
+  static inline bool storeMessage(Message &message) {
     return instance()->_storage->logMessage(message);
   }
 
+  //! Store a list of Messages in the storage backend and set their unique Id.
+  /** \note This method is threadsafe.
+   *
+   *  \param messages The list message objects to be stored
+   *  \return true on success
+   */
+  static inline bool storeMessages(MessageList &messages) {
+    return instance()->_storage->logMessages(messages);
+  }
+
   //! Request a certain number messages stored in a given buffer.
   /** \param buffer   The buffer we request messages from
    *  \param first    if != -1 return only messages with a MsgId >= first
@@ -389,6 +402,7 @@ private slots:
   void clientHasData();
   void clientDisconnected();
 
+  bool initStorage(const QString &backend, QVariantMap settings, bool setup = false);
   bool initStorage(QVariantMap dbSettings, bool setup = false);
 
 #ifdef HAVE_SSL
@@ -409,8 +423,15 @@ private:
   QString setupCoreForInternalUsage();
   QString setupCore(QVariantMap setupData);
 
+  void registerStorageBackends();
   bool registerStorageBackend(Storage *);
+  void unregisterStorageBackends();
   void unregisterStorageBackend(Storage *);
+  bool selectBackend(const QString &backend);
+  void createUser();
+  void changeUserPass(const QString &username);
+  void saveBackendSettings(const QString &backend, const QVariantMap &settings);
+  QVariantMap promptForSettings(const Storage *storage);
 
   QHash<UserId, SessionThread *> sessions;
   Storage *_storage;
@@ -430,6 +451,13 @@ private:
   QDateTime _startTime;
 
   bool _configured;
+
+
+  static AbstractSqlMigrationReader *getMigrationReader(Storage *storage);
+  static AbstractSqlMigrationWriter *getMigrationWriter(Storage *storage);
+  static void stdInEcho(bool on);
+  static inline void enableStdInEcho() { stdInEcho(true); }
+  static inline void disableStdInEcho() { stdInEcho(false); }
 };
 
 #endif