Make authenticator changes to protocol backwards-compatible
[quassel.git] / src / core / core.h
index f63a32b..644e9b9 100644 (file)
@@ -85,6 +85,16 @@ public:
         return instance()->_authenticator->validateUser(userName, password);
     }
 
+    //! Add a new user, exposed so auth providers can call this without being the storage.
+    /**
+     * \param userName The user's login name
+     * \param password The user's uncrypted password
+     * \return The user's ID if valid; 0 otherwise
+     */
+    static inline UserId addUser(const QString &userName, const QString &password) {
+        return instance()->_storage->addUser(userName, password);
+    }
+
     //! Change a user's password
     /**
      * \param userId     The user's ID
@@ -562,7 +572,7 @@ private slots:
 
     bool initStorage(const QString &backend, const QVariantMap &settings, bool setup = false);
     bool initAuthenticator(const QString &backend, const QVariantMap &settings, bool setup = false);
-    
+
     void socketError(QAbstractSocket::SocketError err, const QString &errorString);
     void setupClientSession(RemotePeer *, UserId);
 
@@ -583,12 +593,12 @@ private:
     bool registerStorageBackend(Storage *);
     void unregisterStorageBackends();
     void unregisterStorageBackend(Storage *);
-    
+
     void registerAuthenticatorBackends();
     bool registerAuthenticatorBackend(Authenticator *);
     void unregisterAuthenticatorBackends();
     void unregisterAuthenticatorBackend(Authenticator *);
-    
+
     bool selectBackend(const QString &backend);
     bool createUser();
     bool saveBackendSettings(const QString &backend, const QVariantMap &settings);