+ //! Get the unique BufferInfo for a bufferId
+ /** \param user The core user who owns this buffername
+ * \param bufferId The id of the buffer
+ * \return The BufferInfo corresponding to the given buffer id, or an invalid BufferInfo if not found.
+ */
+ virtual BufferInfo getBufferInfo(UserId user, const BufferId &bufferId) = 0;
+
+ //! Request a list of all buffers known to a user.
+ /** This method is used to get a list of all buffers we have stored a backlog from.
+ * \param user The user whose buffers we request
+ * \return A list of the BufferInfos for all buffers as requested
+ */
+ virtual QList<BufferInfo> requestBuffers(UserId user) = 0;
+
+ //! Request a list of BufferIds for a given NetworkId
+ /** \note This method is threadsafe.
+ *
+ * \param user The user whose buffers we request
+ * \param networkId The NetworkId of the network in question
+ * \return List of BufferIds belonging to the Network
+ */
+ virtual QList<BufferId> requestBufferIdsForNetwork(UserId user, NetworkId networkId) = 0;
+
+ //! Remove permanently a buffer and it's content from the storage backend
+ /** This call cannot be reverted!
+ * \param user The user who is the owner of the buffer
+ * \param bufferId The bufferId
+ * \return true if successfull
+ */
+ virtual bool removeBuffer(const UserId &user, const BufferId &bufferId) = 0;
+
+ //! Rename a Buffer
+ /** \param user The id of the buffer owner
+ * \param networkId The id of the network the buffer belongs to
+ * \param newName The new name of the buffer
+ * \param oldName The previous name of the buffer
+ * \return the BufferId of the affected buffer or an invalid BufferId if not successfull
+ */
+ virtual BufferId renameBuffer(const UserId &user, const NetworkId &networkId, const QString &newName, const QString &oldName) = 0;
+
+ //! Update the LastSeenDate for a Buffer
+ /** This Method is used to make the LastSeenDate of a Buffer persistent
+ * \param user The Owner of that Buffer
+ * \param bufferId The buffer id
+ * \param MsgId The Message id of the message that has been just seen
+ */
+ virtual void setBufferLastSeenMsg(UserId user, const BufferId &bufferId, const MsgId &msgId) = 0;
+
+ //! Get a Hash of all last seen message ids
+ /** This Method is called when the Quassel Core is started to restore the lastSeenMsgIds
+ * \param user The Owner of the buffers
+ */
+ virtual QHash<BufferId, MsgId> bufferLastSeenMsgIds(UserId user) = 0;
+
+
+ /* Message handling */
+
+ //! Store a Message in the backlog.
+ /** \param msg The message object to be stored
+ * \return The globally unique id for the stored message
+ */
+ virtual MsgId logMessage(Message msg) = 0;
+
+ //! Request a certain number (or all) messages stored in a given buffer.
+ /** \param buffer The buffer we request messages from
+ * \param limit The number of messages we would like to receive, or -1 if we'd like all messages from that buffername
+ * \param offset Do not return (but DO count) messages with MsgId >= offset, if offset >= 0
+ * \return The requested list of messages
+ */
+ virtual QList<Message> requestMsgs(UserId user, BufferId buffer, int limit = -1, int offset = -1) = 0;
+
+ //! Request messages stored in a given buffer since a certain point in time.
+ /** \param buffer The buffer we request messages from
+ * \param since Only return messages newer than this point in time
+ * \param offset Do not return messages with MsgId >= offset, if offset >= 0
+ * \return The requested list of messages
+ */
+ virtual QList<Message> requestMsgs(UserId user, BufferId buffer, QDateTime since, int offset = -1) = 0;
+
+ //! Request a range of messages stored in a given buffer.
+ /** \param buffer The buffer we request messages from
+ * \param first Return messages with first <= MsgId <= last
+ * \param last Return messages with first <= MsgId <= last
+ * \return The requested list of messages
+ */
+ virtual QList<Message> requestMsgRange(UserId user, BufferId buffer, int first, int last) = 0;
+
+ //! Request all unread messages
+ /** \param buffer The buffer we request messages from
+ * \param first Return messages with first <= MsgId
+ * \param limit Max amount of messages
+ * \return The requested list of messages
+ */
+ virtual QList<Message> requestNewMsgs(UserId user, BufferId bufferId, int first, int limit = -1) = 0;
+
+ //! Request all unread messages for all buffers
+ /** \param first Return messages with first <= MsgId
+ * \param limit Max amount of messages
+ * \return The requested list of messages
+ */
+ virtual QList<Message> requestAllNewMsgs(UserId user, int first, int limit = -1) = 0;
+
+signals:
+ //! Sent when a new BufferInfo is created, or an existing one changed somehow.
+ void bufferInfoUpdated(UserId user, const BufferInfo &);
+ //! Sent when a Buffer was renamed
+ void bufferRenamed(const QString &newName, const QString &oldName);
+ //! Sent when a new user has been added
+ void userAdded(UserId, const QString &username);
+ //! Sent when a user has been renamed
+ void userRenamed(UserId, const QString &newname);
+ //! Sent when a user has been removed
+ void userRemoved(UserId);
+
+protected:
+ //! when implementing a storage handler, use this method to crypt user passwords.
+ /** This guarantees compatibility with other storage handlers and allows easy migration
+ */
+ QString cryptedPassword(const QString &password);