- Storage(QObject *parent = 0);
- virtual ~Storage() {};
-
- public slots:
- /* General */
-
- //! Check if the storage type is available.
- /** A storage subclass should return true if it can be successfully used, i.e. if all
- * prerequisites are in place (e.g. we have an appropriate DB driver etc.).
- * \return True if and only if the storage class can be successfully used.
- */
- virtual bool isAvailable() const = 0;
-
- //! Returns the display name of the storage backend
- /** \return A string that can be used by the client to name the storage backend */
- virtual QString displayName() const = 0;
-
- //! Returns a description of this storage backend
- /** \return A string that can be displayed by the client to describe the storage backend */
- virtual QString description() const = 0;
-
- //! Setup the storage provider.
- /** This prepares the storage provider (e.g. create tables, etc.) for use within Quassel.
- * \param settings Hostname, port, username, password, ...
- * \return True if and only if the storage provider was initialized successfully.
- */
- virtual bool setup(const QVariantMap &settings = QVariantMap()) = 0;
-
- //! Initialize the storage provider
- /** \param settings Hostname, port, username, password, ...
- * \return True if and only if the storage provider was initialized successfully.
- */
- virtual bool init(const QVariantMap &settings = QVariantMap()) = 0;
-
- //! Makes temp data persistent
- /** This Method is periodically called by the Quassel Core to make temporary
- * data persistant. This reduces the data loss drastically in the
- * unlikely case of a Core crash.
- */
- virtual void sync() = 0;
-
- // TODO: Add functions for configuring the backlog handling, i.e. defining auto-cleanup settings etc
-
- /* User handling */
-
- //! Add a new core user to the storage.
- /** \param user The username of the new user
- * \param password The cleartext password for the new user
- * \return The new user's UserId
- */
- virtual UserId addUser(const QString &user, const QString &password) = 0;
-
- //! Update a core user's password.
- /** \param user The user's id
- * \param password The user's new password
- */
- virtual void updateUser(UserId user, const QString &password) = 0;
-
- //! Rename a user
- /** \param user The user's id
- * \param newName The user's new name
- */
- virtual void renameUser(UserId user, const QString &newName) = 0;
-
- //! Validate a username with a given password.
- /** \param user The username to validate
- * \param password The user's alleged password
- * \return A valid UserId if the password matches the username; 0 else
- */
- virtual UserId validateUser(const QString &user, const QString &password) = 0;
-
- //! Remove a core user from storage.
- /** \param user The userid to delete
- */
- virtual void delUser(UserId user) = 0;
-
- //! Store a user setting persistently
- /**
- * \param userId The users Id
- * \param settingName The Name of the Setting
- * \param data The Value
- */
- virtual void setUserSetting(UserId userId, const QString &settingName, const QVariant &data) = 0;
+ Storage(QObject *parent = 0);
+ virtual ~Storage() {};
+
+public slots:
+ /* General */
+
+ //! Check if the storage type is available.
+ /** A storage subclass should return true if it can be successfully used, i.e. if all
+ * prerequisites are in place (e.g. we have an appropriate DB driver etc.).
+ * \return True if and only if the storage class can be successfully used.
+ */
+ virtual bool isAvailable() const = 0;
+
+ //! Returns the display name of the storage backend
+ /** \return A string that can be used by the client to name the storage backend */
+ virtual QString displayName() const = 0;
+
+ //! Returns a description of this storage backend
+ /** \return A string that can be displayed by the client to describe the storage backend */
+ virtual QString description() const = 0;
+
+ //! Setup the storage provider.
+ /** This prepares the storage provider (e.g. create tables, etc.) for use within Quassel.
+ * \param settings Hostname, port, username, password, ...
+ * \return True if and only if the storage provider was initialized successfully.
+ */
+ virtual bool setup(const QVariantMap &settings = QVariantMap()) = 0;
+
+ //! Initialize the storage provider
+ /** \param settings Hostname, port, username, password, ...
+ * \return True if and only if the storage provider was initialized successfully.
+ */
+ virtual bool init(const QVariantMap &settings = QVariantMap()) = 0;
+
+ //! Makes temp data persistent
+ /** This Method is periodically called by the Quassel Core to make temporary
+ * data persistant. This reduces the data loss drastically in the
+ * unlikely case of a Core crash.
+ */
+ virtual void sync() = 0;
+
+ // TODO: Add functions for configuring the backlog handling, i.e. defining auto-cleanup settings etc
+
+ /* User handling */
+
+ //! Add a new core user to the storage.
+ /** \param user The username of the new user
+ * \param password The cleartext password for the new user
+ * \return The new user's UserId
+ */
+ virtual UserId addUser(const QString &user, const QString &password) = 0;
+
+ //! Update a core user's password.
+ /** \param user The user's id
+ * \param password The user's new password
+ */
+ virtual void updateUser(UserId user, const QString &password) = 0;
+
+ //! Rename a user
+ /** \param user The user's id
+ * \param newName The user's new name
+ */
+ virtual void renameUser(UserId user, const QString &newName) = 0;
+
+ //! Validate a username with a given password.
+ /** \param user The username to validate
+ * \param password The user's alleged password
+ * \return A valid UserId if the password matches the username; 0 else
+ */
+ virtual UserId validateUser(const QString &user, const QString &password) = 0;
+
+ //! Determine the UserId of the internal user
+ /** \return A valid UserId if the password matches the username; 0 else
+ */
+ virtual UserId internalUser() = 0;
+
+ //! Remove a core user from storage.
+ /** \param user The userid to delete
+ */
+ virtual void delUser(UserId user) = 0;
+
+ //! Store a user setting persistently
+ /**
+ * \param userId The users Id
+ * \param settingName The Name of the Setting
+ * \param data The Value
+ */
+ virtual void setUserSetting(UserId userId, const QString &settingName, const QVariant &data) = 0;