X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcore.h;h=d3f2fab3c9bbf38137ae12b94287591d27e30282;hp=fd67fa8a76420f94fdbdd9d419695ffdaf87e5e3;hb=615c5621f63360ef11c9cc3519c0462d8b5ec85b;hpb=b040ef84cdc254a0b1f083db3151f2724e45d210 diff --git a/src/core/core.h b/src/core/core.h index fd67fa8a..d3f2fab3 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -51,8 +51,8 @@ class AbstractSqlMigrationWriter; class Core : public QObject { Q_OBJECT - public: - static Core * instance(); +public: + static Core *instance(); static void destroy(); static void saveState(); @@ -75,11 +75,11 @@ class Core : public QObject { /** * \param userId The users Id * \param settingName The Name of the Setting - * \param default Value to return in case it's unset. + * \param defaultValue Value to return in case it's unset. * \return the Value of the Setting or the default value if it is unset. */ - static inline QVariant getUserSetting(UserId userId, const QString &settingName, const QVariant &data = QVariant()) { - return instance()->_storage->getUserSetting(userId, settingName, data); + static inline QVariant getUserSetting(UserId userId, const QString &settingName, const QVariant &defaultValue = QVariant()) { + return instance()->_storage->getUserSetting(userId, settingName, defaultValue); } /* Identity handling */ @@ -378,16 +378,41 @@ class Core : public QObject { return instance()->_storage->bufferLastSeenMsgIds(user); } + //! Update the MarkerLineMsgId for a Buffer + /** This Method is used to make the marker line position of a Buffer persistent + * \note This method is threadsafe. + * + * \param user The Owner of that Buffer + * \param bufferId The buffer id + * \param MsgId The Message id where the marker line should be placed + */ + static inline void setBufferMarkerLineMsg(UserId user, const BufferId &bufferId, const MsgId &msgId) { + return instance()->_storage->setBufferMarkerLineMsg(user, bufferId, msgId); + } + + //! Get a Hash of all marker line message ids + /** This Method is called when the Quassel Core is started to restore the MarkerLineMsgIds + * \note This method is threadsafe. + * + * \param user The Owner of the buffers + */ + static inline QHash bufferMarkerLineMsgIds(UserId user) { + return instance()->_storage->bufferMarkerLineMsgIds(user); + } + const QDateTime &startTime() const { return _startTime; } static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; } + static const int AddClientEventId; + public slots: //! Make storage data persistent /** \note This method is threadsafe. */ void syncStorage(); void setupInternalClientSession(SignalProxy *proxy); + signals: //! Sent when a BufferInfo is updated in storage. void bufferInfoUpdated(UserId user, const BufferInfo &info); @@ -395,6 +420,9 @@ signals: //! Relay From CoreSession::sessionState(const QVariant &). Used for internal connection only void sessionState(const QVariant &); +protected: + virtual void customEvent(QEvent *event); + private slots: bool startListening(); void stopListening(const QString &msg = QString()); @@ -418,6 +446,7 @@ private: SessionThread *createSession(UserId userId, bool restoreState = false); void setupClientSession(QTcpSocket *socket, UserId uid); + void addClientHelper(QTcpSocket *socket, UserId uid); void processClientMessage(QTcpSocket *socket, const QVariantMap &msg); //void processCoreSetup(QTcpSocket *socket, QVariantMap &msg); QString setupCoreForInternalUsage();