]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_callerid.cpp
fix some unitialised vectors and tidy up a bit.
[user/henk/code/inspircd.git] / src / modules / m_callerid.cpp
index f38c22d79bcb30e64a72af88a18a9575bdcc641d..2a349fdb0f8adc2d926e0e86fd3fef432dbb5c9b 100644 (file)
@@ -7,7 +7,7 @@
 
 /* $ModDesc: Implementation of callerid (umode +g & /accept, ala hybrid etc) */
 
-class callerid_data
+class callerid_data : public classbase
 {
  public:
        time_t lastnotify;
@@ -59,22 +59,12 @@ void RemoveFromAllAccepts(InspIRCd* ServerInstance, User* who)
        }
 }
 
-class User_g : public ModeHandler
+class User_g : public SimpleUserModeHandler
 {
 private:
 
 public:
-       User_g(InspIRCd* Instance) : ModeHandler(Instance, 'g', 0, 0, false, MODETYPE_USER, false) { }
-
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
-       {
-               if (adding != dest->IsModeSet('g'))
-               {
-                       dest->SetMode('g', adding);
-                       return MODEACTION_ALLOW;
-               }
-               return MODEACTION_DENY;
-       }
+       User_g(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'g') { }
 };
 
 class CommandAccept : public Command
@@ -93,9 +83,10 @@ public:
         * /accept nick1,nick2,nick3 *
         * to add 3 nicks and then show your list
         */
-       CmdResult Handle(const char* const* parameters, int pcnt, User* user)
+
+       CmdResult Handle(const std::vector<std::string> &parameters, User* user)
        {
-               if (pcnt < 1)
+               if (parameters.size() < 1)
                {
                        /* Command stuff should've dealt with this already */
                        return CMD_FAILURE;
@@ -103,9 +94,9 @@ public:
                /* Even if callerid mode is not set, we let them manage their ACCEPT list so that if they go +g they can
                 * have a list already setup. */
                bool atleastonechange = false;
-               for (int i = 0; i < pcnt; ++i)
+               for (int i = 0; i < (int)parameters.size(); ++i)
                {
-                       const char* arg = parameters[i];
+                       const char* arg = parameters[i].c_str();
                        irc::commasepstream css(arg);
                        std::string tok;
                        while (css.GetToken(tok))