]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_sqlauth.cpp
Fix various rline bugs, implement /stats R, and fix the issue where you get no error...
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlauth.cpp
index 18859d1333d62ffab2d40501d666c62868aa10d8..ffaf6e6058fbb6921e201b760c7bc8e00c95004e 100644 (file)
@@ -31,12 +31,12 @@ class ModuleSQLAuth : public Module
        std::string killreason;
        std::string allowpattern;
        std::string databaseid;
-       
+
        bool verbose;
-       
+
 public:
        ModuleSQLAuth(InspIRCd* Me)
-       : Module::Module(Me)
+       : Module(Me)
        {
                ServerInstance->Modules->UseInterface("SQLutils");
                ServerInstance->Modules->UseInterface("SQL");
@@ -74,12 +74,12 @@ public:
 
        virtual int OnUserRegister(User* user)
        {
-               if ((!allowpattern.empty()) && (ServerInstance->MatchText(user->nick,allowpattern)))
+               if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
                {
                        user->Extend("sqlauthed");
                        return 0;
                }
-               
+
                if (!CheckCredentials(user))
                {
                        ServerInstance->Users->QuitUser(user, killreason);
@@ -104,7 +104,7 @@ public:
        {
                std::string thisquery = freeformquery;
                std::string safepass = user->password;
-               
+
                /* Search and replace the escaped nick and escaped pass into the query */
 
                SearchAndReplace(safepass, "\"", "");
@@ -132,7 +132,7 @@ public:
 
                /* Build the query */
                SQLrequest req = SQLrequest(this, SQLprovider, databaseid, SQLquery(thisquery));
-                       
+
                if(req.Send())
                {
                        /* When we get the query response from the service provider we will be given an ID to play with,
@@ -143,7 +143,7 @@ public:
                         * us to discard the query.
                         */
                        AssociateUser(this, SQLutils, req.id, user).Send();
-                               
+
                        return true;
                }
                else
@@ -153,7 +153,7 @@ public:
                        return false;
                }
        }
-       
+
        virtual const char* OnRequest(Request* request)
        {
                if(strcmp(SQLRESID, request->GetId()) == 0)
@@ -162,10 +162,10 @@ public:
 
                        User* user = GetAssocUser(this, SQLutils, res->id).S().user;
                        UnAssociate(this, SQLutils, res->id).S();
-                       
+
                        if(user)
                        {
-                               if(res->error.Id() == NO_ERROR)
+                               if(res->error.Id() == SQL_NO_ERROR)
                                {
                                        if(res->Rows())
                                        {
@@ -195,16 +195,16 @@ public:
                                ServerInstance->Users->QuitUser(user, killreason);
                        }
                        return SQLSUCCESS;
-               }               
+               }
                return NULL;
        }
-       
+
        virtual void OnUserDisconnect(User* user)
        {
                user->Shrink("sqlauthed");
-               user->Shrink("sqlauth_failed");         
+               user->Shrink("sqlauth_failed");
        }
-       
+
        virtual bool OnCheckReady(User* user)
        {
                return user->GetExt("sqlauthed");
@@ -212,9 +212,9 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version(1,2,1,0,VF_VENDOR,API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
-       
+
 };
 
 MODULE_INIT(ModuleSQLAuth)