* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
*/
#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
-#include "configreader.h"
-
#include "m_sqlv2.h"
#include "m_sqlutils.h"
#include "m_hash.h"
public:
ModuleSQLOper(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->Modules->UseInterface("SQLutils");
ServerInstance->Modules->UseInterface("SQL");
ServerInstance->Modules->UseInterface("HashRequest");
- OnRehash(NULL, "");
+ OnRehash(NULL);
diduseiface = false;
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, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(ip, xhost, ascii_case_insensitive_map))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
virtual void OnLoadModule(Module* mod, const std::string& name)
{
if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest"))
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
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);
if (operhost.size())
user->ChangeDisplayedHost(operhost.c_str());
- ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), type.c_str());
- user->WriteNumeric(381, "%s :You are now %s %s",user->nick.c_str(), strchr("aeiouAEIOU", type[0]) ? "an" : "a", irc::Spacify(type.c_str()));
-
- if (!user->modes[UM_OPERATOR])
- user->Oper(type, tname);
-
+ user->Oper(type, tname);
return true;
}
}
virtual Version GetVersion()
{
- return Version(1,2,1,0,VF_VENDOR,API_VERSION);
+ return Version("$Id$", VF_VENDOR, API_VERSION);
}
};