]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Merge fantasy:allowbots patch from Taros, closing off bug #709, thanks!
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 9 Feb 2009 12:38:04 +0000 (12:38 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 9 Feb 2009 12:38:04 +0000 (12:38 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11069 e03df62e-2008-0410-955e-edbf42e46eb7

conf/modules.conf.example
src/modules/m_alias.cpp

index 4263d778046d4c6a21dce4104cb269fcddd631c7..32b2134016a0b2f7e5991aecd44468e84df0b958 100644 (file)
 #
 # Fantasy settings:
 #
-#<fantasy prefix="!">
+#<fantasy prefix="!" allowbots="no">
 #
 # prefix:
 #  Set the prefix for in-channel aliases (fantasy commands) to the
 #  specified character. If not set, the default is "!".
+# allowbots:
+#  If this is set to no, +B clients will not be able to use fantasy
+#  commands. If not set, the default is no.
 #
 #-#-#-#-#-#-#-#-#-#-#-  ALIAS DEFINITIONS  -#-#-#-#-#-#-#-#-#-#-#-#-#-#
 #                                                                     #
index 160e3cea3942ef53a4ec1b74816e80c03117ca44..4ba05729bd393ba569680de5fecbdb8fa8fd4e13 100644 (file)
@@ -60,9 +60,14 @@ class ModuleAlias : public Module
    */
        std::multimap<std::string, Alias> Aliases;
 
+       /* whether or not +B users are allowed to use fantasy commands */
+       bool AllowBots;
+
        virtual void ReadAliases()
        {
                ConfigReader MyConf(ServerInstance);
+
+               AllowBots = MyConf.ReadFlag("fantasy", "allowbots", "no", 0);
                
                std::string fpre = MyConf.ReadValue("fantasy","prefix",0);
                fprefix = fpre.empty() ? '!' : fpre[0];
@@ -187,6 +192,13 @@ class ModuleAlias : public Module
                        return 0;
                }
 
+               /* Stop here if the user is +B and allowbot is set to no. */
+               if (!AllowBots && user->IsModeSet('B'))
+               {
+                       ServerInstance->Logs->Log("FANTASY", DEBUG, "fantasy: user is +B and allowbot is set to no");
+                       return 0;
+               }
+
                Channel *c = (Channel *)dest;
                std::string fcommand;