]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_operprefix.cpp
Remove "servermode" parameter, replace with IS_FAKE() which is more reliable
[user/henk/code/inspircd.git] / src / modules / m_operprefix.cpp
index 0dd762878a590c134af58fdb62c1b4079fb9859f..deb826108af13261ae30b4a4da6681ba9059c8da 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -51,16 +51,16 @@ void AddPrefixChan(User* user, Channel* channel)
 class OperPrefixMode : public ModeHandler
 {
        public:
-               OperPrefixMode(InspIRCd* Instance, char pfx) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx) { }
+               OperPrefixMode(InspIRCd* Instance, Module* Creator, char pfx) : ModeHandler(Instance, Creator, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx, pfx, TR_NICK) { }
 
                unsigned int GetPrefixRank()
                {
                        return OPERPREFIX_VALUE;
                }
 
-               ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool servermode)
+               ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
                {
-                       if (servermode || (source && ServerInstance->ULine(source->server)))
+                       if (IS_FAKE(source) || (source && ServerInstance->ULine(source->server)))
                                return MODEACTION_ALLOW;
                        else
                        {
@@ -113,7 +113,7 @@ class ModuleOperPrefixMode : public Module
                ConfigReader Conf(ServerInstance);
                std::string pfx = Conf.ReadValue("operprefix", "prefix", "!", 0, false);
 
-               opm = new OperPrefixMode(ServerInstance, pfx[0]);
+               opm = new OperPrefixMode(ServerInstance, this, pfx[0]);
                if ((!ServerInstance->Modes->AddMode(opm)))
                        throw ModuleException("Could not add a new mode!");
 
@@ -151,10 +151,10 @@ class ModuleOperPrefixMode : public Module
        }
 
        // XXX: is there a better way to do this?
-       virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt, bool servermode)
+       virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt)
        {
                /* force event propagation to its ModeHandler */
-               if (!servermode && chan && (mode == 'y'))
+               if (!IS_FAKE(user) && chan && (mode == 'y'))
                        return ACR_ALLOW;
                return 0;
        }