*/
#include <string>
-
#include "users.h"
#include "channels.h"
#include "modules.h"
{
InspIRCd* Srv;
Module* SQLutils;
+ Module* SQLprovider;
std::string usertable;
std::string userfield;
ModuleSQLAuth(InspIRCd* Me)
: Module::Module(Me), Srv(Me)
{
- SQLutils = Srv->FindFeature("SQLutils");
-
- if(SQLutils)
- {
- ServerInstance->Log(DEBUG, "Successfully got SQLutils pointer");
- }
- else
- {
- ServerInstance->Log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again.");
- throw ModuleException("This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again.");
- }
-
- OnRehash("");
+ ServerInstance->UseInterface("SQLutils");
+ ServerInstance->UseInterface("SQL");
+
+ SQLutils = ServerInstance->FindModule("m_sqlutils.so");
+ if (!SQLutils)
+ throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so.");
+
+ OnRehash(NULL,"");
+ }
+
+ virtual ~ModuleSQLAuth()
+ {
+ ServerInstance->DoneWithInterface("SQL");
+ ServerInstance->DoneWithInterface("SQLutils");
}
void Implements(char* List)
List[I_OnUserDisconnect] = List[I_OnCheckReady] = List[I_OnRequest] = List[I_OnRehash] = List[I_OnUserRegister] = 1;
}
- virtual void OnRehash(const std::string ¶meter)
+ virtual void OnRehash(userrec* user, const std::string ¶meter)
{
ConfigReader Conf(Srv);
return user->GetExt("sqlauthed");
}
- virtual ~ModuleSQLAuth()
- {
- }
-
virtual Version GetVersion()
{
return Version(1,1,1,0,VF_VENDOR,API_VERSION);