From 42d5b9571eff06b0c33093dc9118c29f9603fd2b Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 1 Jan 2007 20:53:20 +0000 Subject: [PATCH] Fix to allow for OnRehash to know what user initiated the rehash git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6207 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/modules.h | 6 ++++-- src/cmd_rehash.cpp | 2 +- src/inspircd.cpp | 2 +- src/modules.cpp | 2 +- src/modules/extra/m_filter_pcre.cpp | 4 ++-- src/modules/extra/m_mysql.cpp | 2 +- src/modules/extra/m_pgsql.cpp | 2 +- src/modules/extra/m_sqlauth.cpp | 4 ++-- src/modules/extra/m_sqllog.cpp | 4 ++-- src/modules/extra/m_sqloper.cpp | 4 ++-- src/modules/extra/m_ssl_gnutls.cpp | 4 ++-- src/modules/extra/m_ssl_openssl.cpp | 4 ++-- src/modules/m_alias.cpp | 2 +- src/modules/m_banexception.cpp | 2 +- src/modules/m_blockamsg.cpp | 4 ++-- src/modules/m_blockcaps.cpp | 4 ++-- src/modules/m_censor.cpp | 4 ++-- src/modules/m_cgiirc.cpp | 4 ++-- src/modules/m_chanfilter.cpp | 2 +- src/modules/m_chanprotect.cpp | 4 ++-- src/modules/m_chghost.cpp | 4 ++-- src/modules/m_cloaking.cpp | 4 ++-- src/modules/m_conn_umodes.cpp | 2 +- src/modules/m_conn_waitpong.cpp | 5 ++--- src/modules/m_connflood.cpp | 2 +- src/modules/m_dccallow.cpp | 2 +- src/modules/m_denychans.cpp | 4 ++-- src/modules/m_dnsbl.cpp | 2 +- src/modules/m_filter.cpp | 4 ++-- src/modules/m_filter.h | 4 ++-- src/modules/m_helpop.cpp | 12 ++++++------ src/modules/m_hostchange.cpp | 5 ++--- src/modules/m_ident.cpp | 2 +- src/modules/m_inviteexception.cpp | 2 +- src/modules/m_lockserv.cpp | 2 +- src/modules/m_oper_hash.cpp | 4 ++-- src/modules/m_operjoin.cpp | 2 +- src/modules/m_operlevels.cpp | 2 +- src/modules/m_opermodes.cpp | 2 +- src/modules/m_opermotd.cpp | 2 +- src/modules/m_override.cpp | 4 ++-- src/modules/m_remove.cpp | 4 ++-- src/modules/m_restrictchans.cpp | 2 +- src/modules/m_sethost.cpp | 4 ++-- src/modules/m_spanningtree.cpp | 8 ++++---- src/modules/m_swhois.cpp | 2 +- src/modules/m_vhost.cpp | 2 +- 47 files changed, 80 insertions(+), 80 deletions(-) diff --git a/include/modules.h b/include/modules.h index 9928ad3261..8c4b55a95b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -75,7 +75,7 @@ enum MessageType { * ipv4 servers, so this value will be ten times as * high on ipv6 servers. */ -#define NATIVE_API_VERSION 11009 +#define NATIVE_API_VERSION 11010 #ifdef IPV6 #define API_VERSION (NATIVE_API_VERSION * 10) #else @@ -518,9 +518,11 @@ class Module : public Extensible * 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. */ - virtual void OnRehash(const std::string ¶meter); + virtual void OnRehash(userrec* user, const std::string ¶meter); /** Called when a raw command is transmitted or received. * This method is the lowest level of handler available to a module. It will be called with raw diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp index 579c043007..8154c5b923 100644 --- a/src/cmd_rehash.cpp +++ b/src/cmd_rehash.cpp @@ -45,7 +45,7 @@ CmdResult cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user) if (old_disabled != ServerInstance->Config->DisabledCommands) InitializeDisabledCommands(ServerInstance->Config->DisabledCommands, ServerInstance); - FOREACH_MOD(I_OnRehash,OnRehash(parameter)); + FOREACH_MOD(I_OnRehash,OnRehash(user, parameter)); return CMD_SUCCESS; } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 9905a78d04..1509553ce9 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -144,7 +144,7 @@ void InspIRCd::Rehash(int status) FOREACH_MOD_I(SI, I_OnGarbageCollect, OnGarbageCollect()); SI->Config->Read(false,NULL); SI->Res->Rehash(); - FOREACH_MOD_I(SI,I_OnRehash,OnRehash("")); + FOREACH_MOD_I(SI,I_OnRehash,OnRehash(NULL,"")); } /** Because hash_map doesnt free its buckets when we delete items (this is a 'feature') diff --git a/src/modules.cpp b/src/modules.cpp index a67ebc6dab..9590926410 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -109,7 +109,7 @@ void Module::OnUserDisconnect(userrec* user) { } void Module::OnUserJoin(userrec* user, chanrec* channel) { } void Module::OnPostJoin(userrec* user, chanrec* channel) { } void Module::OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage) { } -void Module::OnRehash(const std::string ¶meter) { } +void Module::OnRehash(userrec* user, const std::string ¶meter) { } void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { } int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs) { return 0; } void Module::OnMode(userrec* user, void* dest, int target_type, const std::string &text) { }; diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index c822071318..6d4964913a 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -47,7 +47,7 @@ class ModuleFilterPCRE : public FilterBase ModuleFilterPCRE(InspIRCd* Me) : FilterBase::FilterBase(Me, "m_filter_pcre.so") { - OnRehash(""); + OnRehash(NULL,""); } virtual ~ModuleFilterPCRE() @@ -115,7 +115,7 @@ class ModuleFilterPCRE : public FilterBase } } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader MyConf(ServerInstance); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index cebacde276..dd298bd1a0 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -826,7 +826,7 @@ class ModuleSQL : public Module return NULL; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { /* TODO: set rehash bool here, which makes the dispatcher thread rehash at next opportunity */ } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index d688149b8c..fb2cb2966f 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -1079,7 +1079,7 @@ class ModulePgSQL : public Module List[I_OnUnloadModule] = List[I_OnRequest] = List[I_OnRehash] = List[I_OnUserRegister] = List[I_OnCheckReady] = List[I_OnUserDisconnect] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadConf(); } diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index b2b7c9044a..7130439e05 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -50,7 +50,7 @@ class ModuleSQLAuth : public Module if (!SQLutils) throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so."); - OnRehash(""); + OnRehash(NULL,""); } virtual ~ModuleSQLAuth() @@ -64,7 +64,7 @@ class ModuleSQLAuth : public Module 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); diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 401db811c8..78c2164aac 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -194,7 +194,7 @@ class ModuleSQLLog : public Module SQLModule = Srv->FindFeature("SQL"); - OnRehash(""); + OnRehash(NULL,""); MyMod = this; active_queries.clear(); } @@ -218,7 +218,7 @@ class ModuleSQLLog : public Module dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadConfig(); } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index b7a45af45d..ead9a4f360 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -42,7 +42,7 @@ class ModuleSQLOper : public Module if (!SQLutils) throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqloper.so."); - OnRehash(""); + OnRehash(NULL,""); } virtual ~ModuleSQLOper() @@ -56,7 +56,7 @@ class ModuleSQLOper : public Module List[I_OnRequest] = List[I_OnRehash] = List[I_OnPreCommand] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader Conf(Srv); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index fbd8097427..9eec655f76 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -106,13 +106,13 @@ class ModuleSSLGnuTLS : public Module ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters"); // Needs the flag as it ignores a plain /rehash - OnRehash("ssl"); + OnRehash(NULL,"ssl"); // Void return, guess we assume success gnutls_certificate_set_dh_params(x509_cred, dh_params); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { if(param != "ssl") return; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index ca690fb8f5..7ad78e2ea0 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -133,10 +133,10 @@ class ModuleSSLOpenSSL : public Module SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, OnVerify); // Needs the flag as it ignores a plain /rehash - OnRehash("ssl"); + OnRehash(NULL,"ssl"); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { if (param != "ssl") return; diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 4e32f2856a..e8e7cec1a3 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -270,7 +270,7 @@ class ModuleAlias : public Module } } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadAliases(); } diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index bc0d7f009e..2d350e9384 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -108,7 +108,7 @@ class ModuleBanException : public Module be->DoChannelDelete(chan); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { be->DoRehash(); } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index cfc662aee5..39e3c16b11 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -48,7 +48,7 @@ class ModuleBlockAmsg : public Module ModuleBlockAmsg(InspIRCd* Me) : Module::Module(Me) { - this->OnRehash(""); + this->OnRehash(NULL,""); } void Implements(char* List) @@ -65,7 +65,7 @@ class ModuleBlockAmsg : public Module return Version(1,1,0,0,VF_VENDOR,API_VERSION); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader* Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index b67c496f4a..058336fb37 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -59,7 +59,7 @@ class ModuleBlockCAPS : public Module ModuleBlockCAPS(InspIRCd* Me) : Module::Module(Me) { - OnRehash(""); + OnRehash(NULL,""); bc = new BlockCaps(ServerInstance); if (!ServerInstance->AddMode(bc, 'P')) throw ModuleException("Could not add new modes!"); @@ -70,7 +70,7 @@ class ModuleBlockCAPS : public Module List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnRehash] = 1; } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { ReadConf(); } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 4df2db95e4..0930c1d456 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -96,7 +96,7 @@ class ModuleCensor : public Module { /* Read the configuration file on startup. */ - OnRehash(""); + OnRehash(NULL,""); cu = new CensorUser(ServerInstance); cc = new CensorChannel(ServerInstance); if (!ServerInstance->AddMode(cu, 'G') || !ServerInstance->AddMode(cc, 'G')) @@ -159,7 +159,7 @@ class ModuleCensor : public Module return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { /* * reload our config file on rehash - we must destroy and re-allocate the classes diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 3124c52050..93593ed238 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -91,7 +91,7 @@ class ModuleCgiIRC : public Module ModuleCgiIRC(InspIRCd* Me) : Module::Module(Me) { - OnRehash(""); + OnRehash(NULL,""); } void Implements(char* List) @@ -105,7 +105,7 @@ class ModuleCgiIRC : public Module return PRIORITY_FIRST; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index de1f38a88e..7c888c0571 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -85,7 +85,7 @@ class ModuleChanFilter : public Module cf->DoChannelDelete(chan); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { cf->DoRehash(); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index cab6863723..f7c05572f3 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -290,7 +290,7 @@ class ModuleChanProtect : public Module : Module::Module(Me), FirstInGetsFounder(false), QAPrefixes(false), DeprivSelf(false), booting(true) { /* Load config stuff */ - OnRehash(""); + OnRehash(NULL,""); booting = false; /* Initialise module variables */ @@ -321,7 +321,7 @@ class ModuleChanProtect : public Module user->Shrink("cm_protect_"+std::string(channel->name)); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { /* Create a configreader class and read our flag, * in old versions this was heap-allocated and the diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index e0f69faba5..3d4d29f740 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -75,7 +75,7 @@ class ModuleChgHost : public Module ModuleChgHost(InspIRCd* Me) : Module::Module(Me) { - OnRehash(""); + OnRehash(NULL,""); mycommand = new cmd_chghost(ServerInstance, hostmap); ServerInstance->AddCommand(mycommand); } @@ -85,7 +85,7 @@ class ModuleChgHost : public Module List[I_OnRehash] = 1; } - void OnRehash(const std::string ¶meter) + void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); std::string hmap = Conf.ReadValue("hostname", "charmap", 0); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 17e8c34056..707085b144 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -241,7 +241,7 @@ class ModuleCloaking : public Module if (!ServerInstance->AddMode(cu, 'x')) throw ModuleException("Could not add new modes!"); - OnRehash(""); + OnRehash(NULL,""); } virtual ~ModuleCloaking() @@ -258,7 +258,7 @@ class ModuleCloaking : public Module return Version(1,1,0,2,VF_COMMON|VF_VENDOR,API_VERSION); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { cu->DoRehash(); } diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 34e1a87338..1b6bbe66d5 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -40,7 +40,7 @@ class ModuleModesOnConnect : public Module List[I_OnPostConnect] = List[I_OnRehash] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { DELETE(Conf); Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 531a1ce88c..2bb1b107a5 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -45,11 +45,10 @@ class ModuleWaitPong : public Module ModuleWaitPong(InspIRCd* Me) : Module::Module(Me) { - - OnRehash(""); + OnRehash(NULL,""); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 5190883248..40d64520f7 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -110,7 +110,7 @@ class ModuleConnFlood : public Module return 0; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { InitConf(); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index e662995ae2..c8459a7057 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -267,7 +267,7 @@ class ModuleDCCAllow : public Module List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnUserQuit] = List[I_OnUserPreNick] = List[I_OnRehash] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { delete Conf; Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index f7af72486b..cbd7368691 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -34,12 +34,12 @@ class ModuleDenyChannels : public Module Conf = new ConfigReader(ServerInstance); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { DELETE(Conf); Conf = new ConfigReader(ServerInstance); } - + virtual ~ModuleDenyChannels() { DELETE(Conf); diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 03b691ece1..4b4a36309e 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -266,7 +266,7 @@ class ModuleDNSBL : public Module delete MyConf; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadConf(); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 79e98d2952..a9ea3ba5e8 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -33,7 +33,7 @@ class ModuleFilter : public FilterBase ModuleFilter(InspIRCd* Me) : FilterBase::FilterBase(Me, "m_filter.so") { - OnRehash(""); + OnRehash(NULL,""); } virtual ~ModuleFilter() @@ -89,7 +89,7 @@ class ModuleFilter : public FilterBase } } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader* MyConf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index d21c8fc9cf..2825927761 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -50,7 +50,7 @@ class FilterBase : public Module virtual void SendFilter(Module* proto, void* opaque, FilterResult* iter); virtual std::pair AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration) = 0; virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); - virtual void OnRehash(const std::string ¶meter); + virtual void OnRehash(userrec* user, const std::string ¶meter); virtual Version GetVersion(); std::string EncodeFilter(FilterResult* filter); FilterResult DecodeFilter(const std::string &data); @@ -298,7 +298,7 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters return 0; } -void FilterBase::OnRehash(const std::string ¶meter) +void FilterBase::OnRehash(userrec* user, const std::string ¶meter) { } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 510e4e899f..4d39f942b3 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -55,11 +55,11 @@ class Helpop : public ModeHandler class cmd_helpop : public command_t { public: - cmd_helpop (InspIRCd* Instance) : command_t(Instance, "HELPOP", 0, 1) - { - this->source = "m_helpop.so"; - syntax = ""; - } + cmd_helpop (InspIRCd* Instance) : command_t(Instance, "HELPOP", 0, 1) + { + this->source = "m_helpop.so"; + syntax = ""; + } CmdResult Handle (const char** parameters, int pcnt, userrec *user) { @@ -161,7 +161,7 @@ class ModuleHelpop : public Module List[I_OnRehash] = List[I_OnWhois] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadConfig(); } diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index a9bacb8677..473a35d124 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -43,9 +43,8 @@ class ModuleHostChange : public Module ModuleHostChange(InspIRCd* Me) : Module::Module(Me) { - Conf = new ConfigReader(ServerInstance); - OnRehash(""); + OnRehash(NULL,""); } virtual ~ModuleHostChange() @@ -63,7 +62,7 @@ class ModuleHostChange : public Module List[I_OnRehash] = List[I_OnUserConnect] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { DELETE(Conf); Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index a32c624236..579fa88165 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -198,7 +198,7 @@ class ModuleIdent : public Module List[I_OnCleanup] = List[I_OnRehash] = List[I_OnUserRegister] = List[I_OnCheckReady] = List[I_OnUserDisconnect] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadSettings(); } diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 0f3581e9ed..5da287f2e5 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -104,7 +104,7 @@ class ModuleInviteException : public Module ie->DoChannelDelete(chan); } - virtual void OnRehash(const std::string ¶m) + virtual void OnRehash(userrec* user, const std::string ¶m) { ie->DoRehash(); } diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index bb7426a181..f3ac933476 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -103,7 +103,7 @@ class ModuleLockserv : public Module List[I_OnUserRegister] = List[I_OnRehash] = List[I_OnCheckReady] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ResetLocked(); } diff --git a/src/modules/m_oper_hash.cpp b/src/modules/m_oper_hash.cpp index b1d80b7eba..23de60a7d1 100644 --- a/src/modules/m_oper_hash.cpp +++ b/src/modules/m_oper_hash.cpp @@ -84,7 +84,7 @@ class ModuleOperHash : public Module /* Read the config file first */ Conf = NULL; - OnRehash(""); + OnRehash(NULL,""); ServerInstance->UseInterface("HashRequest"); @@ -126,7 +126,7 @@ class ModuleOperHash : public Module List[I_OnRehash] = List[I_OnOperCompare] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { /* Re-read configuration file */ if (Conf) diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 76ba00ef21..75f809f4a9 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -61,7 +61,7 @@ class ModuleOperjoin : public Module List[I_OnPostOper] = List[I_OnRehash] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { DELETE(conf); conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 54422f0171..f8fdb89d69 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -50,7 +50,7 @@ class ModuleOperLevels : public Module List[I_OnRehash] = List[I_OnKill] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { DELETE(conf); conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 63a9264078..dbc34bcb5e 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -40,7 +40,7 @@ class ModuleModesOnOper : public Module List[I_OnPostOper] = List[I_OnRehash] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { DELETE(Conf); Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 55bc49a3b1..a80aa513c0 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -105,7 +105,7 @@ class ModuleOpermotd : public Module ShowOperMOTD(user); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { LoadOperMOTD(); } diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index d394ea8eb7..d86f87b2ac 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -36,13 +36,13 @@ class ModuleOverride : public Module : Module::Module(Me) { // read our config options (main config file) - OnRehash(""); + OnRehash(NULL,""); ServerInstance->SNO->EnableSnomask('O',"OVERRIDE"); OverriddenMode = false; OverOps = OverDeops = OverVoices = OverDevoices = OverHalfops = OverDehalfops = 0; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { // on a rehash we delete our classes for good measure and create them again. ConfigReader* Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index e7aa9f7a97..16cc8a6793 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -262,7 +262,7 @@ class ModuleRemove : public Module mycommand2 = new cmd_fpart(ServerInstance, supportnokicks); ServerInstance->AddCommand(mycommand); ServerInstance->AddCommand(mycommand2); - OnRehash(""); + OnRehash(NULL,""); } void Implements(char* List) @@ -275,7 +275,7 @@ class ModuleRemove : public Module output.append(" REMOVE"); } - virtual void OnRehash(const std::string&) + virtual void OnRehash(userrec* user, const std::string&) { ConfigReader conf(ServerInstance); supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0); diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 27996ffb76..fc83d2e593 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -49,7 +49,7 @@ class ModuleRestrictChans : public Module ReadConfig(); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ReadConfig(); } diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 048756b6d2..6e984a62ea 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -69,7 +69,7 @@ class ModuleSetHost : public Module ModuleSetHost(InspIRCd* Me) : Module::Module(Me) { - OnRehash(""); + OnRehash(NULL,""); mycommand = new cmd_sethost(ServerInstance, hostmap); ServerInstance->AddCommand(mycommand); } @@ -79,7 +79,7 @@ class ModuleSetHost : public Module List[I_OnRehash] = 1; } - void OnRehash(const std::string ¶meter) + void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader Conf(ServerInstance); std::string hmap = Conf.ReadValue("hostname", "charmap", 0); diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index c5c4e2a5b4..df39864b59 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -2467,7 +2467,7 @@ class TreeSocket : public InspSocket if (this->Instance->MatchText(this->Instance->Config->ServerName,servermask)) { - this->Instance->SNO->WriteToSnoMask('l',"Remote rehash initiated from server \002"+prefix+"\002."); + this->Instance->SNO->WriteToSnoMask('l',"Remote rehash initiated by \002"+prefix+"\002."); this->Instance->RehashServer(); Utils->ReadConfiguration(false); InitializeDisabledCommands(Instance->Config->DisabledCommands, Instance); @@ -5128,17 +5128,17 @@ class ModuleSpanningTree : public Module Utils->DoOneToMany(source->nick,"KILL",params); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { if (parameter != "") { std::deque params; params.push_back(parameter); - Utils->DoOneToMany(ServerInstance->Config->ServerName,"REHASH",params); + Utils->DoOneToMany(user ? user->nick : ServerInstance->Config->ServerName, "REHASH", params); // check for self if (ServerInstance->MatchText(ServerInstance->Config->ServerName,parameter)) { - ServerInstance->WriteOpers("*** Remote rehash initiated from server \002%s\002",ServerInstance->Config->ServerName); + ServerInstance->WriteOpers("*** Remote rehash initiated locally by \002%s\002", user ? user->nick : ServerInstance->Config->ServerName); ServerInstance->RehashServer(); } } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 50f6578dbc..d4432a0d6e 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -89,7 +89,7 @@ class ModuleSWhois : public Module ServerInstance->AddCommand(mycommand); } - void OnRehash(const std::string ¶meter) + void OnRehash(userrec* user, const std::string ¶meter) { DELETE(Conf); Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 2a0280d2e7..0a08c7194a 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -79,7 +79,7 @@ class ModuleVHost : public Module List[I_OnRehash] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { DELETE(Conf); Conf = new ConfigReader(ServerInstance);