public:
ModuleSQLOper(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->Modules->UseInterface("SQLutils");
ServerInstance->Modules->UseInterface("SQL");
ServerInstance->Modules->Attach(eventlist, this, 3);
}
+
+ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
+ {
+ std::stringstream hl(hostlist);
+ std::string xhost;
+ while (hl >> xhost)
+ {
+ if (InspIRCd::Match(host, xhost, NULL) || InspIRCd::MatchCIDR(ip, xhost, NULL))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
virtual void OnLoadModule(Module* mod, const std::string& name)
{
if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest"))
if (user)
{
- if (res->error.Id() == NO_ERROR)
+ if (res->error.Id() == SQL_NO_ERROR)
{
if (res->Rows())
{
for (SQLfieldMap& row = res->GetRowMap(); row.size(); row = res->GetRowMap())
{
- if (OperUser(user, row["username"].d, row["password"].d, row["hostname"].d, row["type"].d))
+ if (OperUser(user, row["hostname"].d, row["type"].d))
{
/* If/when one of the rows matches, stop checking and return */
return SQLSUCCESS;
}
}
- bool OperUser(User* user, const std::string &username, const std::string &password, const std::string &pattern, const std::string &type)
+ bool OperUser(User* user, const std::string &pattern, const std::string &type)
{
ConfigReader Conf(ServerInstance);