*/
std::string RehashUserUID;
- /** Rehash parameter, as above
- */
- std::string RehashParameter;
-
/** Error stream, contains error output from any failed configuration parsing.
*/
std::ostringstream* errstr;
/** This member holds a pointer to arbitary data set by the emitter of the message
*/
char* data;
- /** This should be a null-terminated string identifying the type of request,
- * all modules should define this and use it to determine the nature of the
- * request before they attempt to cast the Request in any way.
- */
- const char* id;
+ /** This should be a null-terminated string identifying the type of request,
+ * all modules should define this and use it to determine the nature of the
+ * request before they attempt to cast the Request in any way.
+ */
+ const char* id;
/** This is a pointer to the sender of the message, which can be used to
* directly trigger events, or to create a reply.
*/
Module* dest;
public:
/** Create a new Request
- * This is for the 'old' way of casting whatever the data is
- * to char* and hoping you get the right thing at the other end.
- * This is slowly being depreciated in favor of the 'new' way.
+ * This is for the 'old' way of casting whatever the data is
+ * to char* and hoping you get the right thing at the other end.
+ * This is slowly being depreciated in favor of the 'new' way.
*/
Request(char* anydata, Module* src, Module* dst);
- /** Create a new Request
- * This is for the 'new' way of defining a subclass
- * of Request and defining it in a common header,
+ /** Create a new Request
+ * This is for the 'new' way of defining a subclass
+ * of Request and defining it in a common header,
* passing an object of your Request subclass through
- * as a Request* and using the ID string to determine
- * what to cast it back to and the other end. This is
- * much safer as there are no casts not confirmed by
- * the ID string, and all casts are child->parent and
- * can be checked at runtime with dynamic_cast<>()
- */
- Request(Module* src, Module* dst, const char* idstr);
+ * as a Request* and using the ID string to determine
+ * what to cast it back to and the other end. This is
+ * much safer as there are no casts not confirmed by
+ * the ID string, and all casts are child->parent and
+ * can be checked at runtime with dynamic_cast<>()
+ */
+ Request(Module* src, Module* dst, const char* idstr);
/** Fetch the Request data
*/
char* GetData();
- /** Fetch the ID string
+ /** Fetch the ID string
*/
const char* GetId();
/** Fetch the request source
I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode,
I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData,
I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddLine,
- I_OnDelLine, I_OnExpireLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule,
- I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, I_OnRawMode,
+ I_OnDelLine, I_OnExpireLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill,
+ I_OnLoadModule, I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, I_OnRawMode,
I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnCheckExtBan, I_OnCheckStringExtBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos,
I_OnLocalTopicChange, I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan,
I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnUserList,
I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed,
I_OnText, I_OnPassCompare, I_OnRunTestSuite, I_OnNamesListItem, I_OnNumeric, I_OnHookUserIO, I_OnHostCycle,
+ I_OnPreRehash, I_OnModuleRehash,
I_END
};
/** Called on rehash.
* This method is called prior to a /REHASH or when a SIGHUP is received from the operating
- * system. You should use it to reload any files so that your module keeps in step with the
- * rest of the application. If a parameter is given, the core has done nothing. The module
- * receiving the event can decide if this parameter has any relevence to it.
- * @param user The user performing the rehash, if any -- if this is server initiated, the
- * value of this variable will be NULL.
- * @param parameter The (optional) parameter given to REHASH from the user.
+ * system. This is called in all cases -- including when this server will not execute the
+ * rehash because it is directed at a remote server.
+ *
+ * @param user The user performing the rehash, if any. If this is server initiated, the value of
+ * this variable will be NULL.
+ * @param parameter The (optional) parameter given to REHASH from the user. Empty when server
+ * initiated.
+ */
+ virtual void OnPreRehash(User* user, const std::string ¶meter);
+
+ /** Called on rehash.
+ * This method is called when a user initiates a module-specific rehash. This can be used to do
+ * expensive operations (such as reloading SSL certificates) that are not executed on a normal
+ * rehash for efficiency. A rehash of this type does not reload the core configuration.
+ *
+ * @param user The user performing the rehash.
+ * @param parameter The parameter given to REHASH
+ */
+ virtual void OnModuleRehash(User* user, const std::string ¶meter);
+
+ /** Called on rehash.
+ * This method is called after a rehash has completed. You should use it to reload any module
+ * configuration from the main configuration file.
+ * @param user The user that performed the rehash, if it was initiated by a user and that user
+ * is still connected.
*/
- virtual void OnRehash(User* user, const std::string ¶meter);
+ virtual void OnRehash(User* user);
/** Called whenever a snotice is about to be sent to a snomask.
* snomask and type may both be modified; the message may not.
*/
std::string LastModuleError;
- /** The feature names published by various modules
+ /** The feature names published by various modules
*/
featurelist Features;
#include "commands/cmd_rehash.h"
-
extern "C" DllExport Command* init_command(InspIRCd* Instance)
{
return new CommandRehash(Instance);
CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, User *user)
{
- std::string old_disabled = ServerInstance->Config->DisabledCommands;
+ std::string param = parameters.size() ? parameters[0] : "";
+
+ FOREACH_MOD(I_OnPreRehash,OnPreRehash(user, param));
- if (parameters.size() && parameters[0][0] != '-')
+ if (param.empty())
{
+ // standard rehash of local server
+ }
+ else if (param.find_first_of("*.") != std::string::npos)
+ {
+ // rehash of servers by server name (with wildcard)
if (!InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0]))
{
- FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
- return CMD_SUCCESS; // rehash for a server, and not for us
+ // Doesn't match us. PreRehash is already done, nothing left to do
+ return CMD_SUCCESS;
}
}
- else if (parameters.size())
+ else
{
- FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
- return CMD_SUCCESS;
- }
+ // parameterized rehash
- // Rehash for me.
- FOREACH_MOD(I_OnRehash,OnRehash(user, ""));
-
- if (IS_LOCAL(user))
- user->WriteNumeric(RPL_REHASHING, "%s %s :Rehashing",user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
- else
- ServerInstance->PI->SendUserNotice(user, std::string("*** Rehashing server ") + ServerInstance->ConfigFileName);
+ // the leading "-" is optional; remove it if present.
+ if (param[0] == '-')
+ param = param.substr(1);
+ FOREACH_MOD(I_OnModuleRehash,OnModuleRehash(user, param));
+ return CMD_SUCCESS;
+ }
+ // Rehash for me. Try to start the rehash thread
if (!ServerInstance->ConfigThread)
{
std::string m = user->nick + " is rehashing config file " + ServerConfig::CleanFilename(ServerInstance->ConfigFileName) + " on " + ServerInstance->Config->ServerName;
ServerInstance->SNO->WriteGlobalSno('a', m);
+ if (IS_LOCAL(user))
+ user->WriteNumeric(RPL_REHASHING, "%s %s :Rehashing",
+ user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
+ else
+ ServerInstance->PI->SendUserNotice(user, std::string("*** Rehashing server ") +
+ ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
+
/* Don't do anything with the logs here -- logs are restarted
* after the config thread has completed.
*/
ServerInstance->Config->RehashUserUID = user->uuid;
- ServerInstance->Config->RehashParameter = parameters.size() ? parameters[0] : "";
ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, ServerInstance->Config->RehashUserUID);
ServerInstance->Threads->Start(ServerInstance->ConfigThread);
+
+ return CMD_SUCCESS;
}
else
{
return CMD_FAILURE;
}
-
- return CMD_SUCCESS;
}
this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up...");
- /* These are currently not known to be threadsafe, so they are executed outside
- * of the thread. It would be pretty simple to move them to the thread Run method
- * once they are known threadsafe with all the correct mutexes in place. This might
- * not be worth the effort however as these functions execute relatively quickly
- * and would not benefit from being within the config read thread.
+ /*
+ * Apply the changed configuration from the rehash. This is not done within the
+ * configuration thread becasuse they may invoke functions that are not threadsafe.
*
* XXX: The order of these is IMPORTANT, do not reorder them without testing
* thoroughly!!!
this->ResetMaxBans();
InitializeDisabledCommands(Config->DisabledCommands, this);
User* user = !Config->RehashUserUID.empty() ? FindNick(Config->RehashUserUID) : NULL;
- FOREACH_MOD_I(this, I_OnRehash, OnRehash(user, Config->RehashParameter));
+ FOREACH_MOD_I(this, I_OnRehash, OnRehash(user));
this->BuildISupport();
- /* IMPORTANT: This delete may hang if you fuck up your thread syncronization.
- * It will hang waiting for the ConfigThread to 'join' to avoid race conditons,
- * until the other thread is completed.
- */
delete ConfigThread;
ConfigThread = NULL;
}
void Module::OnUserJoin(User*, Channel*, bool, bool&) { }
void Module::OnPostJoin(User*, Channel*) { }
void Module::OnUserPart(User*, Channel*, std::string&, bool&) { }
-void Module::OnRehash(User*, const std::string&) { }
+void Module::OnPreRehash(User*, const std::string&) { }
+void Module::OnModuleRehash(User*, const std::string&) { }
+void Module::OnRehash(User*) { }
int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&, const std::string&) { return 0; }
void Module::OnMode(User*, void*, int, const std::deque<std::string>&, const std::deque<TranslateType>&) { }
Version Module::GetVersion() { return Version("Misconfigured", VF_VENDOR, -1); }
public:
ModuleGeoIP(InspIRCd *Me) : Module(Me)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnRehash, I_OnUserRegister };
ServerInstance->Modules->Attach(eventlist, this, 2);
return Version("$Id$", VF_VENDOR, API_VERSION);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
GeoBans.clear();
conn = NULL;
Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRehash, I_OnUserRegister };
ServerInstance->Modules->Attach(eventlist, this, 4);
- OnRehash(NULL,"");
+ OnRehash(NULL);
}
virtual ~ModuleLDAPAuth()
ldap_unbind_ext(conn, NULL, NULL);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
conn = NULL;
Implementation eventlist[] = { I_OnRehash, I_OnPassCompare };
ServerInstance->Modules->Attach(eventlist, this, 2);
- OnRehash(NULL,"");
+ OnRehash(NULL);
}
virtual ~ModuleLDAPAuth()
ldap_unbind_ext(conn, NULL, NULL);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
queryDispatcher->LockQueue();
ReadConf();
~ModuleSQL();
unsigned long NewID();
const char* OnRequest(Request* request);
- void OnRehash(User* user, const std::string ¶meter);
+ void OnRehash(User* user);
Version GetVersion();
};
return NULL;
}
-void ModuleSQL::OnRehash(User* user, const std::string ¶meter)
+void ModuleSQL::OnRehash(User* user)
{
Dispatcher->LockQueue();
rehashing = true;
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadConf();
}
Me->Modules->PublishInterface("RegularExpression", this);
Implementation eventlist[] = { I_OnRequest, I_OnRehash };
Me->Modules->Attach(eventlist, this, 2);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual Version GetVersion()
ServerInstance->Modules->UnpublishInterface("RegularExpression", this);
}
- virtual void OnRehash(User* u, const std::string& parameter)
+ virtual void OnRehash(User* u)
{
ConfigReader Conf(ServerInstance);
extended = Conf.ReadFlag("posix", "extended", 0);
if (!SQLprovider)
throw ModuleException("Can't find an SQL provider module. Please load one before attempting to load m_sqlauth.");
- OnRehash(NULL,"");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRequest, I_OnRehash, I_OnUserRegister };
ServerInstance->Modules->Attach(eventlist, this, 5);
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadConf();
}
SQLModule = ServerInstance->Modules->FindFeature("SQL");
- OnRehash(NULL,"");
+ OnRehash(NULL);
MyMod = this;
active_queries.clear();
dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadConfig();
}
ServerInstance->Modules->UseInterface("SQL");
ServerInstance->Modules->UseInterface("HashRequest");
- OnRehash(NULL, "");
+ OnRehash(NULL);
diduseiface = false;
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
class ModuleSSLGnuTLS : public Module
{
-
- ConfigReader* Conf;
-
- char* dummy;
-
std::vector<std::string> listenports;
issl_session* sessions;
cred_alloc = false;
// Needs the flag as it ignores a plain /rehash
- OnRehash(NULL,"ssl");
+ OnModuleRehash(NULL,"ssl");
// Void return, guess we assume success
gnutls_certificate_set_dh_params(x509_cred, dh_params);
Implementation eventlist[] = { I_On005Numeric, I_OnRawSocketConnect, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnCleanup,
- I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUnloadModule, I_OnRehash, I_OnWhois, I_OnPostConnect, I_OnEvent, I_OnHookUserIO };
- ServerInstance->Modules->Attach(eventlist, this, 17);
+ I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData,
+ I_OnUnloadModule, I_OnRehash, I_OnModuleRehash, I_OnWhois, I_OnPostConnect, I_OnEvent, I_OnHookUserIO };
+ ServerInstance->Modules->Attach(eventlist, this, 18);
starttls = new CommandStartTLS(ServerInstance, this);
ServerInstance->AddCommand(starttls);
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
- Conf = new ConfigReader(ServerInstance);
+ ConfigReader Conf(ServerInstance);
listenports.clear();
clientactive = 0;
sslports.clear();
- for(int index = 0; index < Conf->Enumerate("bind"); index++)
+ for(int index = 0; index < Conf.Enumerate("bind"); index++)
{
// For each <bind> tag
- std::string x = Conf->ReadValue("bind", "type", index);
- if(((x.empty()) || (x == "clients")) && (Conf->ReadValue("bind", "ssl", index) == "gnutls"))
+ std::string x = Conf.ReadValue("bind", "type", index);
+ if(((x.empty()) || (x == "clients")) && (Conf.ReadValue("bind", "ssl", index) == "gnutls"))
{
// Get the port we're meant to be listening on with SSL
- std::string port = Conf->ReadValue("bind", "port", index);
- std::string addr = Conf->ReadValue("bind", "address", index);
+ std::string port = Conf.ReadValue("bind", "port", index);
+ std::string addr = Conf.ReadValue("bind", "address", index);
if (!addr.empty())
{
if (!sslports.empty())
sslports.erase(sslports.end() - 1);
+ }
+ virtual void OnModuleRehash(User* user, const std::string ¶m)
+ {
if(param != "ssl")
- {
- delete Conf;
return;
- }
+
+ OnRehash(user);
+
+ ConfigReader Conf(ServerInstance);
std::string confdir(ServerInstance->ConfigFileName);
// +1 so we the path ends with a /
confdir = confdir.substr(0, confdir.find_last_of('/') + 1);
- cafile = Conf->ReadValue("gnutls", "cafile", 0);
- crlfile = Conf->ReadValue("gnutls", "crlfile", 0);
- certfile = Conf->ReadValue("gnutls", "certfile", 0);
- keyfile = Conf->ReadValue("gnutls", "keyfile", 0);
- dh_bits = Conf->ReadInteger("gnutls", "dhbits", 0, false);
+ cafile = Conf.ReadValue("gnutls", "cafile", 0);
+ crlfile = Conf.ReadValue("gnutls", "crlfile", 0);
+ certfile = Conf.ReadValue("gnutls", "certfile", 0);
+ keyfile = Conf.ReadValue("gnutls", "keyfile", 0);
+ dh_bits = Conf.ReadInteger("gnutls", "dhbits", 0, false);
// Set all the default values needed.
if (cafile.empty())
// This may be on a large (once a day or week) timer eventually.
GenerateDHParams();
-
- delete Conf;
}
void GenerateDHParams()
ServerInstance->Users->QuitUser(user, "SSL module unloading");
user->DelIOHook();
}
- if (user->GetExt("ssl_cert", dummy))
+ if (user->GetExt("ssl_cert"))
{
ssl_cert* tofree;
user->GetExt("ssl_cert", tofree);
EventHandler* user = ServerInstance->SE->GetRef(fd);
- if ((user) && (user->GetExt("ssl_cert", dummy)))
+ if ((user) && (user->GetExt("ssl_cert")))
{
ssl_cert* tofree;
user->GetExt("ssl_cert", tofree);
return;
// Bugfix, only send this numeric for *our* SSL users
- if (dest->GetExt("ssl", dummy))
+ if (dest->GetExt("ssl"))
{
ServerInstance->SendWhoisLine(source, dest, 320, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
}
if(extname == "ssl")
{
// check if this user has an swhois field to send
- if(user->GetExt(extname, dummy))
+ if(user->GetExt(extname))
{
// call this function in the linking module, let it format the data how it
// sees fit, and send it on its way. We dont need or want to know how.
{
User* dest = (User*)target;
// if they dont already have an ssl flag, accept the remote server's
- if (!dest->GetExt(extname, dummy))
+ if (!dest->GetExt(extname))
{
dest->Extend(extname, "ON");
}
EventHandler *extendme = ServerInstance->SE->GetRef(fd);
if (extendme)
{
- if (!extendme->GetExt("ssl", dummy))
+ if (!extendme->GetExt("ssl"))
extendme->Extend("ssl", "ON");
}
SSL_CTX_set_verify(clictx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify);
// Needs the flag as it ignores a plain /rehash
- OnRehash(NULL,"ssl");
- Implementation eventlist[] = { I_OnRawSocketConnect, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnCleanup, I_On005Numeric,
- I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_OnUnloadModule, I_OnRehash, I_OnWhois, I_OnPostConnect, I_OnHookUserIO };
- ServerInstance->Modules->Attach(eventlist, this, 16);
+ OnModuleRehash(NULL,"ssl");
+ Implementation eventlist[] = { I_OnRawSocketConnect, I_OnRawSocketAccept,
+ I_OnRawSocketClose, I_OnRawSocketRead, I_OnRawSocketWrite, I_OnCleanup, I_On005Numeric,
+ I_OnBufferFlushed, I_OnRequest, I_OnSyncUserMetaData, I_OnDecodeMetaData,
+ I_OnUnloadModule, I_OnRehash, I_OnModuleRehash, I_OnWhois, I_OnPostConnect,
+ I_OnHookUserIO };
+ ServerInstance->Modules->Attach(eventlist, this, 17);
}
virtual void OnHookUserIO(User* user, const std::string &targetip)
}
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
if (!sslports.empty())
sslports.erase(sslports.end() - 1);
+ }
+ virtual void OnModuleRehash(User* user, const std::string ¶m)
+ {
if (param != "ssl")
- {
return;
- }
+
+ OnRehash(user);
+
+ ConfigReader Conf(ServerInstance);
std::string confdir(ServerInstance->ConfigFileName);
// +1 so we the path ends with a /
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
delete cf;
cf = new ConfigReader(ServerInstance);
ServerInstance->Parser->CallHandler(command, pars, user);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadAliases();
}
throw ModuleException("Could not add new modes!");
}
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnRehash, I_OnHostCycle };
Me->Modules->Attach(eventlist, this, 7);
delete aum;
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader conf(ServerInstance);
ShowOps = conf.ReadFlag("auditorium", "showops", 0);
be->DoChannelDelete(chan);
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
be->DoRehash();
}
throw ModuleException("Could not add mode watcher");
}
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete, I_OnCleanup };
Me->Modules->Attach(list, this, 4);
}
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
ExceptionModule = ServerInstance->Modules->Find("m_banexception.so");
}
public:
ModuleBlockAmsg(InspIRCd* Me) : Module(Me)
{
- this->OnRehash(NULL,"");
+ this->OnRehash(NULL);
Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
return Version("$Id$",VF_VENDOR,API_VERSION);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
ModuleBlockCAPS(InspIRCd* Me) : Module(Me)
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
bc = new BlockCaps(ServerInstance);
if (!ServerInstance->Modes->AddMode(bc))
{
ServerInstance->AddExtBanChar('B');
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
ReadConf();
}
public:
ModuleCallerID(InspIRCd* Me) : Module(Me)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
mycommand = new CommandAccept(ServerInstance, maxaccepts);
myumode = new User_g(ServerInstance);
RemoveData(user);
}
- virtual void OnRehash(User* user, const std::string& parameter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true);
{
/* Read the configuration file on startup.
*/
- OnRehash(NULL,"");
+ OnRehash(NULL);
cu = new CensorUser(ServerInstance);
cc = new CensorChannel(ServerInstance);
if (!ServerInstance->Modes->AddMode(cu) || !ServerInstance->Modes->AddMode(cc))
return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
/*
* reload our config file on rehash - we must destroy and re-allocate the classes
ModuleCgiIRC(InspIRCd* Me) : Module(Me)
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
mycommand = new CommandWebirc(Me, Hosts, NotifyOpers);
ServerInstance->AddCommand(mycommand);
ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_FIRST);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
Hosts.clear();
Implementation eventlist[] = { I_OnCleanup, I_OnChannelDelete, I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel };
ServerInstance->Modules->Attach(eventlist, this, 6);
- OnRehash(NULL, "");
+ OnRehash(NULL);
ServerInstance->Modules->PublishInterface("ChannelBanList", this);
}
cf->DoChannelDelete(chan);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0);
Implementation eventlist[] = { I_OnRehash, I_OnSendSnotice };
ServerInstance->Modules->Attach(eventlist, this, 2);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual ~ModuleChanLog()
{
}
- virtual void OnRehash(User *user, const std::string ¶meter)
+ virtual void OnRehash(User *user)
{
ConfigReader MyConf(ServerInstance);
std::string snomasks;
ModuleChgHost(InspIRCd* Me)
: Module(Me)
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
mycommand = new CommandChghost(ServerInstance, hostmap);
ServerInstance->AddCommand(mycommand);
Implementation eventlist[] = { I_OnRehash };
}
- void OnRehash(User* user, const std::string ¶meter)
+ void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
std::string hmap = Conf.ReadValue("hostname", "charmap", 0);
try
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
}
catch (ModuleException &e)
{
return Version("$Id$", VF_COMMON|VF_VENDOR,API_VERSION);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
cu->DoRehash();
}
ModuleConnJoin(InspIRCd* Me)
: Module(Me)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnPostConnect, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader* conf = new ConfigReader(ServerInstance);
JoinChan = conf->ReadValue("autojoin", "channel", 0);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
delete Conf;
Conf = new ConfigReader(ServerInstance);
ModuleWaitPong(InspIRCd* Me)
: Module(Me), extenstr("waitpong_pingstr")
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash, I_OnUserDisconnect, I_OnCleanup };
ServerInstance->Modules->Attach(eventlist, this, 6);
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
{
Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 3);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual ~ModuleConnectBan()
return Version("$Id$", VF_VENDOR,API_VERSION);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
std::string duration;
return 0;
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
InitConf();
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
delete Conf;
Conf = new ConfigReader(ServerInstance);
if (!ServerInstance->Modes->AddMode(m1))
throw ModuleException("Could not add new modes!");
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnBuildExemptList };
ServerInstance->Modules->Attach(eventlist, this, 4);
}
- virtual void OnRehash(User* user, const std::string&)
+ virtual void OnRehash(User* user)
{
ConfigReader* conf = new ConfigReader(ServerInstance);
deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0);
ServerInstance->Modules->Attach(eventlist, this, 2);
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
delete Conf;
Conf = new ConfigReader(ServerInstance);
delete MyConf;
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadConf();
}
virtual void SendFilter(Module* proto, void* opaque, FilterResult* iter);
virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &flags) = 0;
virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
- virtual void OnRehash(User* user, const std::string ¶meter);
+ virtual void OnRehash(User* user);
virtual Version GetVersion();
std::string EncodeFilter(FilterResult* filter);
FilterResult DecodeFilter(const std::string &data);
return 0;
}
-void FilterBase::OnRehash(User* user, const std::string ¶meter)
+void FilterBase::OnRehash(User* user)
{
ConfigReader MyConf(ServerInstance);
std::vector<std::string>().swap(exemptfromfilter);
ModuleFilter(InspIRCd* Me)
: FilterBase(Me, "m_filter.so")
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
}
virtual ~ModuleFilter()
return std::make_pair(true, "");
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader MyConf(ServerInstance);
- FilterBase::OnRehash(user, parameter);
+ FilterBase::OnRehash(user);
ReadFilters(MyConf);
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadConfig();
}
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual ~ModuleHideChans()
return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader conf(ServerInstance);
AffectsOpers = conf.ReadFlag("hidechans", "affectsopers", 0);
ModuleHostChange(InspIRCd* Me)
: Module(Me)
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnRehash, I_OnUserConnect };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
MySuffix = Conf.ReadValue("host","suffix",0);
ModuleIdent(InspIRCd *Me) : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect };
ServerInstance->Modules->Attach(eventlist, this, 5);
}
return Version("$Id$", VF_VENDOR, API_VERSION);
}
- virtual void OnRehash(User *user, const std::string ¶m)
+ virtual void OnRehash(User *user)
{
delete Conf;
Conf = new ConfigReader(ServerInstance);
virtual Version GetVersion();
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent);
- virtual void OnRehash(User* user, const std::string ¶meter);
+ virtual void OnRehash(User* user);
void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
bool OnHostCycle(User* user);
}
}
-void ModuleInvisible::OnRehash(User* user, const std::string ¶meter)
+void ModuleInvisible::OnRehash(User* user)
{
delete conf;
conf = new ConfigReader(ServerInstance);
ie->DoChannelDelete(chan);
}
- virtual void OnRehash(User* user, const std::string ¶m)
+ virtual void OnRehash(User* user)
{
ie->DoRehash();
}
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ResetLocked();
}
// Create a new command
ServerInstance->Modules->Attach(I_OnPreCommand, this);
ServerInstance->Modules->Attach(I_OnRehash, this);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
- void OnRehash(User* user, const std::string ¶meter)
+ void OnRehash(User* user)
{
ConfigReader MyConf(ServerInstance);
url = MyConf.ReadValue("security", "maphide", 0);
Implementation eventlist[] = { I_OnRehash, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 2);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual void On005Numeric(std::string &output)
SearchAndReplace(output, std::string("CASEMAPPING=rfc1459"), tmp);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader* conf = new ConfigReader(ServerInstance);
charset = conf->ReadValue("nationalchars", "file", 0);
public:
ModuleOperjoin(InspIRCd* Me) : Module(Me)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader* conf = new ConfigReader(ServerInstance);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
delete conf;
conf = new ConfigReader(ServerInstance);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
delete Conf;
Conf = new ConfigReader(ServerInstance);
ShowOperMOTD(user);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
LoadOperMOTD();
}
: Module(Me)
{
// read our config options (main config file)
- OnRehash(NULL,"");
+ OnRehash(NULL);
ServerInstance->SNO->EnableSnomask('G', "GODMODE");
if (!ServerInstance->Modules->PublishFeature("Override", this))
{
ServerInstance->Modules->Attach(eventlist, this, 8);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
// on a rehash we delete our classes for good measure and create them again.
ConfigReader Conf(ServerInstance);
/* Read the config file first */
// Conf = NULL;
- OnRehash(NULL,"");
+ OnRehash(NULL);
/* Find all modules which implement the interface 'HashRequest' */
modulelist* ml = ServerInstance->Modules->FindInterface("HashRequest");
Implementation eventlist[] = { I_OnChannelPreDelete };
ServerInstance->Modules->Attach(eventlist, this, 1);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual ~ModulePermanentChannels()
delete p;
}
- virtual void OnRehash(User *user, const std::string ¶meter)
+ virtual void OnRehash(User *user)
{
/*
* Process config-defined list of permanent channels.
mycommand2 = new CommandFpart(ServerInstance, supportnokicks);
ServerInstance->AddCommand(mycommand);
ServerInstance->AddCommand(mycommand2);
- OnRehash(NULL,"");
+ OnRehash(NULL);
Implementation eventlist[] = { I_On005Numeric, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 2);
}
output.append(" REMOVE");
}
- virtual void OnRehash(User* user, const std::string&)
+ virtual void OnRehash(User* user)
{
ConfigReader conf(ServerInstance);
supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0);
ServerInstance->Modules->Attach(eventlist, this, 2);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ReadConfig();
}
ModuleRLine(InspIRCd* Me) : Module(Me)
{
mymodule = this;
- OnRehash(NULL, "");
+ OnRehash(NULL);
Me->Modules->UseInterface("RegularExpression");
}
}
- virtual void OnRehash(User *user, const std::string ¶meter)
+ virtual void OnRehash(User *user)
{
ConfigReader Conf(ServerInstance);
public:
ModuleSafeList(InspIRCd* Me) : Module(Me)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnBufferFlushed, I_OnPreCommand, I_OnCleanup, I_OnUserQuit, I_On005Numeric, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 6);
}
{
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader MyConf(ServerInstance);
ThrottleSecs = MyConf.ReadInteger("safelist", "throttle", "60", 0, true);
public:
ModuleSecureList(InspIRCd* Me) : Module(Me)
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric };
ServerInstance->Modules->Attach(eventlist, this, 3);
}
return Version("$Id$",VF_VENDOR,API_VERSION);
}
- void OnRehash(User* user, const std::string ¶meter)
+ void OnRehash(User* user)
{
ConfigReader* MyConf = new ConfigReader(ServerInstance);
allowlist.clear();
ModuleSetHost(InspIRCd* Me)
: Module(Me)
{
- OnRehash(NULL,"");
+ OnRehash(NULL);
mycommand = new CommandSethost(ServerInstance, hostmap);
ServerInstance->AddCommand(mycommand);
Implementation eventlist[] = { I_OnRehash };
}
- void OnRehash(User* user, const std::string ¶meter)
+ void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
std::string hmap = Conf.ReadValue("hostname", "charmap", 0);
Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnUserConnect, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, 4);
- OnRehash(NULL, "");
+ OnRehash(NULL);
}
virtual ~ModuleShun()
return 1;
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader MyConf(ServerInstance);
std::string cmds = MyConf.ReadValue("shun", "enabledcommands", 0);
ModuleSilence(InspIRCd* Me)
: Module(Me), maxsilence(32)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
cmdsilence = new CommandSilence(ServerInstance,maxsilence);
cmdsvssilence = new CommandSVSSilence(ServerInstance);
ServerInstance->AddCommand(cmdsilence);
ServerInstance->Modules->Attach(eventlist, this, 7);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true);
I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostLocalTopicChange,
I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer,
I_OnUserJoin, I_OnChangeLocalUserHost, I_OnChangeName, I_OnUserPart, I_OnUnloadModule,
- I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash,
+ I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash,
I_OnOper, I_OnAddLine, I_OnDelLine, I_ProtoSendMode, I_OnMode, I_OnLoadModule,
I_OnStats, I_ProtoSendMetaData, I_OnEvent, I_OnSetAway, I_OnPostCommand
};
- ServerInstance->Modules->Attach(eventlist, this, 29);
+ ServerInstance->Modules->Attach(eventlist, this, 30);
delete ServerInstance->PI;
ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance);
Utils->DoOneToMany(source->uuid,"KILL",params);
}
-void ModuleSpanningTree::OnRehash(User* user, const std::string ¶meter)
+void ModuleSpanningTree::OnPreRehash(User* user, const std::string ¶meter)
{
ServerInstance->Logs->Log("remoterehash", DEBUG, "called with param %s", parameter.c_str());
// Send out to other servers
if (!parameter.empty() && parameter[0] != '-')
{
- ServerInstance->Logs->Log("remoterehash", DEBUG, "sending out lol");
std::deque<std::string> params;
params.push_back(parameter);
Utils->DoOneToAllButSender(user ? user->uuid : ServerInstance->Config->GetSID(), "REHASH", params, user ? user->server : ServerInstance->Config->ServerName);
}
+}
+void ModuleSpanningTree::OnRehash(User* user)
+{
// Re-read config stuff
Utils->ReadConfiguration(true);
}
virtual void OnUserPostNick(User* user, const std::string &oldnick);
virtual void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent);
virtual void OnRemoteKill(User* source, User* dest, const std::string &reason, const std::string &operreason);
- virtual void OnRehash(User* user, const std::string ¶meter);
+ virtual void OnPreRehash(User* user, const std::string ¶meter);
+ virtual void OnRehash(User* user);
virtual void OnOper(User* user, const std::string &opertype);
void OnLine(User* source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason);
virtual void OnAddLine(User *u, XLine *x);
ServerInstance->Modules->Attach(eventlist, this, 7);
}
- void OnRehash(User* user, const std::string ¶meter)
+ void OnRehash(User* user)
{
delete Conf;
Conf = new ConfigReader(ServerInstance);
Modulewatch(InspIRCd* Me)
: Module(Me), maxwatch(32)
{
- OnRehash(NULL, "");
+ OnRehash(NULL);
whos_watching_me = new watchentries();
mycommand = new CommandWatch(ServerInstance, maxwatch);
ServerInstance->AddCommand(mycommand);
ServerInstance->Modules->Attach(eventlist, this, 8);
}
- virtual void OnRehash(User* user, const std::string ¶meter)
+ virtual void OnRehash(User* user)
{
ConfigReader Conf(ServerInstance);
maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true);
if (!Server->ConfigThread)
{
Server->Config->RehashUserUID = "";
- Server->Config->RehashParameter = "";
Server->ConfigThread = new ConfigReaderThread(Server, false, "");
Server->Threads->Start(Server->ConfigThread);