]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_sqlauth.cpp
All of insp now builds with -pedantic (theres some warnings to squash in modules...
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlauth.cpp
index 6b05ee521f8907aba943359e541e964ca50cface..98b0227e5ad3157927e4dac3ace89fdab33c6bc3 100644 (file)
@@ -40,14 +40,14 @@ public:
        ModuleSQLAuth(InspIRCd* Me)
        : Module::Module(Me)
        {
-               ServerInstance->UseInterface("SQLutils");
-               ServerInstance->UseInterface("SQL");
+               ServerInstance->Modules->UseInterface("SQLutils");
+               ServerInstance->Modules->UseInterface("SQL");
 
-               SQLutils = ServerInstance->FindModule("m_sqlutils.so");
+               SQLutils = ServerInstance->Modules->Find("m_sqlutils.so");
                if (!SQLutils)
                        throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so.");
 
-               SQLprovider = ServerInstance->FindFeature("SQL");
+               SQLprovider = ServerInstance->Modules->FindFeature("SQL");
                if (!SQLprovider)
                        throw ModuleException("Can't find an SQL provider module. Please load one before attempting to load m_sqlauth.");
 
@@ -56,8 +56,8 @@ public:
 
        virtual ~ModuleSQLAuth()
        {
-               ServerInstance->DoneWithInterface("SQL");
-               ServerInstance->DoneWithInterface("SQLutils");
+               ServerInstance->Modules->DoneWithInterface("SQL");
+               ServerInstance->Modules->DoneWithInterface("SQLutils");
        }
 
        void Implements(char* List)
@@ -65,7 +65,7 @@ public:
                List[I_OnUserDisconnect] = List[I_OnCheckReady] = List[I_OnRequest] = List[I_OnRehash] = List[I_OnUserRegister] = 1;
        }
 
-       virtual void OnRehash(userrec* user, const std::string &parameter)
+       virtual void OnRehash(User* user, const std::string &parameter)
        {
                ConfigReader Conf(ServerInstance);
                
@@ -86,7 +86,7 @@ public:
                }
        }       
 
-       virtual int OnUserRegister(userrec* user)
+       virtual int OnUserRegister(User* user)
        {
                if ((!allowpattern.empty()) && (ServerInstance->MatchText(user->nick,allowpattern)))
                {
@@ -96,20 +96,20 @@ public:
                
                if (!CheckCredentials(user))
                {
-                       userrec::QuitUser(ServerInstance,user,killreason);
+                       User::QuitUser(ServerInstance,user,killreason);
                        return 1;
                }
                return 0;
        }
 
-       bool CheckCredentials(userrec* user)
+       bool CheckCredentials(User* user)
        {
                SQLrequest req = SQLreq(this, SQLprovider, databaseid, "SELECT ? FROM ? WHERE ? = '?' AND ? = ?'?')", userfield, usertable, userfield, user->nick, passfield, encryption, user->password);
                        
                if(req.Send())
                {
                        /* When we get the query response from the service provider we will be given an ID to play with,
-                        * just an ID number which is unique to this query. We need a way of associating that ID with a userrec
+                        * just an ID number which is unique to this query. We need a way of associating that ID with a User
                         * so we insert it into a map mapping the IDs to users.
                         * Thankfully m_sqlutils provides this, it will associate a ID with a user or channel, and if the user quits it removes the
                         * association. This means that if the user quits during a query we will just get a failed lookup from m_sqlutils - telling
@@ -133,7 +133,7 @@ public:
                {
                        SQLresult* res = static_cast<SQLresult*>(request);
 
-                       userrec* user = GetAssocUser(this, SQLutils, res->id).S().user;
+                       User* user = GetAssocUser(this, SQLutils, res->id).S().user;
                        UnAssociate(this, SQLutils, res->id).S();
                        
                        if(user)
@@ -165,20 +165,20 @@ public:
 
                        if (!user->GetExt("sqlauthed"))
                        {
-                               userrec::QuitUser(ServerInstance,user,killreason);
+                               User::QuitUser(ServerInstance,user,killreason);
                        }
                        return SQLSUCCESS;
                }               
                return NULL;
        }
        
-       virtual void OnUserDisconnect(userrec* user)
+       virtual void OnUserDisconnect(User* user)
        {
                user->Shrink("sqlauthed");
                user->Shrink("sqlauth_failed");         
        }
        
-       virtual bool OnCheckReady(userrec* user)
+       virtual bool OnCheckReady(User* user)
        {
                return user->GetExt("sqlauthed");
        }
@@ -190,5 +190,4 @@ public:
        
 };
 
-MODULE_INIT(ModuleSQLAuth);
-
+MODULE_INIT(ModuleSQLAuth)