* ---------------------------------------------------
*/
+/* $Core: libIRCDusers */
+
#include "inspircd.h"
#include <stdarg.h>
#include "socketengine.h"
server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
reset_due = ServerInstance->Time();
age = ServerInstance->Time(true);
+ Penalty = 0;
lines_in = lastping = signon = idle_lastmsg = nping = registered = 0;
ChannelCount = timeout = flood = bytes_in = bytes_out = cmds_in = cmds_out = 0;
- muted = exempt = haspassed = dns_done = false;
+ OverPenalty = ExemptFromPenalty = muted = exempt = haspassed = dns_done = false;
fd = -1;
recvq.clear();
sendq.clear();
{
try
{
- if (!recvq.length())
+ if (recvq.empty())
return "";
/* Strip any leading \r or \n off the string.
void User::QuitUser(InspIRCd* Instance, User *user, const std::string &quitreason, const char* operreason)
{
- user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, operreason);
+ Instance->Log(DEBUG,"QuitUser: %s '%s'", user->nick, quitreason.c_str());
+ user->Write("ERROR :Closing link (%s@%s) [%s]", user->ident, user->host, *operreason ? operreason : quitreason.c_str());
user->muted = true;
Instance->GlobalCulls.AddItem(user, quitreason.c_str(), operreason);
}
return;
}
+ Instance->Log(DEBUG,"New user fd: %d", socket);
+
int j = 0;
Instance->unregistered_count++;
{
if (!Instance->SE->AddFd(New))
{
+ Instance->Log(DEBUG,"Internal error on new connection");
User::QuitUser(Instance, New, "Internal error handling connection");
}
}
* BOPM and other stuff requires it.
*/
New->WriteServ("NOTICE Auth :*** Looking up your hostname...");
+
+ if (Instance->Config->NoUserDns)
+ {
+ New->dns_done = true;
+ }
+ else
+ {
+ New->StartDNSLookup();
+ }
}
unsigned long User::GlobalCloneCount()
}
break;
default:
- ServerInstance->Log(DEBUG,"Ut oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
+ ServerInstance->Log(DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
break;
}
}
return sin->sin_family;
}
+/*
+ * XXX the duplication here is horrid..
+ * do we really need two methods doing essentially the same thing?
+ */
const char* User::GetIPString()
{
static char buf[1024];
return "";
}
-const char* User::GetIPString(char* buf)
-{
- if (this->ip == NULL)
- {
- *buf = 0;
- return buf;
- }
-
- switch (this->GetProtocolFamily())
- {
-#ifdef SUPPORT_IP6LINKS
- case AF_INET6:
- {
- static char temp[1024];
-
- sockaddr_in6* sin = (sockaddr_in6*)this->ip;
- inet_ntop(sin->sin6_family, &sin->sin6_addr, buf, sizeof(buf));
- /* IP addresses starting with a : on irc are a Bad Thing (tm) */
- if (*buf == ':')
- {
- strlcpy(&temp[1], buf, sizeof(temp) - 1);
- *temp = '0';
- strlcpy(buf, temp, sizeof(temp));
- }
- return buf;
- }
- break;
-#endif
- case AF_INET:
- {
- sockaddr_in* sin = (sockaddr_in*)this->ip;
- inet_ntop(sin->sin_family, &sin->sin_addr, buf, sizeof(buf));
- return buf;
- }
- break;
-
- default:
- break;
- }
- return "";
-}
-
/** NOTE: We cannot pass a const reference to this method.
* The string is changed by the workings of the method,
* so that if we pass const ref, we end up copying it to
return operquit ? operquit : "";
}
+void User::IncreasePenalty(int increase)
+{
+ this->Penalty += increase;
+}
+
+void User::DecreasePenalty(int decrease)
+{
+ this->Penalty -= decrease;
+}
+
VisData::VisData()
{
}