X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fcore.h;h=4428f023e367eea535ba6fc7bd17ab7c6b7be706;hb=c0d6dc0dec628f2e143e37ecc95cec45e636f8a5;hp=994e473ba5b3d78c2415dd7d0be8e2112ab28a3d;hpb=8efbb2ef22f5f007b5dc6d5b15ecf070ccef08ca;p=quassel.git diff --git a/src/core/core.h b/src/core/core.h index 994e473b..4428f023 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2019 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -27,27 +27,21 @@ #include #include +#include #include #include #include -#ifdef HAVE_SSL -# include - -# include "sslserver.h" -#else -# include -# include -#endif - #include "authenticator.h" #include "bufferinfo.h" #include "deferredptr.h" #include "identserver.h" #include "message.h" +#include "metricsserver.h" #include "oidentdconfiggenerator.h" #include "sessionthread.h" #include "singleton.h" +#include "sslserver.h" #include "storage.h" #include "types.h" @@ -127,7 +121,7 @@ public: //! Gets the authenticator configured for a user. /** - * \param userid The user's name as a QString. + * \param userName The user's name as a QString. * \return String value corresponding to the user's configure dauthenticator. */ static inline QString getUserAuthenticator(const QString& userName) @@ -135,6 +129,16 @@ public: return instance()->_storage->getUserAuthenticator(instance()->_storage->getUserId(userName)); } + //! Gets the user ID mapped to a username. This is necessary so that non-database auth methods can log in users properly. + /** + * \param userName The user's name as a QString. + * \return userId The user's ID. + */ + static inline UserId getUserId(const QString& userName) + { + return instance()->_storage->getUserId(userName); + } + //! Change a user's password /** * \param userId The user's ID @@ -183,7 +187,7 @@ public: static void removeIdentity(UserId user, IdentityId identityId) { instance()->_storage->removeIdentity(user, identityId); } - static QList identities(UserId user) { return instance()->_storage->identities(user); } + static std::vector identities(UserId user) { return instance()->_storage->identities(user); } //! Create a Network in the Storage and store it's Id in the given NetworkInfo /** \note This method is thredsafe. @@ -219,9 +223,9 @@ public: /** \note This method is thredsafe. * * \param user The core user - * \return QList. + * \return std::vector. */ - static inline QList networks(UserId user) { return instance()->_storage->networks(user); } + static inline std::vector networks(UserId user) { return instance()->_storage->networks(user); } //! Get a list of Networks to restore /** Return a list of networks the user was connected at the time of core shutdown @@ -229,7 +233,7 @@ public: * * \param user The User Id in question */ - static inline QList connectedNetworks(UserId user) { return instance()->_storage->connectedNetworks(user); } + static inline std::vector connectedNetworks(UserId user) { return instance()->_storage->connectedNetworks(user); } //! Update the connected state of a network /** \note This method is threadsafe @@ -396,7 +400,7 @@ public: * \param limit if != -1 limit the returned list to a max of \limit entries * \return The requested list of messages */ - static inline QList requestMsgs(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1, int limit = -1) + static inline std::vector requestMsgs(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1, int limit = -1) { return instance()->_storage->requestMsgs(user, bufferId, first, last, limit); } @@ -409,7 +413,7 @@ public: * \param type The Message::Types that should be returned * \return The requested list of messages */ - static inline QList requestMsgsFiltered(UserId user, + static inline std::vector requestMsgsFiltered(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1, @@ -426,7 +430,7 @@ public: * \param limit Max amount of messages * \return The requested list of messages */ - static inline QList requestAllMsgs(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1) + static inline std::vector requestAllMsgs(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1) { return instance()->_storage->requestAllMsgs(user, first, last, limit); } @@ -438,7 +442,7 @@ public: * \param type The Message::Types that should be returned * \return The requested list of messages */ - static inline QList requestAllMsgsFiltered(UserId user, + static inline std::vector requestAllMsgsFiltered(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1, @@ -455,7 +459,7 @@ public: * \param user The user whose buffers we request * \return A list of the BufferInfos for all buffers as requested */ - static inline QList requestBuffers(UserId user) { return instance()->_storage->requestBuffers(user); } + static inline std::vector requestBuffers(UserId user) { return instance()->_storage->requestBuffers(user); } //! Request a list of BufferIds for a given NetworkId /** \note This method is threadsafe. @@ -464,7 +468,7 @@ public: * \param networkId The NetworkId of the network in question * \return List of BufferIds belonging to the Network */ - static inline QList requestBufferIdsForNetwork(UserId user, NetworkId networkId) + static inline std::vector requestBufferIdsForNetwork(UserId user, NetworkId networkId) { return instance()->_storage->requestBufferIdsForNetwork(user, networkId); } @@ -525,6 +529,14 @@ public: */ QString strictSysIdent(UserId user) const; + //! Get a Hash of all last message ids + /** This Method is called when the Quassel Core is started to restore the lastMsgIds + * \note This method is threadsafe. + * + * \param user The Owner of the buffers + */ + static inline QHash bufferLastMsgIds(UserId user) { return instance()->_storage->bufferLastMsgIds(user); } + //! Get a Hash of all last seen message ids /** This Method is called when the Quassel Core is started to restore the lastSeenMsgIds * \note This method is threadsafe. @@ -645,6 +657,7 @@ public: inline OidentdConfigGenerator* oidentdConfigGenerator() const { return _oidentdConfigGenerator; } inline IdentServer* identServer() const { return _identServer; } + inline MetricsServer* metricsServer() const { return _metricsServer; } static const int AddClientEventId; @@ -761,11 +774,7 @@ private: QTimer _storageSyncTimer; -#ifdef HAVE_SSL SslServer _server, _v6server; -#else - QTcpServer _server, _v6server; -#endif OidentdConfigGenerator* _oidentdConfigGenerator{nullptr}; @@ -775,6 +784,7 @@ private: QDateTime _startTime; IdentServer* _identServer{nullptr}; + MetricsServer* _metricsServer{nullptr}; bool _initialized{false}; bool _configured{false};