OnUserPreJoin is a local-only hook, change User* parameter to LocalUser*

This commit is contained in:
attilamolnar 2013-04-12 15:45:11 +02:00
parent d71b6a8b27
commit 988d821807
17 changed files with 19 additions and 24 deletions

View File

@ -544,7 +544,7 @@ class CoreExport Module : public classbase, public usecountbase
* @param keygiven The key given to join the channel, or an empty string if none was provided
* @return 1 To prevent the join, 0 to allow it.
*/
virtual ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven);
virtual ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven);
/** Called whenever a user is about to be kicked.
* Returning a value of 1 from this function stops the process immediately, causing no

View File

@ -291,7 +291,7 @@ Channel* Channel::JoinUser(User* user, std::string cname, bool override, const s
if (IS_LOCAL(user) && override == false)
{
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, NULL, cname, privs, key));
FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (IS_LOCAL(user), NULL, cname, privs, key));
if (MOD_RESULT == MOD_RES_DENY)
return NULL;
}
@ -311,7 +311,7 @@ Channel* Channel::JoinUser(User* user, std::string cname, bool override, const s
if (IS_LOCAL(user) && override == false)
{
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (user, Ptr, cname, privs, key));
FIRST_MOD_RESULT(OnUserPreJoin, MOD_RESULT, (IS_LOCAL(user), Ptr, cname, privs, key));
if (MOD_RESULT == MOD_RES_DENY)
{
return NULL;

View File

@ -97,7 +97,7 @@ void Module::OnUserPart(Membership*, std::string&, CUList&) { }
void Module::OnPreRehash(User*, const std::string&) { }
void Module::OnModuleRehash(User*, const std::string&) { }
void Module::OnRehash(User*) { }
ModResult Module::OnUserPreJoin(User*, Channel*, const std::string&, std::string&, const std::string&) { return MOD_RES_PASSTHRU; }
ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::string&, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnMode(User*, void*, int, const std::vector<std::string>&, const std::vector<TranslateType>&) { }
void Module::OnOper(User*, const std::string&) { }
void Module::OnPostOper(User*, const std::string&, const std::string &) { }

View File

@ -271,7 +271,7 @@ class ModuleBanRedirect : public Module
}
}
virtual ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string &privs, const std::string &keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{

View File

@ -178,7 +178,7 @@ class ModuleCBan : public Module
return MOD_RES_DENY;
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
XLine *rl = ServerInstance->XLines->MatchesLine("CBAN", cname);

View File

@ -83,7 +83,7 @@ class ModuleDenyChannels : public Module
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
ConfigTagList tags = ServerInstance->Config->ConfTags("badchan");
for (ConfigIter j = tags.first; j != tags.second; ++j)

View File

@ -205,7 +205,7 @@ class ModuleJoinFlood : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{

View File

@ -73,7 +73,7 @@ public:
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{

View File

@ -193,7 +193,7 @@ class ModuleOjoin : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (mycommand.active)
{

View File

@ -49,7 +49,7 @@ class ModuleOperChans : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan && chan->IsModeSet('O') && !user->IsOper())
{

View File

@ -96,7 +96,7 @@ class ModuleOperPrefixMode : public Module
mw_added = ServerInstance->Modes->AddModeWatcher(&hideoperwatcher);
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
/* The user may have the +H umode on himself, but +H does not necessarily correspond
* to the +H of m_hideoper.

View File

@ -116,9 +116,9 @@ class ModuleOverride : public Module
return MOD_RES_PASSTHRU;
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (IS_LOCAL(user) && user->IsOper())
if (user->IsOper())
{
if (chan)
{

View File

@ -131,7 +131,7 @@ class ModuleRedirect : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
{

View File

@ -34,7 +34,7 @@ class ModuleRegOnlyCreate : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (chan)
return MOD_RES_PASSTHRU;

View File

@ -53,11 +53,9 @@ class ModuleRestrictChans : public Module
ReadConfig();
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
irc::string x(cname.c_str());
if (!IS_LOCAL(user))
return MOD_RES_PASSTHRU;
// channel does not yet exist (record is null, about to be created IF we were to allow it)
if (!chan)

View File

@ -245,11 +245,8 @@ class ModuleServicesAccount : public Module
return OnUserPreMessage(user, dest, target_type, text, status, exempt_list);
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if (!IS_LOCAL(user))
return MOD_RES_PASSTHRU;
std::string *account = accountname.get(user);
bool is_registered = account && !account->empty();

View File

@ -92,7 +92,7 @@ class ModuleSSLModes : public Module
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
if(chan && chan->IsModeSet('z'))
{