1 /***************************************************************************
2 * Copyright (C) 2005-2020 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 #include "core-export.h"
35 # include <QSslSocket>
37 # include "sslserver.h"
39 # include <QTcpServer>
40 # include <QTcpSocket>
43 #include "authenticator.h"
44 #include "bufferinfo.h"
45 #include "deferredptr.h"
46 #include "identserver.h"
48 #include "metricsserver.h"
49 #include "oidentdconfiggenerator.h"
50 #include "sessionthread.h"
51 #include "singleton.h"
55 class CoreAuthHandler;
63 class AbstractSqlMigrationReader;
64 class AbstractSqlMigrationWriter;
66 class CORE_EXPORT Core : public QObject, public Singleton<Core>
77 * Shuts down active core sessions, saves state and emits the shutdownComplete() signal afterwards.
81 /*** Storage access ***/
82 // These methods are threadsafe.
86 * \param userName The user's login name
87 * \param password The user's uncrypted password
88 * \return The user's ID if valid; 0 otherwise
90 static inline UserId validateUser(const QString& userName, const QString& password)
92 return instance()->_storage->validateUser(userName, password);
95 //! Authenticate user against auth backend
97 * \param userName The user's login name
98 * \param password The user's uncrypted password
99 * \return The user's ID if valid; 0 otherwise
101 static inline UserId authenticateUser(const QString& userName, const QString& password)
103 return instance()->_authenticator->validateUser(userName, password);
106 //! Add a new user, exposed so auth providers can call this without being the storage.
108 * \param userName The user's login name
109 * \param password The user's uncrypted password
110 * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database".
111 * \return The user's ID if valid; 0 otherwise
113 static inline UserId addUser(const QString& userName, const QString& password, const QString& authenticator = "Database")
115 return instance()->_storage->addUser(userName, password, authenticator);
118 //! Does a comparison test against the authenticator in the database and the authenticator currently in use for a UserID.
120 * \param userid The user's ID (note: not login name).
121 * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database".
122 * \return True if the userid was configured with the passed authenticator, false otherwise.
124 static inline bool checkAuthProvider(const UserId userid, const QString& authenticator)
126 return instance()->_storage->getUserAuthenticator(userid) == authenticator;
129 //! Gets the authenticator configured for a user.
131 * \param userName The user's name as a QString.
132 * \return String value corresponding to the user's configure dauthenticator.
134 static inline QString getUserAuthenticator(const QString& userName)
136 return instance()->_storage->getUserAuthenticator(instance()->_storage->getUserId(userName));
139 //! Gets the user ID mapped to a username. This is necessary so that non-database auth methods can log in users properly.
141 * \param userName The user's name as a QString.
142 * \return userId The user's ID.
144 static inline UserId getUserId(const QString& userName)
146 return instance()->_storage->getUserId(userName);
149 //! Change a user's password
151 * \param userId The user's ID
152 * \param password The user's unencrypted new password
153 * \return true, if the password change was successful
155 static bool changeUserPassword(UserId userId, const QString& password);
157 //! Check if we can change a user password.
159 * \param userID The user's ID
160 * \return true, if we can change their password, false otherwise
162 static bool canChangeUserPassword(UserId userId);
164 //! Store a user setting persistently
166 * \param userId The users Id
167 * \param settingName The Name of the Setting
168 * \param data The Value
170 static inline void setUserSetting(UserId userId, const QString& settingName, const QVariant& data)
172 instance()->_storage->setUserSetting(userId, settingName, data);
175 //! Retrieve a persistent user setting
177 * \param userId The users Id
178 * \param settingName The Name of the Setting
179 * \param defaultValue Value to return in case it's unset.
180 * \return the Value of the Setting or the default value if it is unset.
182 static inline QVariant getUserSetting(UserId userId, const QString& settingName, const QVariant& defaultValue = QVariant())
184 return instance()->_storage->getUserSetting(userId, settingName, defaultValue);
187 /* Identity handling */
188 static inline IdentityId createIdentity(UserId user, CoreIdentity& identity)
190 return instance()->_storage->createIdentity(user, identity);
193 static bool updateIdentity(UserId user, const CoreIdentity& identity) { return instance()->_storage->updateIdentity(user, identity); }
195 static void removeIdentity(UserId user, IdentityId identityId) { instance()->_storage->removeIdentity(user, identityId); }
197 static std::vector<CoreIdentity> identities(UserId user) { return instance()->_storage->identities(user); }
199 //! Create a Network in the Storage and store it's Id in the given NetworkInfo
200 /** \note This method is thredsafe.
202 * \param user The core user
203 * \param networkInfo a NetworkInfo definition to store the newly created ID in
204 * \return true if successfull.
206 static bool createNetwork(UserId user, NetworkInfo& info);
208 //! Apply the changes to NetworkInfo info to the storage engine
209 /** \note This method is thredsafe.
211 * \param user The core user
212 * \param networkInfo The Updated NetworkInfo
213 * \return true if successfull.
215 static inline bool updateNetwork(UserId user, const NetworkInfo& info) { return instance()->_storage->updateNetwork(user, info); }
217 //! Permanently remove a Network and all the data associated with it.
218 /** \note This method is thredsafe.
220 * \param user The core user
221 * \param networkId The network to delete
222 * \return true if successfull.
224 static inline bool removeNetwork(UserId user, const NetworkId& networkId)
226 return instance()->_storage->removeNetwork(user, networkId);
229 //! Returns a list of all NetworkInfos for the given UserId user
230 /** \note This method is thredsafe.
232 * \param user The core user
233 * \return std::vector<NetworkInfo>.
235 static inline std::vector<NetworkInfo> networks(UserId user) { return instance()->_storage->networks(user); }
237 //! Get a list of Networks to restore
238 /** Return a list of networks the user was connected at the time of core shutdown
239 * \note This method is threadsafe.
241 * \param user The User Id in question
243 static inline std::vector<NetworkId> connectedNetworks(UserId user) { return instance()->_storage->connectedNetworks(user); }
245 //! Update the connected state of a network
246 /** \note This method is threadsafe
248 * \param user The Id of the networks owner
249 * \param networkId The Id of the network
250 * \param isConnected whether the network is connected or not
252 static inline void setNetworkConnected(UserId user, const NetworkId& networkId, bool isConnected)
254 return instance()->_storage->setNetworkConnected(user, networkId, isConnected);
257 //! Get a hash of channels with their channel keys for a given network
258 /** The keys are channel names and values are passwords (possibly empty)
259 * \note This method is threadsafe
261 * \param user The id of the networks owner
262 * \param networkId The Id of the network
264 static inline QHash<QString, QString> persistentChannels(UserId user, const NetworkId& networkId)
266 return instance()->_storage->persistentChannels(user, networkId);
269 //! Update the connected state of a channel
270 /** \note This method is threadsafe
272 * \param user The Id of the networks owner
273 * \param networkId The Id of the network
274 * \param channel The name of the channel
275 * \param isJoined whether the channel is connected or not
277 static inline void setChannelPersistent(UserId user, const NetworkId& networkId, const QString& channel, bool isJoined)
279 return instance()->_storage->setChannelPersistent(user, networkId, channel, isJoined);
282 //! Get a hash of buffers with their ciphers for a given network
283 /** The keys are channel names and values are ciphers (possibly empty)
284 * \note This method is threadsafe
286 * \param user The id of the networks owner
287 * \param networkId The Id of the network
289 static inline QHash<QString, QByteArray> bufferCiphers(UserId user, const NetworkId& networkId)
291 return instance()->_storage->bufferCiphers(user, networkId);
294 //! Update the cipher of a buffer
295 /** \note This method is threadsafe
297 * \param user The Id of the networks owner
298 * \param networkId The Id of the network
299 * \param bufferName The Cname of the buffer
300 * \param cipher The cipher for the buffer
302 static inline void setBufferCipher(UserId user, const NetworkId& networkId, const QString& bufferName, const QByteArray& cipher)
304 return instance()->_storage->setBufferCipher(user, networkId, bufferName, cipher);
307 //! Update the key of a channel
308 /** \note This method is threadsafe
310 * \param user The Id of the networks owner
311 * \param networkId The Id of the network
312 * \param channel The name of the channel
313 * \param key The key of the channel (possibly empty)
315 static inline void setPersistentChannelKey(UserId user, const NetworkId& networkId, const QString& channel, const QString& key)
317 return instance()->_storage->setPersistentChannelKey(user, networkId, channel, key);
320 //! retrieve last known away message for session restore
321 /** \note This method is threadsafe
323 * \param user The Id of the networks owner
324 * \param networkId The Id of the network
326 static inline QString awayMessage(UserId user, NetworkId networkId) { return instance()->_storage->awayMessage(user, networkId); }
328 //! Make away message persistent for session restore
329 /** \note This method is threadsafe
331 * \param user The Id of the networks owner
332 * \param networkId The Id of the network
333 * \param awayMsg The current away message of own user
335 static inline void setAwayMessage(UserId user, NetworkId networkId, const QString& awayMsg)
337 return instance()->_storage->setAwayMessage(user, networkId, awayMsg);
340 //! retrieve last known user mode for session restore
341 /** \note This method is threadsafe
343 * \param user The Id of the networks owner
344 * \param networkId The Id of the network
346 static inline QString userModes(UserId user, NetworkId networkId) { return instance()->_storage->userModes(user, networkId); }
348 //! Make our user modes persistent for session restore
349 /** \note This method is threadsafe
351 * \param user The Id of the networks owner
352 * \param networkId The Id of the network
353 * \param userModes The current user modes of own user
355 static inline void setUserModes(UserId user, NetworkId networkId, const QString& userModes)
357 return instance()->_storage->setUserModes(user, networkId, userModes);
360 //! Get the unique BufferInfo for the given combination of network and buffername for a user.
361 /** \note This method is threadsafe.
363 * \param user The core user who owns this buffername
364 * \param networkId The network id
365 * \param type The type of the buffer (StatusBuffer, Channel, etc.)
366 * \param buffer The buffer name (if empty, the net's status buffer is returned)
367 * \param create Whether or not the buffer should be created if it doesnt exist
368 * \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found
370 static inline BufferInfo bufferInfo(
371 UserId user, const NetworkId& networkId, BufferInfo::Type type, const QString& buffer = "", bool create = true)
373 return instance()->_storage->bufferInfo(user, networkId, type, buffer, create);
376 //! Get the unique BufferInfo for a bufferId
377 /** \note This method is threadsafe
378 * \param user The core user who owns this buffername
379 * \param bufferId The id of the buffer
380 * \return The BufferInfo corresponding to the given buffer id, or an invalid BufferInfo if not found.
382 static inline BufferInfo getBufferInfo(UserId user, const BufferId& bufferId)
384 return instance()->_storage->getBufferInfo(user, bufferId);
387 //! Store a Message in the storage backend and set it's unique Id.
388 /** \note This method is threadsafe.
390 * \param message The message object to be stored
391 * \return true on success
393 static inline bool storeMessage(Message& message) { return instance()->_storage->logMessage(message); }
395 //! Store a list of Messages in the storage backend and set their unique Id.
396 /** \note This method is threadsafe.
398 * \param messages The list message objects to be stored
399 * \return true on success
401 static inline bool storeMessages(MessageList& messages) { return instance()->_storage->logMessages(messages); }
403 //! Request a certain number messages stored in a given buffer.
404 /** \param buffer The buffer we request messages from
405 * \param first if != -1 return only messages with a MsgId >= first
406 * \param last if != -1 return only messages with a MsgId < last
407 * \param limit if != -1 limit the returned list to a max of \limit entries
408 * \return The requested list of messages
410 static inline std::vector<Message> requestMsgs(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1, int limit = -1)
412 return instance()->_storage->requestMsgs(user, bufferId, first, last, limit);
415 //! Request a certain number messages stored in a given buffer, matching certain filters
416 /** \param buffer The buffer we request messages from
417 * \param first if != -1 return only messages with a MsgId >= first
418 * \param last if != -1 return only messages with a MsgId < last
419 * \param limit if != -1 limit the returned list to a max of \limit entries
420 * \param type The Message::Types that should be returned
421 * \return The requested list of messages
423 static inline std::vector<Message> requestMsgsFiltered(UserId user,
428 Message::Types type = Message::Types{-1},
429 Message::Flags flags = Message::Flags{-1})
431 return instance()->_storage->requestMsgsFiltered(user, bufferId, first, last, limit, type, flags);
434 //! Request a certain number of messages across all buffers
435 /** \param first if != -1 return only messages with a MsgId >= first
436 * \param last if != -1 return only messages with a MsgId < last
437 * \param limit Max amount of messages
438 * \return The requested list of messages
440 static inline std::vector<Message> requestAllMsgs(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1)
442 return instance()->_storage->requestAllMsgs(user, first, last, limit);
445 //! Request a certain number of messages across all buffers, matching certain filters
446 /** \param first if != -1 return only messages with a MsgId >= first
447 * \param last if != -1 return only messages with a MsgId < last
448 * \param limit Max amount of messages
449 * \param type The Message::Types that should be returned
450 * \return The requested list of messages
452 static inline std::vector<Message> requestAllMsgsFiltered(UserId user,
456 Message::Types type = Message::Types{-1},
457 Message::Flags flags = Message::Flags{-1})
459 return instance()->_storage->requestAllMsgsFiltered(user, first, last, limit, type, flags);
462 //! Request a list of all buffers known to a user.
463 /** This method is used to get a list of all buffers we have stored a backlog from.
464 * \note This method is threadsafe.
466 * \param user The user whose buffers we request
467 * \return A list of the BufferInfos for all buffers as requested
469 static inline std::vector<BufferInfo> requestBuffers(UserId user) { return instance()->_storage->requestBuffers(user); }
471 //! Request a list of BufferIds for a given NetworkId
472 /** \note This method is threadsafe.
474 * \param user The user whose buffers we request
475 * \param networkId The NetworkId of the network in question
476 * \return List of BufferIds belonging to the Network
478 static inline std::vector<BufferId> requestBufferIdsForNetwork(UserId user, NetworkId networkId)
480 return instance()->_storage->requestBufferIdsForNetwork(user, networkId);
483 //! Remove permanently a buffer and it's content from the storage backend
484 /** This call cannot be reverted!
485 * \note This method is threadsafe.
487 * \param user The user who is the owner of the buffer
488 * \param bufferId The bufferId
489 * \return true if successfull
491 static inline bool removeBuffer(const UserId& user, const BufferId& bufferId)
493 return instance()->_storage->removeBuffer(user, bufferId);
497 /** \note This method is threadsafe.
498 * \param user The id of the buffer owner
499 * \param bufferId The bufferId
500 * \param newName The new name of the buffer
501 * \return true if successfull
503 static inline bool renameBuffer(const UserId& user, const BufferId& bufferId, const QString& newName)
505 return instance()->_storage->renameBuffer(user, bufferId, newName);
508 //! Merge the content of two Buffers permanently. This cannot be reversed!
509 /** \note This method is threadsafe.
510 * \param user The id of the buffer owner
511 * \param bufferId1 The bufferId of the remaining buffer
512 * \param bufferId2 The buffer that is about to be removed
513 * \return true if successfulln
515 static inline bool mergeBuffersPermanently(const UserId& user, const BufferId& bufferId1, const BufferId& bufferId2)
517 return instance()->_storage->mergeBuffersPermanently(user, bufferId1, bufferId2);
520 //! Update the LastSeenDate for a Buffer
521 /** This Method is used to make the LastSeenDate of a Buffer persistent
522 * \note This method is threadsafe.
524 * \param user The Owner of that Buffer
525 * \param bufferId The buffer id
526 * \param MsgId The Message id of the message that has been just seen
528 static inline void setBufferLastSeenMsg(UserId user, const BufferId& bufferId, const MsgId& msgId)
530 return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId);
533 //! Get a usable sysident for the given user in oidentd-strict mode
534 /** \param user The user to retrieve the sysident for
535 * \return The authusername
537 QString strictSysIdent(UserId user) const;
539 //! Get a Hash of all last message ids
540 /** This Method is called when the Quassel Core is started to restore the lastMsgIds
541 * \note This method is threadsafe.
543 * \param user The Owner of the buffers
545 static inline QHash<BufferId, MsgId> bufferLastMsgIds(UserId user) { return instance()->_storage->bufferLastMsgIds(user); }
547 //! Get a Hash of all last seen message ids
548 /** This Method is called when the Quassel Core is started to restore the lastSeenMsgIds
549 * \note This method is threadsafe.
551 * \param user The Owner of the buffers
553 static inline QHash<BufferId, MsgId> bufferLastSeenMsgIds(UserId user) { return instance()->_storage->bufferLastSeenMsgIds(user); }
555 //! Update the MarkerLineMsgId for a Buffer
556 /** This Method is used to make the marker line position of a Buffer persistent
557 * \note This method is threadsafe.
559 * \param user The Owner of that Buffer
560 * \param bufferId The buffer id
561 * \param MsgId The Message id where the marker line should be placed
563 static inline void setBufferMarkerLineMsg(UserId user, const BufferId& bufferId, const MsgId& msgId)
565 return instance()->_storage->setBufferMarkerLineMsg(user, bufferId, msgId);
568 //! Get a Hash of all marker line message ids
569 /** This Method is called when the Quassel Core is started to restore the MarkerLineMsgIds
570 * \note This method is threadsafe.
572 * \param user The Owner of the buffers
574 static inline QHash<BufferId, MsgId> bufferMarkerLineMsgIds(UserId user) { return instance()->_storage->bufferMarkerLineMsgIds(user); }
576 //! Update the BufferActivity for a Buffer
577 /** This Method is used to make the activity state of a Buffer persistent
578 * \note This method is threadsafe.
580 * \param user The Owner of that Buffer
581 * \param bufferId The buffer id
582 * \param MsgId The Message id where the marker line should be placed
584 static inline void setBufferActivity(UserId user, BufferId bufferId, Message::Types activity)
586 return instance()->_storage->setBufferActivity(user, bufferId, activity);
589 //! Get a Hash of all buffer activity states
590 /** This Method is called when the Quassel Core is started to restore the BufferActivity
591 * \note This method is threadsafe.
593 * \param user The Owner of the buffers
595 static inline QHash<BufferId, Message::Types> bufferActivities(UserId user) { return instance()->_storage->bufferActivities(user); }
597 //! Get the bitset of buffer activity states for a buffer
598 /** This method is used to load the activity state of a buffer when its last seen message changes.
599 * \note This method is threadsafe.
601 * \param bufferId The buffer
602 * \param lastSeenMsgId The last seen message
604 static inline Message::Types bufferActivity(BufferId bufferId, MsgId lastSeenMsgId)
606 return instance()->_storage->bufferActivity(bufferId, lastSeenMsgId);
609 //! Update the highlight count for a Buffer
610 /** This Method is used to make the highlight count state of a Buffer persistent
611 * \note This method is threadsafe.
613 * \param user The Owner of that Buffer
614 * \param bufferId The buffer id
615 * \param MsgId The Message id where the marker line should be placed
617 static inline void setHighlightCount(UserId user, BufferId bufferId, int highlightCount)
619 return instance()->_storage->setHighlightCount(user, bufferId, highlightCount);
622 //! Get a Hash of all highlight count states
623 /** This Method is called when the Quassel Core is started to restore the highlight count
624 * \note This method is threadsafe.
626 * \param user The Owner of the buffers
628 static inline QHash<BufferId, int> highlightCounts(UserId user) { return instance()->_storage->highlightCounts(user); }
629 //! Get the highlight count states for a buffer
630 /** This method is used to load the highlight count of a buffer when its last seen message changes.
631 * \note This method is threadsafe.
633 * \param bufferId The buffer
634 * \param lastSeenMsgId The last seen message
636 static inline int highlightCount(BufferId bufferId, MsgId lastSeenMsgId)
638 return instance()->_storage->highlightCount(bufferId, lastSeenMsgId);
641 static inline QDateTime startTime() { return instance()->_startTime; }
642 static inline bool isConfigured() { return instance()->_configured; }
645 * Whether or not strict ident mode is enabled, locking users' idents to Quassel username
647 * @return True if strict mode enabled, otherwise false
649 static inline bool strictIdentEnabled() { return instance()->_strictIdentEnabled; }
651 static bool sslSupported();
653 static QVariantList backendInfo();
654 static QVariantList authenticatorInfo();
656 static QString setup(const QString& adminUser,
657 const QString& adminPassword,
658 const QString& backend,
659 const QVariantMap& setupData,
660 const QString& authenticator,
661 const QVariantMap& authSetupMap);
663 static inline QTimer* syncTimer() { return &instance()->_storageSyncTimer; }
665 inline OidentdConfigGenerator* oidentdConfigGenerator() const { return _oidentdConfigGenerator; }
666 inline IdentServer* identServer() const { return _identServer; }
667 inline MetricsServer* metricsServer() const { return _metricsServer; }
669 static const int AddClientEventId;
672 //! Sent when a BufferInfo is updated in storage.
673 void bufferInfoUpdated(UserId user, const BufferInfo& info);
675 //! Relay from CoreSession::sessionState(). Used for internal connection only
676 void sessionStateReceived(const Protocol::SessionState& sessionState);
678 //! Emitted when database schema upgrade starts or ends
679 void dbUpgradeInProgress(bool inProgress);
681 //! Emitted when a fatal error was encountered during async initialization
682 void exitRequested(int exitCode, const QString& reason);
684 //! Emitted once core shutdown is complete
685 void shutdownComplete();
692 * @note This method is threadsafe.
697 * Reload SSL certificates used for connection with clients.
699 * @return True if certificates reloaded successfully, otherwise false.
703 void cacheSysIdent();
705 QString setupCore(const QString& adminUser,
706 const QString& adminPassword,
707 const QString& backend,
708 const QVariantMap& setupData,
709 const QString& authenticator,
710 const QVariantMap& authSetupMap);
712 void connectInternalPeer(QPointer<InternalPeer> peer);
715 void customEvent(QEvent* event) override;
718 bool startListening();
719 void stopListening(const QString& msg = QString());
720 void incomingConnection();
721 void clientDisconnected();
723 bool initStorage(const QString& backend,
724 const QVariantMap& settings,
725 const QProcessEnvironment& environment,
726 bool loadFromEnvironment,
728 bool initAuthenticator(const QString& backend,
729 const QVariantMap& settings,
730 const QProcessEnvironment& environment,
731 bool loadFromEnvironment,
734 void socketError(QAbstractSocket::SocketError err, const QString& errorString);
735 void setupClientSession(RemotePeer*, UserId);
737 bool changeUserPass(const QString& username);
739 void onSessionShutdown(SessionThread* session);
742 SessionThread* sessionForUser(UserId userId, bool restoreState = false);
743 void addClientHelper(RemotePeer* peer, UserId uid);
744 // void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
745 QString setupCoreForInternalUsage();
746 void setupInternalClientSession(QPointer<InternalPeer> peer);
750 template<typename Storage>
751 void registerStorageBackend();
753 template<typename Authenticator>
754 void registerAuthenticator();
756 void registerStorageBackends();
757 void registerAuthenticators();
759 DeferredSharedPtr<Storage> storageBackend(const QString& backendId) const;
760 DeferredSharedPtr<Authenticator> authenticator(const QString& authenticatorId) const;
762 bool selectBackend(const QString& backend);
763 bool selectAuthenticator(const QString& backend);
765 bool saveBackendSettings(const QString& backend, const QVariantMap& settings);
766 void saveAuthenticatorSettings(const QString& backend, const QVariantMap& settings);
771 template<typename Backend>
772 QVariantMap promptForSettings(const Backend* backend);
775 static Core* _instance;
776 QSet<CoreAuthHandler*> _connectingClients;
777 QHash<UserId, SessionThread*> _sessions;
778 DeferredSharedPtr<Storage> _storage; ///< Active storage backend
779 DeferredSharedPtr<Authenticator> _authenticator; ///< Active authenticator
780 QMap<UserId, QString> _authUserNames;
782 QTimer _storageSyncTimer;
785 SslServer _server, _v6server;
787 QTcpServer _server, _v6server;
790 OidentdConfigGenerator* _oidentdConfigGenerator{nullptr};
792 std::vector<DeferredSharedPtr<Storage>> _registeredStorageBackends;
793 std::vector<DeferredSharedPtr<Authenticator>> _registeredAuthenticators;
795 QDateTime _startTime;
797 IdentServer* _identServer{nullptr};
798 MetricsServer* _metricsServer{nullptr};
800 bool _initialized{false};
801 bool _configured{false};
803 QPointer<InternalPeer> _pendingInternalConnection;
805 /// Whether or not strict ident mode is enabled, locking users' idents to Quassel username
806 bool _strictIdentEnabled;
808 static std::unique_ptr<AbstractSqlMigrationReader> getMigrationReader(Storage* storage);
809 static std::unique_ptr<AbstractSqlMigrationWriter> getMigrationWriter(Storage* storage);
810 static void stdInEcho(bool on);
811 static inline void enableStdInEcho() { stdInEcho(true); }
812 static inline void disableStdInEcho() { stdInEcho(false); }