#include <stdarg.h>
#include "inspstring.h"
#include "commands.h"
-#include "helperfuncs.h"
+
#include "typedefs.h"
#include "socketengine.h"
#include "hashcomp.h"
char* Classes = (char*)values[1];
opertypes[TypeName] = strdup(Classes);
- ilog(conf->GetInstance(),DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes);
+ conf->GetInstance()->Log(DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes);
return true;
}
char* CommandList = (char*)values[1];
operclass[ClassName] = strdup(CommandList);
- ilog(conf->GetInstance(),DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList);
+ conf->GetInstance()->Log(DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList);
return true;
}
void userrec::StartDNSLookup()
{
- log(DEBUG,"Commencing reverse lookup");
+ ServerInstance->Log(DEBUG,"Commencing reverse lookup");
try
{
- log(DEBUG,"Passing instance: %08x",this->ServerInstance);
+ ServerInstance->Log(DEBUG,"Passing instance: %08x",this->ServerInstance);
res_reverse = new UserResolver(this->ServerInstance, this, this->GetIPString(), false);
this->ServerInstance->AddResolver(res_reverse);
}
catch (ModuleException& e)
{
- log(DEBUG,"Error in resolver: %s",e.GetReason());
+ ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
}
}
{
if ((!this->fwd) && (ServerInstance->fd_ref_table[this->bound_fd] == this->bound_user))
{
- log(DEBUG,"Commencing forward lookup");
+ ServerInstance->Log(DEBUG,"Commencing forward lookup");
this->bound_user->stored_host = result;
try
{
- bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, true);
- this->ServerInstance->AddResolver(bound_user->res_forward);
+ /* Check we didnt time out */
+ if (this->bound_user->registered != REG_ALL)
+ {
+ bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, true);
+ this->ServerInstance->AddResolver(bound_user->res_forward);
+ }
}
catch (ModuleException& e)
{
- log(DEBUG,"Error in resolver: %s",e.GetReason());
+ ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
}
}
else if ((this->fwd) && (ServerInstance->fd_ref_table[this->bound_fd] == this->bound_user))
std::string hostname = this->bound_user->stored_host;
if (hostname.length() < 65)
{
- /* Hostnames starting with : are not a good thing (tm) */
- if (*(hostname.c_str()) == ':')
- hostname = "0" + hostname;
-
- this->bound_user->WriteServ("NOTICE Auth :*** Found your hostname (%s)", hostname.c_str());
- this->bound_user->dns_done = true;
- strlcpy(this->bound_user->dhost, hostname.c_str(),64);
- strlcpy(this->bound_user->host, hostname.c_str(),64);
+ /* Check we didnt time out */
+ if (this->bound_user->registered != REG_ALL)
+ {
+ /* Hostnames starting with : are not a good thing (tm) */
+ if (*(hostname.c_str()) == ':')
+ hostname = "0" + hostname;
+
+ this->bound_user->WriteServ("NOTICE Auth :*** Found your hostname (%s)", hostname.c_str());
+ this->bound_user->dns_done = true;
+ strlcpy(this->bound_user->dhost, hostname.c_str(),64);
+ strlcpy(this->bound_user->host, hostname.c_str(),64);
+ }
}
else
{
userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
{
- log(DEBUG,"userrec::userrec(): Instance: %08x",ServerInstance);
+ ServerInstance->Log(DEBUG,"userrec::userrec(): Instance: %08x",ServerInstance);
// the PROPER way to do it, AVOID bzero at *ALL* costs
*password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = 0;
server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
void userrec::RemoveInvite(irc::string &channel)
{
- log(DEBUG,"Removing invites");
+ ServerInstance->Log(DEBUG,"Removing invites");
if (invites.size())
{
void userrec::SetWriteError(const std::string &error)
{
- log(DEBUG,"SetWriteError: %s",error.c_str());
+ ServerInstance->Log(DEBUG,"SetWriteError: %s",error.c_str());
// don't try to set the error twice, its already set take the first string.
if (!this->WriteError.length())
{
- log(DEBUG,"Setting error string for %s to '%s'",this->nick,error.c_str());
+ ServerInstance->Log(DEBUG,"Setting error string for %s to '%s'",this->nick,error.c_str());
this->WriteError = error;
}
}
this->modes[UM_OPERATOR] = 1;
this->WriteServ("MODE %s :+o", this->nick);
FOREACH_MOD(I_OnOper, OnOper(this, opertype));
- log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str());
+ ServerInstance->Log(DEFAULT,"OPER: %s!%s@%s opered as type: %s", this->nick, this->ident, this->host, opertype.c_str());
strlcpy(this->oper, opertype.c_str(), NICKMAX - 1);
ServerInstance->all_opers.push_back(this);
FOREACH_MOD(I_OnPostOper,OnPostOper(this, opertype));
{
if (*a == this)
{
- log(DEBUG,"Oper removed from optimization list");
+ ServerInstance->Log(DEBUG,"Oper removed from optimization list");
ServerInstance->all_opers.erase(a);
return;
}
}
catch (ModuleException& modexcept)
{
- ilog(Instance,DEBUG,"Module exception cought: %s",modexcept.GetReason());
+ Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason());
}
}
if (iter != Instance->clientlist.end())
{
- ilog(Instance,DEBUG,"deleting user hash value %lx",(unsigned long)user);
+ Instance->Log(DEBUG,"deleting user hash value %lx",(unsigned long)user);
if (IS_LOCAL(user))
{
Instance->fd_ref_table[user->fd] = NULL;
Instance->clientlist.erase(iter);
}
- ilog(Instance,DEBUG,"AddClient: %d %d %s",socket,port,ipaddr);
+ Instance->Log(DEBUG,"AddClient: %d %d %s",socket,port,ipaddr);
_new = new userrec(Instance);
Instance->clientlist[tempnick] = _new;
_new->signon = Instance->Time() + Instance->Config->dns_timeout;
_new->lastping = 1;
- ilog(Instance,DEBUG,"Setting socket addresses");
+ Instance->Log(DEBUG,"Setting socket addresses");
_new->SetSockAddr(AF_FAMILY, ipaddr, port);
- ilog(Instance,DEBUG,"Socket addresses set.");
+ Instance->Log(DEBUG,"Socket addresses set.");
/* Smarter than your average bear^H^H^H^Hset of strlcpys. */
for (const char* temp = _new->GetIPString(); *temp && j < 64; temp++, j++)
this->WriteServ("001 %s :Welcome to the %s IRC Network %s!%s@%s",this->nick, ServerInstance->Config->Network, this->nick, this->ident, this->host);
this->WriteServ("002 %s :Your host is %s, running version %s",this->nick,ServerInstance->Config->ServerName,VERSION);
this->WriteServ("003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__);
- this->WriteServ("004 %s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->ModeGrok->UserModeList().c_str(), ServerInstance->ModeGrok->ChannelModeList().c_str(), ServerInstance->ModeGrok->ParaModeList().c_str());
+ this->WriteServ("004 %s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str());
// anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
// so i'd better split it :)
#ifdef SUPPORT_IP6LINKS
case AF_INET6:
{
- log(DEBUG,"Set inet6 protocol address");
+ ServerInstance->Log(DEBUG,"Set inet6 protocol address");
sockaddr_in6* sin = new sockaddr_in6;
sin->sin6_family = AF_INET6;
sin->sin6_port = port;
#endif
case AF_INET:
{
- log(DEBUG,"Set inet4 protocol address");
+ ServerInstance->Log(DEBUG,"Set inet4 protocol address");
sockaddr_in* sin = new sockaddr_in;
sin->sin_family = AF_INET;
sin->sin_port = port;
}
break;
default:
- log(DEBUG,"Ut oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
+ ServerInstance->Log(DEBUG,"Ut oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
break;
}
}
}
break;
default:
- log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
+ ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
break;
}
return 0;
}
break;
default:
- log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
+ ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
break;
}
return "";
break;
default:
- log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
+ ServerInstance->Log(DEBUG,"Ut oh, '%s' has an unknown protocol family!",this->nick);
break;
}
return "";
}
catch (ModuleException& modexcept)
{
- log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
+ ServerInstance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason());
}
}
else