X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fstorage.h;h=30c1c0bd376267c29ca1f615b876a4cb850099aa;hp=f98b75b7dd21c03382c826499e544afd40543d33;hb=23ebdc0a422294764ff3be3f8d7e56cc2b323185;hpb=97d674034551438238c568e8b42efb08e1ba7354 diff --git a/src/core/storage.h b/src/core/storage.h index f98b75b7..30c1c0bd 100644 --- a/src/core/storage.h +++ b/src/core/storage.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -22,17 +22,19 @@ #define _STORAGE_H_ #include -#include +#include "types.h" #include "message.h" +struct NetworkInfo; class Storage : public QObject { Q_OBJECT public: - Storage() {}; + Storage(QObject *parent = 0); virtual ~Storage() {}; + public slots: /* General */ //! Check if the storage type is available. @@ -51,7 +53,7 @@ class Storage : public QObject { * \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()) { return false; } + virtual bool setup(const QVariantMap &settings = QVariantMap()) { Q_UNUSED(settings); return false; } //! Initialize the storage provider /** \param settings Hostname, port, username, password, ... @@ -96,12 +98,19 @@ class Storage : public QObject { /* Network handling */ + //! Create a new unique Network in the storage backend + /** \param user The core user who owns this network + * \param networkInfo The networkInfo holding the network definition + * \return the NetworkId of the newly created Network. Possibly invalid. + */ + virtual NetworkId createNetworkId(UserId user, const NetworkInfo &info) = 0; + //! Get the unique NetworkId of the network for a user. - /** \param user The core user who owns this buffername + /** \param user The core user who owns this network * \param network The network name - * \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found + * \return The NetworkId corresponding to the given network, or 0 if not found */ - virtual uint getNetworkId(UserId user, const QString &network) = 0; + virtual NetworkId getNetworkId(UserId user, const QString &network) = 0; /* Buffer handling */ @@ -111,7 +120,7 @@ class Storage : public QObject { * \param buffer The buffer name (if empty, the net's status buffer is returned) * \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found */ - virtual BufferInfo getBufferInfo(UserId user, const QString &network, const QString &buffer = "") = 0; + virtual BufferInfo getBufferInfo(UserId user, const NetworkId &networkId, const QString &buffer = "") = 0; //! Request a list of all buffers known to a user since a certain point in time. /** This method is used to get a list of all buffers we have stored a backlog from. @@ -157,7 +166,7 @@ class Storage : public QObject { signals: //! Sent when a new BufferInfo is created, or an existing one changed somehow. - void bufferInfoUpdated(BufferInfo); + void bufferInfoUpdated(UserId user, const BufferInfo &); //! Sent when a new user has been added void userAdded(UserId, const QString &username); //! Sent when a user has been renamed @@ -166,8 +175,7 @@ class Storage : public QObject { void userRemoved(UserId); public: - /* Exceptions */ - struct AuthError : public Exception {}; + };