cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / src / core / core.h
index ce8693a..acbac95 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2020 by the Quassel Project                        *
+ *   Copyright (C) 2005-2022 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 
 #include <QDateTime>
 #include <QPointer>
+#include <QSslSocket>
 #include <QString>
 #include <QTimer>
 #include <QVariant>
 
-#ifdef HAVE_SSL
-#    include <QSslSocket>
-
-#    include "sslserver.h"
-#else
-#    include <QTcpServer>
-#    include <QTcpSocket>
-#endif
-
 #include "authenticator.h"
 #include "bufferinfo.h"
 #include "deferredptr.h"
@@ -49,6 +41,7 @@
 #include "oidentdconfiggenerator.h"
 #include "sessionthread.h"
 #include "singleton.h"
+#include "sslserver.h"
 #include "storage.h"
 #include "types.h"
 
@@ -201,7 +194,7 @@ public:
      *
      *  \param user        The core user
      *  \param networkInfo a NetworkInfo definition to store the newly created ID in
-     *  \return true if successfull.
+     *  \return true if successful.
      */
     static bool createNetwork(UserId user, NetworkInfo& info);
 
@@ -210,7 +203,7 @@ public:
      *
      *  \param user        The core user
      *  \param networkInfo The Updated NetworkInfo
-     *  \return true if successfull.
+     *  \return true if successful.
      */
     static inline bool updateNetwork(UserId user, const NetworkInfo& info) { return instance()->_storage->updateNetwork(user, info); }
 
@@ -219,7 +212,7 @@ public:
      *
      *  \param user        The core user
      *  \param networkId   The network to delete
-     *  \return true if successfull.
+     *  \return true if successful.
      */
     static inline bool removeNetwork(UserId user, const NetworkId& networkId)
     {
@@ -364,7 +357,7 @@ public:
      *  \param networkId The network id
      *  \param type      The type of the buffer (StatusBuffer, Channel, etc.)
      *  \param buffer    The buffer name (if empty, the net's status buffer is returned)
-     *  \param create    Whether or not the buffer should be created if it doesnt exist
+     *  \param create    Whether or not the buffer should be created if it doesn't exist
      *  \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found
      */
     static inline BufferInfo bufferInfo(
@@ -431,6 +424,26 @@ public:
         return instance()->_storage->requestMsgsFiltered(user, bufferId, first, last, limit, type, flags);
     }
 
+    //! Request a certain number messages stored in a given buffer, matching certain filters, ascending
+    /** \param buffer   The buffer we request messages from
+     *  \param first    if != -1 return only messages with a MsgId >= first
+     *  \param last     if != -1 return only messages with a MsgId < last
+     *  \param limit    if != -1 limit the returned list to a max of \limit entries
+     *  \param type     The Message::Types that should be returned
+     *  \param flags     The Message::Flags that should be returned
+     *  \return The requested list of messages
+     */
+    static inline std::vector<Message> requestMsgsForward(UserId user,
+                                                           BufferId bufferId,
+                                                           MsgId first = -1,
+                                                           MsgId last = -1,
+                                                           int limit = -1,
+                                                           Message::Types type = Message::Types{-1},
+                                                           Message::Flags flags = Message::Flags{-1})
+    {
+        return instance()->_storage->requestMsgsForward(user, bufferId, first, last, limit, type, flags);
+    }
+
     //! Request a certain number of messages across all buffers
     /** \param first    if != -1 return only messages with a MsgId >= first
      *  \param last     if != -1 return only messages with a MsgId < last
@@ -486,7 +499,7 @@ public:
      *
      *  \param user      The user who is the owner of the buffer
      *  \param bufferId  The bufferId
-     *  \return true if successfull
+     *  \return true if successful
      */
     static inline bool removeBuffer(const UserId& user, const BufferId& bufferId)
     {
@@ -498,7 +511,7 @@ public:
      *  \param user      The id of the buffer owner
      *  \param bufferId  The bufferId
      *  \param newName   The new name of the buffer
-     *  \return true if successfull
+     *  \return true if successful
      */
     static inline bool renameBuffer(const UserId& user, const BufferId& bufferId, const QString& newName)
     {
@@ -510,7 +523,7 @@ public:
      *  \param user      The id of the buffer owner
      *  \param bufferId1 The bufferId of the remaining buffer
      *  \param bufferId2 The buffer that is about to be removed
-     *  \return true if successfulln
+     *  \return true if successful
      */
     static inline bool mergeBuffersPermanently(const UserId& user, const BufferId& bufferId1, const BufferId& bufferId2)
     {
@@ -536,6 +549,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<BufferId, MsgId> 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.
@@ -773,11 +794,7 @@ private:
 
     QTimer _storageSyncTimer;
 
-#ifdef HAVE_SSL
     SslServer _server, _v6server;
-#else
-    QTcpServer _server, _v6server;
-#endif
 
     OidentdConfigGenerator* _oidentdConfigGenerator{nullptr};