]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_operprefix.cpp
Fix memory leak and invalid vtable location on unload of m_sslinfo
[user/henk/code/inspircd.git] / src / modules / m_operprefix.cpp
index 0dd762878a590c134af58fdb62c1b4079fb9859f..aeea1ad196e163f59b0f2a7817a7b3152013ac37 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,12 +151,12 @@ 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 ModResult 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'))
-                       return ACR_ALLOW;
-               return 0;
+               if (!IS_FAKE(user) && chan && (mode == 'y'))
+                       return MOD_RES_ALLOW;
+               return MOD_RES_PASSTHRU;
        }
 
        virtual void OnOper(User *user, const std::string&)