X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.h;h=091c0f71bbd8a3b9179672e541ee3bd8540811b1;hp=67f6dec84346e836c1c0cb56b09f41784d71a8b5;hb=59579d82e3a16a815a197a4300c8ef279275ccfc;hpb=6f2f1723f5bb3d26908f6dd297890f6fba43793b diff --git a/src/core/core.h b/src/core/core.h index 67f6dec8..091c0f71 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,7 @@ class CoreSession; class SessionThread; class Storage; +struct NetworkInfo; class Core : public QObject { Q_OBJECT @@ -51,6 +53,15 @@ class Core : public QObject { /*** Storage access ***/ // These methods are threadsafe. + //! Create a NetworkId in the Storage and store it in the given NetworkInfo + /** \note This method is thredsafe. + * + * \param user The core user + * \param networkInfo a NetworkInfo definition to store the newly created ID in + * \return true if successfull. + */ + static bool createNetworkId(UserId user, NetworkInfo &info); + //! Get the NetworkId for a network name. /** \note This method is threadsafe. * @@ -63,12 +74,12 @@ class Core : public QObject { //! Get the unique BufferInfo for the given combination of network and buffername for a user. /** \note This method is threadsafe. * - * \param user The core user who owns this buffername - * \param network The network name - * \param buffer The buffer name (if empty, the net's status buffer is returned) + * \param user The core user who owns this buffername + * \param networkId The network id + * \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 */ - static BufferInfo bufferInfo(UserId user, const QString &network, const QString &buffer = ""); + static BufferInfo bufferInfo(UserId user, const NetworkId &networkId, const QString &buffer = ""); //! Store a Message in the backlog. /** \note This method is threadsafe. @@ -120,6 +131,12 @@ class Core : public QObject { */ static QList requestBuffers(UserId user, QDateTime since = QDateTime()); + public slots: + //! Make storage data persistent + /** \note This method is threadsafe. + */ + void syncStorage(); + signals: //! Sent when a BufferInfo is updated in storage. void bufferInfoUpdated(UserId user, const BufferInfo &info); @@ -148,6 +165,7 @@ class Core : public QObject { UserId guiUser; QHash sessions; Storage *storage; + QTimer _storageSyncTimer; QTcpServer server; // TODO: implement SSL QHash blocksizes;