summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-21 23:45:19 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-21 23:45:19 +0000
commit123eac3f25ce4dd3142b4ac66eb321f7df1e23e4 (patch)
tree7503b5ce313dc18edc4b39dd0e580ba6ea7fc930 /src
parent5d03657b63b0b77edc25cd566d9aab134d930bf7 (diff)
Change module API to use LocalUser* where correct
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11943 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_nick.cpp2
-rw-r--r--src/commands/cmd_user.cpp8
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/modules.cpp12
-rw-r--r--src/modules/extra/m_geoip.cpp26
-rw-r--r--src/modules/extra/m_ldapauth.cpp4
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp2
-rw-r--r--src/modules/m_antibear.cpp2
-rw-r--r--src/modules/m_cap.cpp2
-rw-r--r--src/modules/m_cgiirc.cpp4
-rw-r--r--src/modules/m_cloaking.cpp6
-rw-r--r--src/modules/m_conn_join.cpp3
-rw-r--r--src/modules/m_conn_umodes.cpp5
-rw-r--r--src/modules/m_conn_waitpong.cpp4
-rw-r--r--src/modules/m_connectban.cpp2
-rw-r--r--src/modules/m_connflood.cpp2
-rw-r--r--src/modules/m_dnsbl.cpp58
-rw-r--r--src/modules/m_hostchange.cpp3
-rw-r--r--src/modules/m_ident.cpp8
-rw-r--r--src/modules/m_invisible.cpp4
-rw-r--r--src/modules/m_jumpserver.cpp2
-rw-r--r--src/modules/m_lockserv.cpp4
-rw-r--r--src/modules/m_randquote.cpp2
-rw-r--r--src/modules/m_rline.cpp2
-rw-r--r--src/modules/m_sasl.cpp2
-rw-r--r--src/modules/m_shun.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp14
-rw-r--r--src/modules/m_spanningtree/main.h4
-rw-r--r--src/modules/m_sqlauth.cpp4
-rw-r--r--src/modules/m_sqllog.cpp2
-rw-r--r--src/modules/m_sqlutils.cpp2
-rw-r--r--src/usermanager.cpp3
-rw-r--r--src/users.cpp4
33 files changed, 93 insertions, 113 deletions
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index a6e1e88c7..ee8c4625c 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -191,7 +191,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
if (user->registered == REG_NICKUSER)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
- FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (user));
+ FIRST_MOD_RESULT(OnUserRegister, MOD_RESULT, (IS_LOCAL(user)));
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp
index e396e0c84..8410a2853 100644
--- a/src/commands/cmd_user.cpp
+++ b/src/commands/cmd_user.cpp
@@ -18,22 +18,22 @@
* the same way, however, they can be fully unloaded, where these
* may not.
*/
-class CommandUser : public Command
+class CommandUser : public SplitCommand
{
public:
/** Constructor for user.
*/
- CommandUser ( Module* parent) : Command(parent,"USER",4,4) { works_before_reg = true; Penalty = 0; syntax = "<username> <localhost> <remotehost> <GECOS>"; }
+ CommandUser ( Module* parent) : SplitCommand(parent,"USER",4,4) { works_before_reg = true; Penalty = 0; syntax = "<username> <localhost> <remotehost> <GECOS>"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
* @param user The user issuing the command
* @return A value from CmdResult to indicate command success or failure.
*/
- CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+ CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
};
-CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User *user)
+CmdResult CommandUser::HandleLocal(const std::vector<std::string>& parameters, LocalUser *user)
{
/* A user may only send the USER command once */
if (!(user->registered & REG_USER))
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index ca6a59cac..4404e2323 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -794,7 +794,7 @@ int InspIRCd::Run()
* (until this returns true, a user will block in the waiting state, waiting to connect up to the
* registration timeout maximum seconds)
*/
-bool InspIRCd::AllModulesReportReady(User* user)
+bool InspIRCd::AllModulesReportReady(LocalUser* user)
{
ModResult res;
FIRST_MOD_RESULT(OnCheckReady, res, (user));
diff --git a/src/modules.cpp b/src/modules.cpp
index a0eb9e19e..a4b9e05fa 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -63,9 +63,9 @@ Module::~Module()
}
ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; }
-void Module::OnUserConnect(User*) { }
+void Module::OnUserConnect(LocalUser*) { }
void Module::OnUserQuit(User*, const std::string&, const std::string&) { }
-void Module::OnUserDisconnect(User*) { }
+void Module::OnUserDisconnect(LocalUser*) { }
void Module::OnUserJoin(Membership*, bool, bool, CUList&) { }
void Module::OnPostJoin(Membership*) { }
void Module::OnUserPart(Membership*, std::string&, CUList&) { }
@@ -91,8 +91,8 @@ void Module::OnUnloadModule(Module*) { }
void Module::OnBackgroundTimer(time_t) { }
ModResult Module::OnPreCommand(std::string&, std::vector<std::string>&, User *, bool, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnPostCommand(const std::string&, const std::vector<std::string>&, User *, CmdResult, const std::string&) { }
-ModResult Module::OnCheckReady(User*) { return MOD_RES_PASSTHRU; }
-ModResult Module::OnUserRegister(User*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnCheckReady(LocalUser*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnUserRegister(LocalUser*) { return MOD_RES_PASSTHRU; }
ModResult Module::OnUserPreKick(User*, Membership*, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnUserKick(User*, Membership*, const std::string&, CUList&) { }
ModResult Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return MOD_RES_PASSTHRU; }
@@ -103,8 +103,8 @@ ModResult Module::OnCheckChannelBan(User*, Channel*) { return MOD_RES_PASSTHRU;
ModResult Module::OnCheckBan(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
ModResult Module::OnExtBanCheck(User*, Channel*, char) { return MOD_RES_PASSTHRU; }
ModResult Module::OnStats(char, User*, string_list&) { return MOD_RES_PASSTHRU; }
-ModResult Module::OnChangeLocalUserHost(User*, const std::string&) { return MOD_RES_PASSTHRU; }
-ModResult Module::OnChangeLocalUserGECOS(User*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnChangeLocalUserHost(LocalUser*, const std::string&) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnChangeLocalUserGECOS(LocalUser*, const std::string&) { return MOD_RES_PASSTHRU; }
ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnEvent(Event&) { }
void Module::OnRequest(Request&) { }
diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp
index ff6e3c7c2..d2d8f93f8 100644
--- a/src/modules/extra/m_geoip.cpp
+++ b/src/modules/extra/m_geoip.cpp
@@ -62,23 +62,19 @@ class ModuleGeoIP : public Module
}
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
- /* only do lookups on local users */
- if (IS_LOCAL(user))
+ const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString());
+ if (c)
{
- const char* c = GeoIP_country_code_by_addr(gi, user->GetIPString());
- if (c)
- {
- std::map<std::string, std::string>::iterator x = GeoBans.find(c);
- if (x != GeoBans.end())
- ServerInstance->Users->QuitUser(user, x->second);
- }
- else
- {
- if (banunknown)
- ServerInstance->Users->QuitUser(user, "Could not identify your country of origin. Access denied.");
- }
+ std::map<std::string, std::string>::iterator x = GeoBans.find(c);
+ if (x != GeoBans.end())
+ ServerInstance->Users->QuitUser(user, x->second);
+ }
+ else
+ {
+ if (banunknown)
+ ServerInstance->Users->QuitUser(user, "Could not identify your country of origin. Access denied.");
}
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp
index 50c952704..26e968367 100644
--- a/src/modules/extra/m_ldapauth.cpp
+++ b/src/modules/extra/m_ldapauth.cpp
@@ -111,7 +111,7 @@ public:
return true;
}
- ModResult OnUserRegister(User* user)
+ ModResult OnUserRegister(LocalUser* user)
{
if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
{
@@ -208,7 +208,7 @@ public:
}
}
- ModResult OnCheckReady(User* user)
+ ModResult OnCheckReady(LocalUser* user)
{
return ldapAuthed.get(user) ? MOD_RES_PASSTHRU : MOD_RES_DENY;
}
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 0267b6595..29e439ed3 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -551,7 +551,7 @@ class ModuleSSLGnuTLS : public Module
{
// This occurs AFTER OnUserConnect so we can be sure the
// protocol module has propagated the NICK message.
- if (user->GetIOHook() == this && (IS_LOCAL(user)))
+ if (user->GetIOHook() == this)
{
if (sessions[user->GetFd()].sess)
{
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp
index f4f725ab2..abc4608ff 100644
--- a/src/modules/m_antibear.cpp
+++ b/src/modules/m_antibear.cpp
@@ -62,7 +62,7 @@ class ModuleAntiBear : public Module
return MOD_RES_PASSTHRU;
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
user->WriteNumeric(439, "%s :This server has anti-spambot mechanisms enabled.", user->nick.c_str());
user->WriteNumeric(931, "%s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick.c_str());
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index 2c7e58e6a..5c820043c 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -142,7 +142,7 @@ class ModuleCAP : public Module
ServerInstance->Modules->Attach(eventlist, this, 1);
}
- ModResult OnCheckReady(User* user)
+ ModResult OnCheckReady(LocalUser* user)
{
/* Users in CAP state get held until CAP END */
if (cmd.reghold.get(user))
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index 53c761b3e..745dc13d2 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -214,7 +214,7 @@ public:
}
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
for(CGIHostlist::iterator iter = cmd.Hosts.begin(); iter != cmd.Hosts.end(); iter++)
{
@@ -253,7 +253,7 @@ public:
return MOD_RES_PASSTHRU;
}
- virtual void OnUserConnect(User* user)
+ virtual void OnUserConnect(LocalUser* user)
{
std::string *webirc_hostname = cmd.webirc_hostname.get(user);
std::string *webirc_ip = cmd.webirc_ip.get(user);
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index c61868dc3..0ad790de9 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -74,10 +74,10 @@ class CloakUser : public ModeHandler
std::string* cloak = ext.get(dest);
- if (!cloak)
+ if (!cloak && IS_LOCAL(dest))
{
/* Force creation of missing cloak */
- creator->OnUserConnect(dest);
+ creator->OnUserConnect(IS_LOCAL(dest));
cloak = ext.get(dest);
}
if (cloak)
@@ -424,7 +424,7 @@ class ModuleCloaking : public Module
}
}
- void OnUserConnect(User* dest)
+ void OnUserConnect(LocalUser* dest)
{
std::string* cloak = cu.ext.get(dest);
if (cloak)
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index ef834e55a..df575f1b3 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -73,11 +73,10 @@ class ModuleConnJoin : public Module
return Version("Forces users to join the specified channel(s) on connect", VF_VENDOR);
}
- virtual void OnPostConnect(User* user)
+ void OnPostConnect(User* user)
{
if (!IS_LOCAL(user))
return;
-
for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
Channel::JoinUser(user, it->c_str(), false, "", false, ServerInstance->Time());
diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp
index 714114f04..22a4ee0aa 100644
--- a/src/modules/m_conn_umodes.cpp
+++ b/src/modules/m_conn_umodes.cpp
@@ -35,11 +35,8 @@ class ModuleModesOnConnect : public Module
return Version("Sets (and unsets) modes on users when they connect", VF_VENDOR);
}
- virtual void OnUserConnect(User* user)
+ virtual void OnUserConnect(LocalUser* user)
{
- if (!IS_LOCAL(user))
- return;
-
// Backup and zero out the disabled usermodes, so that we can override them here.
char save[64];
memcpy(save, ServerInstance->Config->DisabledUModes,
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index 46f4a69eb..362835c6d 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -55,7 +55,7 @@ class ModuleWaitPong : public Module
return out;
}
- ModResult OnUserRegister(User* user)
+ ModResult OnUserRegister(LocalUser* user)
{
std::string pingrpl = RandString();
@@ -92,7 +92,7 @@ class ModuleWaitPong : public Module
return MOD_RES_PASSTHRU;
}
- ModResult OnCheckReady(User* user)
+ ModResult OnCheckReady(LocalUser* user)
{
return ext.get(user) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index f956cb7db..9506bc2fe 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -66,7 +66,7 @@ class ModuleConnectBan : public Module
banduration = ServerInstance->Duration(duration);
}
- virtual void OnUserConnect(User *u)
+ virtual void OnUserConnect(LocalUser *u)
{
int range = 32;
clonemap::iterator i;
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index b2aaab45a..d2738fe18 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -57,7 +57,7 @@ public:
first = ServerInstance->Time();
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
time_t next = ServerInstance->Time();
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index d97ea940a..486a816da 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -46,12 +46,12 @@ class DNSBLConfEntry
class DNSBLResolver : public Resolver
{
int theirfd;
- User* them;
+ LocalUser* them;
DNSBLConfEntry *ConfEntry;
public:
- DNSBLResolver(Module *me, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached)
+ DNSBLResolver(Module *me, const std::string &hostname, LocalUser* u, int userfd, DNSBLConfEntry *conf, bool &cached)
: Resolver(hostname, DNS_QUERY_A, cached, me)
{
theirfd = userfd;
@@ -322,42 +322,38 @@ class ModuleDNSBL : public Module
ReadConf();
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
- /* only do lookups on local users */
- if (IS_LOCAL(user))
- {
- /* following code taken from bopm, reverses an IP address. */
- struct in_addr in;
- unsigned char a, b, c, d;
- char reversedipbuf[128];
- std::string reversedip;
- bool success;
+ /* following code taken from bopm, reverses an IP address. */
+ struct in_addr in;
+ unsigned char a, b, c, d;
+ char reversedipbuf[128];
+ std::string reversedip;
+ bool success;
- success = inet_aton(user->GetIPString(), &in);
+ success = inet_aton(user->GetIPString(), &in);
- if (!success)
- return MOD_RES_PASSTHRU;
+ if (!success)
+ return MOD_RES_PASSTHRU;
- d = (unsigned char) (in.s_addr >> 24) & 0xFF;
- c = (unsigned char) (in.s_addr >> 16) & 0xFF;
- b = (unsigned char) (in.s_addr >> 8) & 0xFF;
- a = (unsigned char) in.s_addr & 0xFF;
+ d = (unsigned char) (in.s_addr >> 24) & 0xFF;
+ c = (unsigned char) (in.s_addr >> 16) & 0xFF;
+ b = (unsigned char) (in.s_addr >> 8) & 0xFF;
+ a = (unsigned char) in.s_addr & 0xFF;
- snprintf(reversedipbuf, 128, "%d.%d.%d.%d", d, c, b, a);
- reversedip = std::string(reversedipbuf);
+ snprintf(reversedipbuf, 128, "%d.%d.%d.%d", d, c, b, a);
+ reversedip = std::string(reversedipbuf);
- // For each DNSBL, we will run through this lookup
- for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
- {
- // Fill hostname with a dnsbl style host (d.c.b.a.domain.tld)
- std::string hostname = reversedip + "." + (*i)->domain;
+ // For each DNSBL, we will run through this lookup
+ for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++)
+ {
+ // Fill hostname with a dnsbl style host (d.c.b.a.domain.tld)
+ std::string hostname = reversedip + "." + (*i)->domain;
- /* now we'd need to fire off lookups for `hostname'. */
- bool cached;
- DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached);
- ServerInstance->AddResolver(r, cached);
- }
+ /* now we'd need to fire off lookups for `hostname'. */
+ bool cached;
+ DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached);
+ ServerInstance->AddResolver(r, cached);
}
/* don't do anything with this hot potato */
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index 7d998e267..4a067bcac 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -91,9 +91,8 @@ class ModuleHostChange : public Module
return Version("Provides masking of user hostnames in a different way to m_cloaking", VF_VENDOR);
}
- virtual void OnUserConnect(User* iuser)
+ virtual void OnUserConnect(LocalUser* user)
{
- LocalUser* user = (LocalUser*)iuser;
for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++)
{
if (((InspIRCd::MatchCIDR(user->MakeHost(), i->first)) || (InspIRCd::MatchCIDR(user->MakeHostIP(), i->first))))
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 8df849902..fbd7706fe 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -303,7 +303,7 @@ class ModuleIdent : public Module
RequestTimeout = 5;
}
- virtual ModResult OnUserRegister(User *user)
+ virtual ModResult OnUserRegister(LocalUser *user)
{
ConfigTag* tag = user->MyClass->config;
if (!tag->getBool("useident", true))
@@ -334,7 +334,7 @@ class ModuleIdent : public Module
* creating a Timer object and especially better than creating a
* Timer per ident lookup!
*/
- virtual ModResult OnCheckReady(User *user)
+ virtual ModResult OnCheckReady(LocalUser *user)
{
/* Does user have an ident socket attached at all? */
IdentRequestSocket *isock = ext.get(user);
@@ -389,10 +389,10 @@ class ModuleIdent : public Module
{
/* Module unloading, tidy up users */
if (target_type == TYPE_USER)
- OnUserDisconnect((User*)item);
+ OnUserDisconnect((LocalUser*)item);
}
- virtual void OnUserDisconnect(User *user)
+ virtual void OnUserDisconnect(LocalUser *user)
{
/* User disconnect (generic socket detatch event) */
IdentRequestSocket *isock = ext.get(user);
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 12e0cfa84..0c7cc4dc7 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -41,10 +41,6 @@ class InvisibleMode : public ModeHandler
if (m && adding)
m->OnUserQuit(dest, "Connection closed", "Connection closed");
- /* This has to come after setting/unsetting the handler */
- if (m && !adding)
- m->OnPostConnect(dest);
-
/* User appears to vanish or appear from nowhere */
for (UCListIter f = dest->chans.begin(); f != dest->chans.end(); f++)
{
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index d46e85bdd..10453818a 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -146,7 +146,7 @@ class ModuleJumpServer : public Module
{
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
if (js.port && js.redirect_new_users)
{
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index 100b7864b..58f468c50 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -93,7 +93,7 @@ public:
ResetLocked();
}
- virtual ModResult OnUserRegister(User* user)
+ virtual ModResult OnUserRegister(LocalUser* user)
{
if (locked)
{
@@ -103,7 +103,7 @@ public:
return MOD_RES_PASSTHRU;
}
- virtual ModResult OnCheckReady(User* user)
+ virtual ModResult OnCheckReady(LocalUser* user)
{
return locked ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index f6925e974..6c6f060e8 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -97,7 +97,7 @@ class ModuleRandQuote : public Module
return Version("Provides random Quotes on Connect.",VF_VENDOR);
}
- virtual void OnUserConnect(User* user)
+ virtual void OnUserConnect(LocalUser* user)
{
cmd.Handle(std::vector<std::string>(), user);
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 63ab0ccbb..87a95a1ff 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -230,7 +230,7 @@ class ModuleRLine : public Module
return Version("RLINE: Regexp user banning.", VF_COMMON | VF_VENDOR);
}
- virtual void OnUserConnect(User* user)
+ virtual void OnUserConnect(LocalUser* user)
{
// Apply lines on user connect
XLine *rl = ServerInstance->XLines->MatchesLine("R", user);
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 8e1a73354..677e930f2 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -237,7 +237,7 @@ class ModuleSASL : public Module
ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!");
}
- ModResult OnUserRegister(User *user)
+ ModResult OnUserRegister(LocalUser *user)
{
SaslAuthenticator *sasl_ = authExt.get(user);
if (sasl_)
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index d4053fba0..b4adc9300 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -236,7 +236,7 @@ class ModuleShun : public Module
affectopers = MyConf.ReadFlag("shun", "affectopers", "no", 0);
}
- virtual void OnUserConnect(User* user)
+ virtual void OnUserConnect(LocalUser* user)
{
if (!IS_LOCAL(user))
return;
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 3b18874d3..a0acd9b08 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -46,7 +46,7 @@ ModuleSpanningTree::ModuleSpanningTree()
{
I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostTopicChange,
I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
- I_OnChangeLocalUserHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
+ I_OnChangeHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash,
I_OnOper, I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats,
I_OnSetAway, I_OnPostCommand, I_OnUserConnect
@@ -592,7 +592,7 @@ void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
DoConnectTimeout(curtime);
}
-void ModuleSpanningTree::OnUserConnect(User* user)
+void ModuleSpanningTree::OnUserConnect(LocalUser* user)
{
if (user->quitting)
return;
@@ -630,21 +630,19 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created, C
}
}
-ModResult ModuleSpanningTree::OnChangeLocalUserHost(User* user, const std::string &newhost)
+void ModuleSpanningTree::OnChangeHost(User* user, const std::string &newhost)
{
- if (user->registered != REG_ALL)
- return MOD_RES_PASSTHRU;
+ if (user->registered != REG_ALL || !IS_LOCAL(user))
+ return;
parameterlist params;
params.push_back(newhost);
Utils->DoOneToMany(user->uuid,"FHOST",params);
- return MOD_RES_PASSTHRU;
}
void ModuleSpanningTree::OnChangeName(User* user, const std::string &gecos)
{
- // only occurs for local clients
- if (user->registered != REG_ALL)
+ if (user->registered != REG_ALL || !IS_LOCAL(user))
return;
parameterlist params;
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 692442598..b9d5debb3 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -161,7 +161,7 @@ class ModuleSpanningTree : public Module
ModResult OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line);
void OnGetServerDescription(const std::string &servername,std::string &description);
- void OnUserConnect(User* source);
+ void OnUserConnect(LocalUser* source);
void OnUserInvite(User* source,User* dest,Channel* channel, time_t);
void OnPostTopicChange(User* user, Channel* chan, const std::string &topic);
void OnWallops(User* user, const std::string &text);
@@ -169,7 +169,7 @@ class ModuleSpanningTree : public Module
void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
void OnBackgroundTimer(time_t curtime);
void OnUserJoin(Membership* memb, bool sync, bool created, CUList& excepts);
- ModResult OnChangeLocalUserHost(User* user, const std::string &newhost);
+ void OnChangeHost(User* user, const std::string &newhost);
void OnChangeName(User* user, const std::string &gecos);
void OnChangeIdent(User* user, const std::string &ident);
void OnUserPart(Membership* memb, std::string &partmessage, CUList& excepts);
diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp
index 6763e8214..a4c237e4e 100644
--- a/src/modules/m_sqlauth.cpp
+++ b/src/modules/m_sqlauth.cpp
@@ -69,7 +69,7 @@ public:
verbose = Conf.ReadFlag("sqlauth", "verbose", 0); /* Set to true if failed connects should be reported to operators */
}
- ModResult OnUserRegister(User* user)
+ ModResult OnUserRegister(LocalUser* user)
{
if ((!allowpattern.empty()) && (InspIRCd::Match(user->nick,allowpattern)))
{
@@ -176,7 +176,7 @@ public:
}
}
- ModResult OnCheckReady(User* user)
+ ModResult OnCheckReady(LocalUser* user)
{
return sqlAuthed.get(user) ? MOD_RES_PASSTHRU : MOD_RES_DENY;
}
diff --git a/src/modules/m_sqllog.cpp b/src/modules/m_sqllog.cpp
index 6bdcda6cb..8ff12a8d9 100644
--- a/src/modules/m_sqllog.cpp
+++ b/src/modules/m_sqllog.cpp
@@ -248,7 +248,7 @@ class ModuleSQLLog : public Module
return MOD_RES_PASSTHRU;
}
- virtual void OnUserConnect(User* user)
+ virtual void OnUserConnect(LocalUser* user)
{
AddLogEntry(LT_CONNECT,user->nick,user->host,user->server);
}
diff --git a/src/modules/m_sqlutils.cpp b/src/modules/m_sqlutils.cpp
index 28f32ec26..db5a990e1 100644
--- a/src/modules/m_sqlutils.cpp
+++ b/src/modules/m_sqlutils.cpp
@@ -97,7 +97,7 @@ public:
}
}
- void OnUserDisconnect(User* user)
+ void OnUserDisconnect(LocalUser* user)
{
/* A user is disconnecting, first we need to check if they have a list of queries associated with them.
* Then, if they do, we need to erase each of them from our IdUserMap (iduser) so when the module that
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index db2b3a75c..6889ddba3 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -198,14 +198,13 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char
user->WriteCommonQuit(reason, oper_reason);
}
- FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user));
-
if (user->registered != REG_ALL)
if (ServerInstance->Users->unregistered_count)
ServerInstance->Users->unregistered_count--;
if (IS_LOCAL(user))
{
+ FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(IS_LOCAL(user)));
user->DoWrite();
if (user->GetIOHook())
{
diff --git a/src/users.cpp b/src/users.cpp
index 1643c1a37..dfb386871 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1438,7 +1438,7 @@ bool User::ChangeName(const char* gecos)
if (IS_LOCAL(this))
{
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (this,gecos));
+ FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (IS_LOCAL(this),gecos));
if (MOD_RESULT == MOD_RES_DENY)
return false;
FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos));
@@ -1520,7 +1520,7 @@ bool User::ChangeDisplayedHost(const char* shost)
if (IS_LOCAL(this))
{
ModResult MOD_RESULT;
- FIRST_MOD_RESULT(OnChangeLocalUserHost, MOD_RESULT, (this,shost));
+ FIRST_MOD_RESULT(OnChangeLocalUserHost, MOD_RESULT, (IS_LOCAL(this),shost));
if (MOD_RESULT == MOD_RES_DENY)
return false;
}