]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sasl.cpp
Rip flood/threshold out of config classes also.
[user/henk/code/inspircd.git] / src / modules / m_sasl.cpp
index 259c3bd162002c4c8f6b302b2359633f03c611eb..a9f2f205c8c0438643c0aaf8b66a82d1e3d45030 100644 (file)
@@ -101,7 +101,7 @@ class SaslAuthenticator : public classbase
                this->result = SASL_ABORT;
        }
 
-       bool SendClientMessage(const char* const* parameters, int pcnt)
+       bool SendClientMessage(const std::vector<std::string>& parameters)
        {
                if (this->state != SASL_COMM)
                        return true;
@@ -113,12 +113,11 @@ class SaslAuthenticator : public classbase
                params.push_back(this->agent);
                params.push_back("C");
 
-               for (int i = 0; i < pcnt; ++i)
-                       params.push_back(parameters[i]);                
+               params.insert(params.end(), parameters.begin(), parameters.end());
 
                ServerInstance->PI->SendEncapsulatedData(params);
 
-               if (*parameters[0] == '*')
+               if (parameters[0][0] == '*')
                {
                        this->Abort();
                        return false;
@@ -135,13 +134,13 @@ class SaslAuthenticator : public classbase
                switch (this->result)
                {
                 case SASL_OK:
-                       this->user->WriteNumeric(903, "%s :SASL authentication successful", this->user->nick);
+                       this->user->WriteNumeric(903, "%s :SASL authentication successful", this->user->nick.c_str());
                        break;
                 case SASL_ABORT:
-                       this->user->WriteNumeric(906, "%s :SASL authentication aborted", this->user->nick);
+                       this->user->WriteNumeric(906, "%s :SASL authentication aborted", this->user->nick.c_str());
                        break;
                 case SASL_FAIL:
-                       this->user->WriteNumeric(904, "%s :SASL authentication failed", this->user->nick);
+                       this->user->WriteNumeric(904, "%s :SASL authentication failed", this->user->nick.c_str());
                        break;
                 default:
                        break;
@@ -166,7 +165,7 @@ class CommandAuthenticate : public Command
                this->source = "m_sasl.so";
        }
 
-       CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+       CmdResult Handle (const std::vector<std::string>& parameters, User *user)
        {
                /* Only allow AUTHENTICATE on unregistered clients */
                if (user->registered != REG_ALL)
@@ -177,7 +176,7 @@ class CommandAuthenticate : public Command
                        SaslAuthenticator *sasl;
                        if (!(user->GetExt("sasl_authenticator", sasl)))
                                sasl = new SaslAuthenticator(user, parameters[0], ServerInstance, Creator);
-                       else if (sasl->SendClientMessage(parameters, pcnt) == false)    // IAL abort extension --nenolod
+                       else if (sasl->SendClientMessage(parameters) == false)  // IAL abort extension --nenolod
                                delete sasl;
                }
                return CMD_FAILURE;
@@ -189,7 +188,7 @@ class ModuleSASL : public Module
 {
        CommandAuthenticate* sasl;
  public:
-       
+
        ModuleSASL(InspIRCd* Me)
                : Module(Me)
        {
@@ -251,7 +250,7 @@ class ModuleSASL : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1,2,0,1,VF_VENDOR,API_VERSION);
+               return Version("$Id$",VF_VENDOR,API_VERSION);
        }
 
        virtual void OnEvent(Event *ev)