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));
}
// 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)
/* Fatal error, set write error and bail
*/
this->SetWriteError(errno ? strerror(errno) : "EOF from client");
- printf("\nError on %d\n", this->GetFd());
return;
}
}
ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::FlushWriteBuf()");
}
- printf("end flush\n");
-
if (this->sendq.empty())
{
FOREACH_MOD(I_OnBufferFlushed,OnBufferFlushed(this));
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;
}
}
- 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;
/* 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
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;
}
*/
void User::Write(std::string text)
{
- printf("Write Error is %s\n", *(GetWriteError()) ? "set" : "unset");
if (!ServerInstance->SE->BoundsCheckFd(this))
return;