From: danieldg Date: Mon, 12 Oct 2009 20:23:26 +0000 (+0000) Subject: Make OnChannelRestrictionApply take a User* instead of a Membership* [jackmcbarn] X-Git-Tag: v2.0.23~1395 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=4ab15e865571f78cd8ea22c47a1a3b7d3372a786;p=user%2Fhenk%2Fcode%2Finspircd.git Make OnChannelRestrictionApply take a User* instead of a Membership* [jackmcbarn] git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11858 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/include/base.h b/include/base.h index f41ea07d2..2bc0e4a6a 100644 --- a/include/base.h +++ b/include/base.h @@ -89,8 +89,8 @@ class CoreExport reference : public reference_base inline const T& operator*() const { return *value; } inline T* operator->() { return value; } inline T& operator*() { return *value; } - operator bool() const { return value; } - operator T*() const { return value; } + inline operator bool() const { return value; } + inline operator T*() const { return value; } }; /** This class can be used on its own to represent an exception, or derived to represent a module-specific exception. diff --git a/include/modules.h b/include/modules.h index 0a1c759e5..b96e6c703 100644 --- a/include/modules.h +++ b/include/modules.h @@ -105,7 +105,7 @@ struct ModResult { }; /** If you change the module API in any way, increment this value. */ -#define API_VERSION 132 +#define API_VERSION 133 class ServerConfig; @@ -1284,7 +1284,7 @@ class CoreExport Module : public Extensible * @return MOD_RES_DENY to apply the restriction, MOD_RES_ALLOW to bypass * the restriction, or MOD_RES_PASSTHRU to check restriction status normally */ - virtual ModResult OnChannelRestrictionApply(Membership* memb, Channel* chan, const char* restriction); + virtual ModResult OnChannelRestrictionApply(User* user, Channel* chan, const char* restriction); }; diff --git a/src/modules.cpp b/src/modules.cpp index 3e9fa84de..169a3a352 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -150,7 +150,7 @@ void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; } void Module::OnHookIO(StreamSocket*, ListenSocketBase*) { } void Module::OnSendWhoLine(User*, User*, Channel*, std::string&) { } -ModResult Module::OnChannelRestrictionApply(Membership*, Channel*, const char*) { return MOD_RES_PASSTHRU; } +ModResult Module::OnChannelRestrictionApply(User*, Channel*, const char*) { return MOD_RES_PASSTHRU; } ModuleManager::ModuleManager() : ModCount(0) { diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index e21e1da88..e24d9e53c 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -60,7 +60,7 @@ public: Channel* c = (Channel*)dest; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"blockcaps")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"blockcaps")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 9075bd8c7..73bfb7606 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -48,7 +48,7 @@ class ModuleBlockColour : public Module { Channel* c = (Channel*)dest; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"blockcolor")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"blockcolor")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 4b08e3711..8ec3f72c1 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -76,7 +76,7 @@ class ModuleCensor : public Module active = ((Channel*)dest)->IsModeSet('G'); Channel* c = (Channel*)dest; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"censor")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"censor")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index cb5f22855..25321536a 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -86,7 +86,7 @@ class ModuleChanFilter : public Module virtual ModResult ProcessMessages(User* user,Channel* chan,std::string &text) { ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (chan->GetUser(user),chan,"filter")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,chan,"filter")); if (!IS_LOCAL(user) || res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index ae2a80b02..83e21bef3 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -99,12 +99,12 @@ class ModuleExemptChanOps : public Module ec.DoSyncChannel(chan, proto, opaque); } - virtual ModResult OnChannelRestrictionApply(Membership* memb, Channel* chan, const char* restriction) + virtual ModResult OnChannelRestrictionApply(User* user, Channel* chan, const char* restriction) { irc::spacesepstream allowstream(alwaysexempt), denystream(neverexempt); std::string current; - if (memb->getRank() != OP_VALUE) + if (chan->GetPrefixValue(user) != OP_VALUE) return MOD_RES_PASSTHRU; // They're not opped, so we don't exempt them while(denystream.GetToken(current)) if (!strcasecmp(restriction, current.c_str())) return MOD_RES_PASSTHRU; // This mode is set to never allow exemptions in the config diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 8a521ebab..bf79babb2 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -208,7 +208,7 @@ class ModuleMsgFlood : public Module ModResult ProcessMessages(User* user,Channel* dest, const std::string &text) { ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (dest->GetUser(user),dest,"flood")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,dest,"flood")); if (!IS_LOCAL(user) || res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 26d04835a..f6a808ffd 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -218,7 +218,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (channel->GetUser(user),channel,"nickflood")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,channel,"nickflood")); if (res == MOD_RES_ALLOW) continue; @@ -257,7 +257,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (channel->GetUser(user),channel,"nickflood")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,channel,"nickflood")); if (res == MOD_RES_ALLOW) return; diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 1d360abe1..b603ee95c 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -79,7 +79,7 @@ class ModuleNoCTCP : public Module { Channel* c = (Channel*)dest; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"noctcp")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"noctcp")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 3e378d59f..1109ff61f 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -86,7 +86,7 @@ class ModuleNoNickChange : public Module Channel* curr = *i; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (curr->GetUser(user),curr,"nonick")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,curr,"nonick")); if (res == MOD_RES_ALLOW) continue; diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 188f08908..b7571f35f 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -53,7 +53,7 @@ class ModuleNoNotice : public Module // ulines are exempt. return MOD_RES_PASSTHRU; } - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"nonotice")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"nonotice")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; else diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 7f4e6d43f..5987b70c9 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -174,7 +174,7 @@ class ModuleServicesAccount : public Module { Channel* c = (Channel*)dest; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"regmoderated")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"regmoderated")); if (c->IsModeSet('M') && !is_registered && res != MOD_RES_ALLOW) { diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 2c2b2363f..37999b319 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -111,7 +111,7 @@ class ModuleStripColor : public Module { Channel* t = (Channel*)dest; ModResult res; - FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (t->GetUser(user),t,"stripcolor")); + FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,t,"stripcolor")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU;