]> 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 9276f7d93393823c33bdd59f808cfd89efe99de2..d8ed553a79dde4247bcd08d60e720e8b9ff740da 100644 (file)
@@ -30,8 +30,7 @@ static unsigned long* already_sent = NULL;
 void InitializeAlreadySent(SocketEngine* SE)
 {
        already_sent = new unsigned long[SE->GetMaxFds()];
-       memset(already_sent, 0, SE->GetMaxFds() * sizeof(long));
-       printf("\n\nInit Already Sent, uniq id = %lu\n\n", uniq_id);
+       memset(already_sent, 0, SE->GetMaxFds() * sizeof(unsigned long));
 }
 
 
@@ -622,24 +621,17 @@ void User::AddWriteBuf(const std::string &data)
 // send AS MUCH OF THE USERS SENDQ as we are able to (might not be all of it)
 void User::FlushWriteBuf()
 {
-       printf("\nFlush buffer on %d\n", this->GetFd());
        try
        {
-               printf("1\n");
                if ((this->fd == FD_MAGIC_NUMBER) || (*this->GetWriteError()))
                {
-                       printf("Write error set, clear sendq: %s\n", this->GetWriteError());
                        sendq.clear();
                }
-               printf("2 sendq len = %u fd = %d\n", sendq.length(), this->fd);
                if ((sendq.length()) && (this->fd != FD_MAGIC_NUMBER))
                {
-                       printf("3\n");
                        int old_sendq_length = sendq.length();
                        int n_sent = ServerInstance->SE->Send(this, this->sendq.data(), this->sendq.length(), 0);
 
-                       printf("\nWrote %d\n", n_sent);
-
                        if (n_sent == -1)
                        {
                                if (errno == EAGAIN)
@@ -654,7 +646,6 @@ void User::FlushWriteBuf()
                                        /* Fatal error, set write error and bail
                                         */
                                        this->SetWriteError(errno ? strerror(errno) : "EOF from client");
-                                       printf("\nError on %d\n", this->GetFd());
                                        return;
                                }
                        }
@@ -677,8 +668,6 @@ void User::FlushWriteBuf()
                ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::FlushWriteBuf()");
        }
 
-       printf("end flush\n");
-
        if (this->sendq.empty())
        {
                FOREACH_MOD(I_OnBufferFlushed,OnBufferFlushed(this));
@@ -687,7 +676,6 @@ void User::FlushWriteBuf()
 
 void User::SetWriteError(const std::string &error)
 {
-       printf("SET WRITE ERROR: %s\n", error.c_str());
        // don't try to set the error twice, its already set take the first string.
        if (this->WriteError.empty())
                this->WriteError = error;
@@ -801,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;
@@ -933,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
@@ -1005,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;
        }
@@ -1150,7 +1143,6 @@ const char* User::GetIPString(bool translate4in6)
  */
 void User::Write(std::string text)
 {
-       printf("Write Error is %s\n", *(GetWriteError()) ? "set" : "unset");
        if (!ServerInstance->SE->BoundsCheckFd(this))
                return;