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 "authenticator.h"
36 #include "bufferinfo.h"
37 #include "deferredptr.h"
38 #include "identserver.h"
40 #include "metricsserver.h"
41 #include "oidentdconfiggenerator.h"
42 #include "sessionthread.h"
43 #include "singleton.h"
44 #include "sslserver.h"
48 class CoreAuthHandler;
56 class AbstractSqlMigrationReader;
57 class AbstractSqlMigrationWriter;
59 class CORE_EXPORT Core : public QObject, public Singleton<Core>
70 * Shuts down active core sessions, saves state and emits the shutdownComplete() signal afterwards.
74 /*** Storage access ***/
75 // These methods are threadsafe.
79 * \param userName The user's login name
80 * \param password The user's uncrypted password
81 * \return The user's ID if valid; 0 otherwise
83 static inline UserId validateUser(const QString& userName, const QString& password)
85 return instance()->_storage->validateUser(userName, password);
88 //! Authenticate user against auth backend
90 * \param userName The user's login name
91 * \param password The user's uncrypted password
92 * \return The user's ID if valid; 0 otherwise
94 static inline UserId authenticateUser(const QString& userName, const QString& password)
96 return instance()->_authenticator->validateUser(userName, password);
99 //! Add a new user, exposed so auth providers can call this without being the storage.
101 * \param userName The user's login name
102 * \param password The user's uncrypted password
103 * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database".
104 * \return The user's ID if valid; 0 otherwise
106 static inline UserId addUser(const QString& userName, const QString& password, const QString& authenticator = "Database")
108 return instance()->_storage->addUser(userName, password, authenticator);
111 //! Does a comparison test against the authenticator in the database and the authenticator currently in use for a UserID.
113 * \param userid The user's ID (note: not login name).
114 * \param authenticator The name of the auth provider service used to log the user in, defaults to "Database".
115 * \return True if the userid was configured with the passed authenticator, false otherwise.
117 static inline bool checkAuthProvider(const UserId userid, const QString& authenticator)
119 return instance()->_storage->getUserAuthenticator(userid) == authenticator;
122 //! Gets the authenticator configured for a user.
124 * \param userName The user's name as a QString.
125 * \return String value corresponding to the user's configure dauthenticator.
127 static inline QString getUserAuthenticator(const QString& userName)
129 return instance()->_storage->getUserAuthenticator(instance()->_storage->getUserId(userName));
132 //! Gets the user ID mapped to a username. This is necessary so that non-database auth methods can log in users properly.
134 * \param userName The user's name as a QString.
135 * \return userId The user's ID.
137 static inline UserId getUserId(const QString& userName)
139 return instance()->_storage->getUserId(userName);
142 //! Change a user's password
144 * \param userId The user's ID
145 * \param password The user's unencrypted new password
146 * \return true, if the password change was successful
148 static bool changeUserPassword(UserId userId, const QString& password);
150 //! Check if we can change a user password.
152 * \param userID The user's ID
153 * \return true, if we can change their password, false otherwise
155 static bool canChangeUserPassword(UserId userId);
157 //! Store a user setting persistently
159 * \param userId The users Id
160 * \param settingName The Name of the Setting
161 * \param data The Value
163 static inline void setUserSetting(UserId userId, const QString& settingName, const QVariant& data)
165 instance()->_storage->setUserSetting(userId, settingName, data);
168 //! Retrieve a persistent user setting
170 * \param userId The users Id
171 * \param settingName The Name of the Setting
172 * \param defaultValue Value to return in case it's unset.
173 * \return the Value of the Setting or the default value if it is unset.
175 static inline QVariant getUserSetting(UserId userId, const QString& settingName, const QVariant& defaultValue = QVariant())
177 return instance()->_storage->getUserSetting(userId, settingName, defaultValue);
180 /* Identity handling */
181 static inline IdentityId createIdentity(UserId user, CoreIdentity& identity)
183 return instance()->_storage->createIdentity(user, identity);
186 static bool updateIdentity(UserId user, const CoreIdentity& identity) { return instance()->_storage->updateIdentity(user, identity); }
188 static void removeIdentity(UserId user, IdentityId identityId) { instance()->_storage->removeIdentity(user, identityId); }
190 static std::vector<CoreIdentity> identities(UserId user) { return instance()->_storage->identities(user); }
192 //! Create a Network in the Storage and store it's Id in the given NetworkInfo
193 /** \note This method is thredsafe.
195 * \param user The core user
196 * \param networkInfo a NetworkInfo definition to store the newly created ID in
197 * \return true if successfull.
199 static bool createNetwork(UserId user, NetworkInfo& info);
201 //! Apply the changes to NetworkInfo info to the storage engine
202 /** \note This method is thredsafe.
204 * \param user The core user
205 * \param networkInfo The Updated NetworkInfo
206 * \return true if successfull.
208 static inline bool updateNetwork(UserId user, const NetworkInfo& info) { return instance()->_storage->updateNetwork(user, info); }
210 //! Permanently remove a Network and all the data associated with it.
211 /** \note This method is thredsafe.
213 * \param user The core user
214 * \param networkId The network to delete
215 * \return true if successfull.
217 static inline bool removeNetwork(UserId user, const NetworkId& networkId)
219 return instance()->_storage->removeNetwork(user, networkId);
222 //! Returns a list of all NetworkInfos for the given UserId user
223 /** \note This method is thredsafe.
225 * \param user The core user
226 * \return std::vector<NetworkInfo>.
228 static inline std::vector<NetworkInfo> networks(UserId user) { return instance()->_storage->networks(user); }
230 //! Get a list of Networks to restore
231 /** Return a list of networks the user was connected at the time of core shutdown
232 * \note This method is threadsafe.
234 * \param user The User Id in question
236 static inline std::vector<NetworkId> connectedNetworks(UserId user) { return instance()->_storage->connectedNetworks(user); }
238 //! Update the connected state of a network
239 /** \note This method is threadsafe
241 * \param user The Id of the networks owner
242 * \param networkId The Id of the network
243 * \param isConnected whether the network is connected or not
245 static inline void setNetworkConnected(UserId user, const NetworkId& networkId, bool isConnected)
247 return instance()->_storage->setNetworkConnected(user, networkId, isConnected);
250 //! Get a hash of channels with their channel keys for a given network
251 /** The keys are channel names and values are passwords (possibly empty)
252 * \note This method is threadsafe
254 * \param user The id of the networks owner
255 * \param networkId The Id of the network
257 static inline QHash<QString, QString> persistentChannels(UserId user, const NetworkId& networkId)
259 return instance()->_storage->persistentChannels(user, networkId);
262 //! Update the connected state of a channel
263 /** \note This method is threadsafe
265 * \param user The Id of the networks owner
266 * \param networkId The Id of the network
267 * \param channel The name of the channel
268 * \param isJoined whether the channel is connected or not
270 static inline void setChannelPersistent(UserId user, const NetworkId& networkId, const QString& channel, bool isJoined)
272 return instance()->_storage->setChannelPersistent(user, networkId, channel, isJoined);
275 //! Get a hash of buffers with their ciphers for a given network
276 /** The keys are channel names and values are ciphers (possibly empty)
277 * \note This method is threadsafe
279 * \param user The id of the networks owner
280 * \param networkId The Id of the network
282 static inline QHash<QString, QByteArray> bufferCiphers(UserId user, const NetworkId& networkId)
284 return instance()->_storage->bufferCiphers(user, networkId);
287 //! Update the cipher of a buffer
288 /** \note This method is threadsafe
290 * \param user The Id of the networks owner
291 * \param networkId The Id of the network
292 * \param bufferName The Cname of the buffer
293 * \param cipher The cipher for the buffer
295 static inline void setBufferCipher(UserId user, const NetworkId& networkId, const QString& bufferName, const QByteArray& cipher)
297 return instance()->_storage->setBufferCipher(user, networkId, bufferName, cipher);
300 //! Update the key of a channel
301 /** \note This method is threadsafe
303 * \param user The Id of the networks owner
304 * \param networkId The Id of the network
305 * \param channel The name of the channel
306 * \param key The key of the channel (possibly empty)
308 static inline void setPersistentChannelKey(UserId user, const NetworkId& networkId, const QString& channel, const QString& key)
310 return instance()->_storage->setPersistentChannelKey(user, networkId, channel, key);
313 //! retrieve last known away message for session restore
314 /** \note This method is threadsafe
316 * \param user The Id of the networks owner
317 * \param networkId The Id of the network
319 static inline QString awayMessage(UserId user, NetworkId networkId) { return instance()->_storage->awayMessage(user, networkId); }
321 //! Make away message persistent for session restore
322 /** \note This method is threadsafe
324 * \param user The Id of the networks owner
325 * \param networkId The Id of the network
326 * \param awayMsg The current away message of own user
328 static inline void setAwayMessage(UserId user, NetworkId networkId, const QString& awayMsg)
330 return instance()->_storage->setAwayMessage(user, networkId, awayMsg);
333 //! retrieve last known user mode for session restore
334 /** \note This method is threadsafe
336 * \param user The Id of the networks owner
337 * \param networkId The Id of the network
339 static inline QString userModes(UserId user, NetworkId networkId) { return instance()->_storage->userModes(user, networkId); }
341 //! Make our user modes persistent for session restore
342 /** \note This method is threadsafe
344 * \param user The Id of the networks owner
345 * \param networkId The Id of the network
346 * \param userModes The current user modes of own user
348 static inline void setUserModes(UserId user, NetworkId networkId, const QString& userModes)
350 return instance()->_storage->setUserModes(user, networkId, userModes);
353 //! Get the unique BufferInfo for the given combination of network and buffername for a user.
354 /** \note This method is threadsafe.
356 * \param user The core user who owns this buffername
357 * \param networkId The network id
358 * \param type The type of the buffer (StatusBuffer, Channel, etc.)
359 * \param buffer The buffer name (if empty, the net's status buffer is returned)
360 * \param create Whether or not the buffer should be created if it doesnt exist
361 * \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found
363 static inline BufferInfo bufferInfo(
364 UserId user, const NetworkId& networkId, BufferInfo::Type type, const QString& buffer = "", bool create = true)
366 return instance()->_storage->bufferInfo(user, networkId, type, buffer, create);
369 //! Get the unique BufferInfo for a bufferId
370 /** \note This method is threadsafe
371 * \param user The core user who owns this buffername
372 * \param bufferId The id of the buffer
373 * \return The BufferInfo corresponding to the given buffer id, or an invalid BufferInfo if not found.
375 static inline BufferInfo getBufferInfo(UserId user, const BufferId& bufferId)
377 return instance()->_storage->getBufferInfo(user, bufferId);
380 //! Store a Message in the storage backend and set it's unique Id.
381 /** \note This method is threadsafe.
383 * \param message The message object to be stored
384 * \return true on success
386 static inline bool storeMessage(Message& message) { return instance()->_storage->logMessage(message); }
388 //! Store a list of Messages in the storage backend and set their unique Id.
389 /** \note This method is threadsafe.
391 * \param messages The list message objects to be stored
392 * \return true on success
394 static inline bool storeMessages(MessageList& messages) { return instance()->_storage->logMessages(messages); }
396 //! Request a certain number messages stored in a given buffer.
397 /** \param buffer The buffer we request messages from
398 * \param first if != -1 return only messages with a MsgId >= first
399 * \param last if != -1 return only messages with a MsgId < last
400 * \param limit if != -1 limit the returned list to a max of \limit entries
401 * \return The requested list of messages
403 static inline std::vector<Message> requestMsgs(UserId user, BufferId bufferId, MsgId first = -1, MsgId last = -1, int limit = -1)
405 return instance()->_storage->requestMsgs(user, bufferId, first, last, limit);
408 //! Request a certain number messages stored in a given buffer, matching certain filters
409 /** \param buffer The buffer we request messages from
410 * \param first if != -1 return only messages with a MsgId >= first
411 * \param last if != -1 return only messages with a MsgId < last
412 * \param limit if != -1 limit the returned list to a max of \limit entries
413 * \param type The Message::Types that should be returned
414 * \return The requested list of messages
416 static inline std::vector<Message> requestMsgsFiltered(UserId user,
421 Message::Types type = Message::Types{-1},
422 Message::Flags flags = Message::Flags{-1})
424 return instance()->_storage->requestMsgsFiltered(user, bufferId, first, last, limit, type, flags);
427 //! Request a certain number messages stored in a given buffer, matching certain filters, ascending
428 /** \param buffer The buffer we request messages from
429 * \param first if != -1 return only messages with a MsgId >= first
430 * \param last if != -1 return only messages with a MsgId < last
431 * \param limit if != -1 limit the returned list to a max of \limit entries
432 * \param type The Message::Types that should be returned
433 * \return The requested list of messages
435 static inline std::vector<Message> requestMsgsForward(UserId user,
440 Message::Types type = Message::Types{-1},
441 Message::Flags flags = Message::Flags{-1})
443 return instance()->_storage->requestMsgsForward(user, bufferId, first, last, limit, type, flags);
446 //! Request a certain number of messages across all buffers
447 /** \param first if != -1 return only messages with a MsgId >= first
448 * \param last if != -1 return only messages with a MsgId < last
449 * \param limit Max amount of messages
450 * \return The requested list of messages
452 static inline std::vector<Message> requestAllMsgs(UserId user, MsgId first = -1, MsgId last = -1, int limit = -1)
454 return instance()->_storage->requestAllMsgs(user, first, last, limit);
457 //! Request a certain number of messages across all buffers, matching certain filters
458 /** \param first if != -1 return only messages with a MsgId >= first
459 * \param last if != -1 return only messages with a MsgId < last
460 * \param limit Max amount of messages
461 * \param type The Message::Types that should be returned
462 * \return The requested list of messages
464 static inline std::vector<Message> requestAllMsgsFiltered(UserId user,
468 Message::Types type = Message::Types{-1},
469 Message::Flags flags = Message::Flags{-1})
471 return instance()->_storage->requestAllMsgsFiltered(user, first, last, limit, type, flags);
474 //! Request a list of all buffers known to a user.
475 /** This method is used to get a list of all buffers we have stored a backlog from.
476 * \note This method is threadsafe.
478 * \param user The user whose buffers we request
479 * \return A list of the BufferInfos for all buffers as requested
481 static inline std::vector<BufferInfo> requestBuffers(UserId user) { return instance()->_storage->requestBuffers(user); }
483 //! Request a list of BufferIds for a given NetworkId
484 /** \note This method is threadsafe.
486 * \param user The user whose buffers we request
487 * \param networkId The NetworkId of the network in question
488 * \return List of BufferIds belonging to the Network
490 static inline std::vector<BufferId> requestBufferIdsForNetwork(UserId user, NetworkId networkId)
492 return instance()->_storage->requestBufferIdsForNetwork(user, networkId);
495 //! Remove permanently a buffer and it's content from the storage backend
496 /** This call cannot be reverted!
497 * \note This method is threadsafe.
499 * \param user The user who is the owner of the buffer
500 * \param bufferId The bufferId
501 * \return true if successfull
503 static inline bool removeBuffer(const UserId& user, const BufferId& bufferId)
505 return instance()->_storage->removeBuffer(user, bufferId);
509 /** \note This method is threadsafe.
510 * \param user The id of the buffer owner
511 * \param bufferId The bufferId
512 * \param newName The new name of the buffer
513 * \return true if successfull
515 static inline bool renameBuffer(const UserId& user, const BufferId& bufferId, const QString& newName)
517 return instance()->_storage->renameBuffer(user, bufferId, newName);
520 //! Merge the content of two Buffers permanently. This cannot be reversed!
521 /** \note This method is threadsafe.
522 * \param user The id of the buffer owner
523 * \param bufferId1 The bufferId of the remaining buffer
524 * \param bufferId2 The buffer that is about to be removed
525 * \return true if successfulln
527 static inline bool mergeBuffersPermanently(const UserId& user, const BufferId& bufferId1, const BufferId& bufferId2)
529 return instance()->_storage->mergeBuffersPermanently(user, bufferId1, bufferId2);
532 //! Update the LastSeenDate for a Buffer
533 /** This Method is used to make the LastSeenDate of a Buffer persistent
534 * \note This method is threadsafe.
536 * \param user The Owner of that Buffer
537 * \param bufferId The buffer id
538 * \param MsgId The Message id of the message that has been just seen
540 static inline void setBufferLastSeenMsg(UserId user, const BufferId& bufferId, const MsgId& msgId)
542 return instance()->_storage->setBufferLastSeenMsg(user, bufferId, msgId);
545 //! Get a usable sysident for the given user in oidentd-strict mode
546 /** \param user The user to retrieve the sysident for
547 * \return The authusername
549 QString strictSysIdent(UserId user) const;
551 //! Get a Hash of all last message ids
552 /** This Method is called when the Quassel Core is started to restore the lastMsgIds
553 * \note This method is threadsafe.
555 * \param user The Owner of the buffers
557 static inline QHash<BufferId, MsgId> bufferLastMsgIds(UserId user) { return instance()->_storage->bufferLastMsgIds(user); }
559 //! Get a Hash of all last seen message ids
560 /** This Method is called when the Quassel Core is started to restore the lastSeenMsgIds
561 * \note This method is threadsafe.
563 * \param user The Owner of the buffers
565 static inline QHash<BufferId, MsgId> bufferLastSeenMsgIds(UserId user) { return instance()->_storage->bufferLastSeenMsgIds(user); }
567 //! Update the MarkerLineMsgId for a Buffer
568 /** This Method is used to make the marker line position of a Buffer persistent
569 * \note This method is threadsafe.
571 * \param user The Owner of that Buffer
572 * \param bufferId The buffer id
573 * \param MsgId The Message id where the marker line should be placed
575 static inline void setBufferMarkerLineMsg(UserId user, const BufferId& bufferId, const MsgId& msgId)
577 return instance()->_storage->setBufferMarkerLineMsg(user, bufferId, msgId);
580 //! Get a Hash of all marker line message ids
581 /** This Method is called when the Quassel Core is started to restore the MarkerLineMsgIds
582 * \note This method is threadsafe.
584 * \param user The Owner of the buffers
586 static inline QHash<BufferId, MsgId> bufferMarkerLineMsgIds(UserId user) { return instance()->_storage->bufferMarkerLineMsgIds(user); }
588 //! Update the BufferActivity for a Buffer
589 /** This Method is used to make the activity state of a Buffer persistent
590 * \note This method is threadsafe.
592 * \param user The Owner of that Buffer
593 * \param bufferId The buffer id
594 * \param MsgId The Message id where the marker line should be placed
596 static inline void setBufferActivity(UserId user, BufferId bufferId, Message::Types activity)
598 return instance()->_storage->setBufferActivity(user, bufferId, activity);
601 //! Get a Hash of all buffer activity states
602 /** This Method is called when the Quassel Core is started to restore the BufferActivity
603 * \note This method is threadsafe.
605 * \param user The Owner of the buffers
607 static inline QHash<BufferId, Message::Types> bufferActivities(UserId user) { return instance()->_storage->bufferActivities(user); }
609 //! Get the bitset of buffer activity states for a buffer
610 /** This method is used to load the activity state of a buffer when its last seen message changes.
611 * \note This method is threadsafe.
613 * \param bufferId The buffer
614 * \param lastSeenMsgId The last seen message
616 static inline Message::Types bufferActivity(BufferId bufferId, MsgId lastSeenMsgId)
618 return instance()->_storage->bufferActivity(bufferId, lastSeenMsgId);
621 //! Update the highlight count for a Buffer
622 /** This Method is used to make the highlight count state of a Buffer persistent
623 * \note This method is threadsafe.
625 * \param user The Owner of that Buffer
626 * \param bufferId The buffer id
627 * \param MsgId The Message id where the marker line should be placed
629 static inline void setHighlightCount(UserId user, BufferId bufferId, int highlightCount)
631 return instance()->_storage->setHighlightCount(user, bufferId, highlightCount);
634 //! Get a Hash of all highlight count states
635 /** This Method is called when the Quassel Core is started to restore the highlight count
636 * \note This method is threadsafe.
638 * \param user The Owner of the buffers
640 static inline QHash<BufferId, int> highlightCounts(UserId user) { return instance()->_storage->highlightCounts(user); }
641 //! Get the highlight count states for a buffer
642 /** This method is used to load the highlight count of a buffer when its last seen message changes.
643 * \note This method is threadsafe.
645 * \param bufferId The buffer
646 * \param lastSeenMsgId The last seen message
648 static inline int highlightCount(BufferId bufferId, MsgId lastSeenMsgId)
650 return instance()->_storage->highlightCount(bufferId, lastSeenMsgId);
653 static inline QDateTime startTime() { return instance()->_startTime; }
654 static inline bool isConfigured() { return instance()->_configured; }
657 * Whether or not strict ident mode is enabled, locking users' idents to Quassel username
659 * @return True if strict mode enabled, otherwise false
661 static inline bool strictIdentEnabled() { return instance()->_strictIdentEnabled; }
663 static bool sslSupported();
665 static QVariantList backendInfo();
666 static QVariantList authenticatorInfo();
668 static QString setup(const QString& adminUser,
669 const QString& adminPassword,
670 const QString& backend,
671 const QVariantMap& setupData,
672 const QString& authenticator,
673 const QVariantMap& authSetupMap);
675 static inline QTimer* syncTimer() { return &instance()->_storageSyncTimer; }
677 inline OidentdConfigGenerator* oidentdConfigGenerator() const { return _oidentdConfigGenerator; }
678 inline IdentServer* identServer() const { return _identServer; }
679 inline MetricsServer* metricsServer() const { return _metricsServer; }
681 static const int AddClientEventId;
684 //! Sent when a BufferInfo is updated in storage.
685 void bufferInfoUpdated(UserId user, const BufferInfo& info);
687 //! Relay from CoreSession::sessionState(). Used for internal connection only
688 void sessionStateReceived(const Protocol::SessionState& sessionState);
690 //! Emitted when database schema upgrade starts or ends
691 void dbUpgradeInProgress(bool inProgress);
693 //! Emitted when a fatal error was encountered during async initialization
694 void exitRequested(int exitCode, const QString& reason);
696 //! Emitted once core shutdown is complete
697 void shutdownComplete();
704 * @note This method is threadsafe.
709 * Reload SSL certificates used for connection with clients.
711 * @return True if certificates reloaded successfully, otherwise false.
715 void cacheSysIdent();
717 QString setupCore(const QString& adminUser,
718 const QString& adminPassword,
719 const QString& backend,
720 const QVariantMap& setupData,
721 const QString& authenticator,
722 const QVariantMap& authSetupMap);
724 void connectInternalPeer(QPointer<InternalPeer> peer);
727 void customEvent(QEvent* event) override;
730 bool startListening();
731 void stopListening(const QString& msg = QString());
732 void incomingConnection();
733 void clientDisconnected();
735 bool initStorage(const QString& backend,
736 const QVariantMap& settings,
737 const QProcessEnvironment& environment,
738 bool loadFromEnvironment,
740 bool initAuthenticator(const QString& backend,
741 const QVariantMap& settings,
742 const QProcessEnvironment& environment,
743 bool loadFromEnvironment,
746 void socketError(QAbstractSocket::SocketError err, const QString& errorString);
747 void setupClientSession(RemotePeer*, UserId);
749 bool changeUserPass(const QString& username);
751 void onSessionShutdown(SessionThread* session);
754 SessionThread* sessionForUser(UserId userId, bool restoreState = false);
755 void addClientHelper(RemotePeer* peer, UserId uid);
756 // void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
757 QString setupCoreForInternalUsage();
758 void setupInternalClientSession(QPointer<InternalPeer> peer);
762 template<typename Storage>
763 void registerStorageBackend();
765 template<typename Authenticator>
766 void registerAuthenticator();
768 void registerStorageBackends();
769 void registerAuthenticators();
771 DeferredSharedPtr<Storage> storageBackend(const QString& backendId) const;
772 DeferredSharedPtr<Authenticator> authenticator(const QString& authenticatorId) const;
774 bool selectBackend(const QString& backend);
775 bool selectAuthenticator(const QString& backend);
777 bool saveBackendSettings(const QString& backend, const QVariantMap& settings);
778 void saveAuthenticatorSettings(const QString& backend, const QVariantMap& settings);
783 template<typename Backend>
784 QVariantMap promptForSettings(const Backend* backend);
787 static Core* _instance;
788 QSet<CoreAuthHandler*> _connectingClients;
789 QHash<UserId, SessionThread*> _sessions;
790 DeferredSharedPtr<Storage> _storage; ///< Active storage backend
791 DeferredSharedPtr<Authenticator> _authenticator; ///< Active authenticator
792 QMap<UserId, QString> _authUserNames;
794 QTimer _storageSyncTimer;
796 SslServer _server, _v6server;
798 OidentdConfigGenerator* _oidentdConfigGenerator{nullptr};
800 std::vector<DeferredSharedPtr<Storage>> _registeredStorageBackends;
801 std::vector<DeferredSharedPtr<Authenticator>> _registeredAuthenticators;
803 QDateTime _startTime;
805 IdentServer* _identServer{nullptr};
806 MetricsServer* _metricsServer{nullptr};
808 bool _initialized{false};
809 bool _configured{false};
811 QPointer<InternalPeer> _pendingInternalConnection;
813 /// Whether or not strict ident mode is enabled, locking users' idents to Quassel username
814 bool _strictIdentEnabled;
816 static std::unique_ptr<AbstractSqlMigrationReader> getMigrationReader(Storage* storage);
817 static std::unique_ptr<AbstractSqlMigrationWriter> getMigrationWriter(Storage* storage);
818 static void stdInEcho(bool on);
819 static inline void enableStdInEcho() { stdInEcho(true); }
820 static inline void disableStdInEcho() { stdInEcho(false); }