]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Make OnChannelRestrictionApply take a User* instead of a Membership* [jackmcbarn]
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 12 Oct 2009 20:23:26 +0000 (20:23 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 12 Oct 2009 20:23:26 +0000 (20:23 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11858 e03df62e-2008-0410-955e-edbf42e46eb7

15 files changed:
include/base.h
include/modules.h
src/modules.cpp
src/modules/m_blockcaps.cpp
src/modules/m_blockcolor.cpp
src/modules/m_censor.cpp
src/modules/m_chanfilter.cpp
src/modules/m_exemptchanops.cpp
src/modules/m_messageflood.cpp
src/modules/m_nickflood.cpp
src/modules/m_noctcp.cpp
src/modules/m_nonicks.cpp
src/modules/m_nonotice.cpp
src/modules/m_services_account.cpp
src/modules/m_stripcolor.cpp

index f41ea07d2b4ee47bebdbbef3a65c10f4d62da3bc..2bc0e4a6a4d305f5f80850d71f3c698c9ccb0c44 100644 (file)
@@ -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.
index 0a1c759e56b85d17a30a82b1c44c0a4cbb8ee286..b96e6c70390e248ed433caa19707032794b4e58e 100644 (file)
@@ -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);
 };
 
 
index 3e9fa84ded7ff5171a1a7ef176dc4d2750d8bf25..169a3a352746794ab3203fa58f0bb0929fcd9d3b 100644 (file)
@@ -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)
 {
index e21e1da888ad88f772c8fa9ee3454187816f9934..e24d9e53c4c391710cc12e4f797accdd8fb55a4f 100644 (file)
@@ -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;
index 9075bd8c7471a6d51a2406cec0dfe98cdf92701d..73bfb76069c32ac4213877282908c9eb09f3e697 100644 (file)
@@ -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;
index 4b08e3711020ec40ead30c5a709440cebd43df3b..8ec3f72c14bc51d9f4083c69849669bcfe655737 100644 (file)
@@ -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;
index cb5f22855370b71035aef6e7e4d6b7e90a79d69c..25321536afc2fc66f151a3238e4dd6b7c6d57c8f 100644 (file)
@@ -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;
index ae2a80b02927cfc359921c3d29448e3e2c6884e2..83e21bef3c2c14a16234928267e8de55cf89b5dd 100644 (file)
@@ -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
index 8a521ebab8433ef8e656cddafe270dcb7be7844d..bf79babb2656eea1e66d5e47f8c0097ecbaf7841 100644 (file)
@@ -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;
 
index 26d04835ae62ff4f0e6b7bdd4142350653a6334f..f6a808ffd60f398caffb7f9b4309373624349ba9 100644 (file)
@@ -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;
                                
index 1d360abe174905f606a0766e185e2541f739cf3a..b603ee95c242208dceaeff06b16a04660478c039 100644 (file)
@@ -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;
index 3e378d59f6022a1b91762e413f2cdc007a327da0..1109ff61fec4652bd1ed7029fb5e7c93409adfe6 100644 (file)
@@ -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;
index 188f08908dece91f43170b7553d0c6323fc32d5b..b7571f35fe2eb377b98dc21008edf1c977411c5c 100644 (file)
@@ -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
index 7f4e6d43f1bc667915973357a67c036ad1a8fe8d..5987b70c9d02cdbe1e39b4a2177378d0d363f240 100644 (file)
@@ -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)
                        {
index 2c2b2363fc5fd66b095588cce4460e1cff35a24c..37999b3192c7cd3bf581814cf9a59f78c9892431 100644 (file)
@@ -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;