]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_opermodes.cpp
Reset the already_sent IDs during slow garbage collection
[user/henk/code/inspircd.git] / src / modules / m_opermodes.cpp
index d4b873918e9019e953a8337f28920908cd5119d2..5cd2674a3d6e15b28e458efc1f0f5ab7456eaa55 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
 
 class ModuleModesOnOper : public Module
 {
- private:
-
-
-       ConfigReader *Conf;
-
  public:
        ModuleModesOnOper()
-                       {
-
-               Conf = new ConfigReader;
+       {
                Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 2);
        }
@@ -34,13 +27,10 @@ class ModuleModesOnOper : public Module
 
        virtual void OnRehash(User* user)
        {
-               delete Conf;
-               Conf = new ConfigReader;
        }
 
        virtual ~ModuleModesOnOper()
        {
-               delete Conf;
        }
 
        virtual Version GetVersion()
@@ -53,34 +43,10 @@ class ModuleModesOnOper : public Module
                // whenever a user opers, go through the oper types, find their <type:modes>,
                // and if they have one apply their modes. The mode string can contain +modes
                // to add modes to the user or -modes to take modes from the user.
-               for (int j =0; j < Conf->Enumerate("type"); j++)
-               {
-                       std::string typen = Conf->ReadValue("type","name",j);
-                       if (typen == user->oper)
-                       {
-                               std::string ThisOpersModes = Conf->ReadValue("type","modes",j);
-                               if (!ThisOpersModes.empty())
-                               {
-                                       ApplyModes(user, ThisOpersModes);
-                               }
-                               break;
-                       }
-               }
-
-               if (!opername.empty()) // if user is local ..
+               std::string ThisOpersModes = user->oper->getConfig("modes");
+               if (!ThisOpersModes.empty())
                {
-                       for (int j = 0; j < Conf->Enumerate("oper"); j++)
-                       {
-                               if (opername == Conf->ReadValue("oper", "name", j))
-                               {
-                                       std::string ThisOpersModes = Conf->ReadValue("oper", "modes", j);
-                                       if (!ThisOpersModes.empty())
-                                       {
-                                               ApplyModes(user, ThisOpersModes);
-                                       }
-                                       break;
-                               }
-                       }
+                       ApplyModes(user, ThisOpersModes);
                }
        }
 
@@ -107,8 +73,7 @@ class ModuleModesOnOper : public Module
                        modes.push_back(tokens[k]);
                }
 
-               ServerInstance->SendMode(modes, u);
-               ServerInstance->PI->SendMode(u->uuid, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate());
+               ServerInstance->SendGlobalMode(modes, u);
        }
 };