]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Fix bad throws and some other stuff in this module
[user/henk/code/inspircd.git] / src / users.cpp
index 5b46d172c8b281f9177e1767abbdba611842b4ba..d8ed553a79dde4247bcd08d60e720e8b9ff740da 100644 (file)
 #include "bancache.h"
 #include "commands/cmd_whowas.h"
 
+/* XXX: Used for speeding up WriteCommon operations */
+unsigned long uniq_id = 1;
+
 static unsigned long* already_sent = NULL;
 
 
 void InitializeAlreadySent(SocketEngine* SE)
 {
        already_sent = new unsigned long[SE->GetMaxFds()];
-       memset(already_sent, 0, sizeof(already_sent));
+       memset(already_sent, 0, SE->GetMaxFds() * sizeof(unsigned long));
 }
 
-/* XXX: Used for speeding up WriteCommon operations */
-unsigned long uniq_id = 1;
 
 std::string User::ProcessNoticeMasks(const char *sm)
 {
@@ -788,8 +789,11 @@ void User::UnOper()
                        }
                }
 
-               const char* parameters[] = { this->nick, moderemove.c_str() };
-               ServerInstance->Parser->CallHandler("MODE", parameters, 2, this);
+               std::vector<std::string> parameters;
+               parameters.push_back(this->nick);
+               parameters.push_back(moderemove);
+
+               ServerInstance->Parser->CallHandler("MODE", parameters, this);
 
                /* unset their oper type (what IS_OPER checks), and remove +o */
                *this->oper = 0;
@@ -861,7 +865,7 @@ void User::CheckClass()
 
 void User::CheckLines()
 {
-       char* check[] = { "G" , "K", NULL };
+       const char* check[] = { "G" , "K", NULL };
 
        if (!this->exempt)
        {
@@ -920,9 +924,9 @@ void User::FullConnect()
 
        /* Trigger LUSERS output, give modules a chance too */
        int MOD_RESULT = 0;
-       FOREACH_RESULT(I_OnPreCommand, OnPreCommand("LUSERS", NULL, 0, this, true, "LUSERS"));
+       FOREACH_RESULT(I_OnPreCommand, OnPreCommand("LUSERS", std::vector<std::string>(), this, true, "LUSERS"));
        if (!MOD_RESULT)
-               ServerInstance->CallCommandHandler("LUSERS", NULL, 0, this);
+               ServerInstance->CallCommandHandler("LUSERS", std::vector<std::string>(), this);
 
        /*
         * We don't set REG_ALL until triggering OnUserConnect, so some module events don't spew out stuff
@@ -992,8 +996,10 @@ bool User::ForceNickChange(const char* newnick)
        Command* nickhandler = ServerInstance->Parser->GetHandler("NICK");
        if (nickhandler) // wtfbbq, when would this not be here
        {
+               std::vector<std::string> parameters;
                nickhandler->HandleInternal(1, dummy);
-               bool result = (ServerInstance->Parser->CallHandler("NICK", &newnick, 1, this) == CMD_SUCCESS);
+               parameters.push_back(newnick);
+               bool result = (ServerInstance->Parser->CallHandler("NICK", parameters, this) == CMD_SUCCESS);
                nickhandler->HandleInternal(0, dummy);
                return result;
        }