X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=core%2Fstorage.h;h=e0d24a9c39936dc8bca7b79daba97493c1b7c323;hb=a19a2f6e05b831aac9e85d21fbfc424aabb7a04e;hp=34ca0a88de85aeee2b6e09e5a909990c2a41b748;hpb=7a2708fff6cff5329002a3a16da266be51f1a3a1;p=quassel.git diff --git a/core/storage.h b/core/storage.h index 34ca0a88..e0d24a9c 100644 --- a/core/storage.h +++ b/core/storage.h @@ -22,8 +22,10 @@ #define _STORAGE_H_ #include +#include #include "global.h" +#include "message.h" class Storage : public QObject { Q_OBJECT @@ -40,7 +42,7 @@ class Storage : public QObject { * For anything like this, the constructor (which is called if and when we actually create an instance * of the storage backend) is the right place. */ - virtual static void init() {}; + static void init() {}; /* General */ @@ -49,11 +51,11 @@ class Storage : public QObject { * 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 static bool isAvailable() = 0; + static bool isAvailable() { return false; } //! Returns the display name of the storage backend /** \return A string that can be used by the GUI to describe the storage backend */ - virtual static QString displayName() = 0; + static QString displayName() { return ""; } // TODO: Add functions for configuring the backlog handling, i.e. defining auto-cleanup settings etc @@ -67,10 +69,10 @@ class Storage : public QObject { virtual UserId addUser(QString user, QString password) = 0; //! Update a core user's password. - /** \param user The user's name + /** \param user The user's id * \param password The user's new password */ - virtual void updateUser(QString user, QString password) = 0; + virtual void updateUser(UserId user, QString password) = 0; //! Validate a username with a given password. /** \param user The username to validate @@ -80,9 +82,9 @@ class Storage : public QObject { virtual UserId validateUser(QString user, QString password) = 0; //! Remove a core user from storage. - /** \param user The username to delete + /** \param user The userid to delete */ - virtual void delUser(QString user) = 0; + virtual void delUser(UserId user) = 0; /* Buffer handling */ @@ -108,7 +110,7 @@ class Storage : public QObject { //! Store a Message in the backlog. /** \param msg The message object to be stored - * \return The globally uniqe id for the stored message + * \return The globally unique id for the stored message */ virtual MsgId logMessage(Message msg) = 0; @@ -139,20 +141,25 @@ class Storage : public QObject { public slots: //! This is just for importing the old file-based backlog */ /** This slot needs to be implemented in the storage backends. - * It should first prepare (delete?) the database, then call initBackLogOld(). + * It should first prepare (delete?) the database, then call initBackLogOld(UserId id). * If the importing was successful, backLogEnabledOld will be true afterwards. */ - void importOldBacklog() = 0; + virtual void importOldBacklog() = 0; signals: //! Sent if a new BufferId is created, or an existing one changed somehow. void bufferIdUpdated(BufferId); + public: + /* Exceptions */ + struct AuthError : public Exception {}; + protected: // Old stuff, just for importing old file-based data - void initBackLogOld(); - void logMessageOld(QString net, Message); + void initBackLogOld(UserId id); + QSqlDatabase logDb; + bool backLogEnabledOld; QDir backLogDir; QHash > backLog; @@ -164,4 +171,4 @@ class Storage : public QObject { }; -#endif \ No newline at end of file +#endif