git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9001
e03df62e-2008-0410-955e-
edbf42e46eb7
67 files changed:
} \
catch (CoreException& modexcept) \
{ \
} \
catch (CoreException& modexcept) \
{ \
- ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
+ ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
} \
catch (CoreException& modexcept) \
{ \
} \
catch (CoreException& modexcept) \
{ \
- z->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
+ z->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
} \
catch (CoreException& modexcept) \
{ \
} \
catch (CoreException& modexcept) \
{ \
- ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
+ ServerInstance->Logs->Log("MODULE",DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
} \
catch (CoreException& modexcept) \
{ \
} \
catch (CoreException& modexcept) \
{ \
- z->Log(DEBUG,"Exception caught: %s",modexcept.GetReason()); \
+ z->Logs->Log("MODULE",DEBUG,"Exception caught: %s",modexcept.GetReason()); \
if (!IS_LOCAL(user))
{
if (!TS)
if (!IS_LOCAL(user))
{
if (!TS)
- Instance->Log(DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn);
+ Instance->Logs->Log("CHANNEL",DEBUG,"*** BUG *** Channel::JoinUser called for REMOTE user '%s' on channel '%s' but no TS given!", user->nick, cn);
RFCCommands[f->command] = so_handle;
else
{
RFCCommands[f->command] = so_handle;
else
{
- ServerInstance->Log(DEFAULT,"ERK! Somehow, we loaded a cmd_*.so file twice! Only the first instance is being recorded.");
+ ServerInstance->Logs->Log("COMMAND",DEFAULT,"ERK! Somehow, we loaded a cmd_*.so file twice! Only the first instance is being recorded.");
const char* err = dlerror();
if (err && !(*v))
{
const char* err = dlerror();
if (err && !(*v))
{
- ServerInstance->Log(SPARSE, "Error loading core command %s: %s\n", name.c_str(), err);
+ ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s\n", name.c_str(), err);
return false;
}
return true;
return false;
}
return true;
/* Command already exists? Succeed silently - this is needed for REHASH */
if (RFCCommands.find(name) != RFCCommands.end())
{
/* Command already exists? Succeed silently - this is needed for REHASH */
if (RFCCommands.find(name) != RFCCommands.end())
{
- ServerInstance->Log(DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name);
+ ServerInstance->Logs->Log("COMMAND",DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name);
if (!h)
{
const char* n = dlerror();
if (!h)
{
const char* n = dlerror();
- ServerInstance->Log(SPARSE, "Error loading core command %s: %s", name, n);
+ ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s", name, n);
if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash))
{
std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds.";
if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash))
{
std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds.";
- ServerInstance->Log(SPARSE, diebuf);
+ ServerInstance->Logs->Log("COMMAND",SPARSE, diebuf);
ServerInstance->SendError(diebuf);
if (ServerInstance->Config->DieDelay)
ServerInstance->SendError(diebuf);
if (ServerInstance->Config->DieDelay)
- ServerInstance->Log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
+ ServerInstance->Logs->Log("COMMAND",SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
ServerInstance->SNO->WriteToSnoMask('A', "Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);
return CMD_FAILURE;
}
ServerInstance->SNO->WriteToSnoMask('A', "Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);
return CMD_FAILURE;
}
* snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
*/
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
* snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
*/
ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
- ServerInstance->Log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
+ ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
/* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
* hidekillsserver as source if possible
*/
/* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
* hidekillsserver as source if possible
*/
{
user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType);
{
user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType);
- ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host);
+ ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host);
return CMD_FAILURE;
}
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","host", j, HostName, MAXBUF);
return CMD_FAILURE;
}
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "type","host", j, HostName, MAXBUF);
Event rmode2((char *)&n, NULL, "send_snoset");
rmode2.Send(ServerInstance);
Event rmode2((char *)&n, NULL, "send_snoset");
rmode2.Send(ServerInstance);
- ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0],fields.c_str());
+ ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0],fields.c_str());
return CMD_FAILURE;
}
else
return CMD_FAILURE;
}
else
Event rmode2((char *)&n, NULL, "send_snoset");
rmode2.Send(ServerInstance);
Event rmode2((char *)&n, NULL, "send_snoset");
rmode2.Send(ServerInstance);
- ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0]);
+ ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0]);
CmdResult CommandRestart::Handle (const char* const* parameters, int, User *user)
{
CmdResult CommandRestart::Handle (const char* const* parameters, int, User *user)
{
- ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
+ ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick);
if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0], ServerInstance->Config->powerhash))
{
ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0], ServerInstance->Config->powerhash))
{
ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
if (iter == whowas.end())
{
/* this should never happen, if it does maps are corrupt */
if (iter == whowas.end())
{
/* this should never happen, if it does maps are corrupt */
- ServerInstance->Log(DEFAULT, "BUG: Whowas maps got corrupted! (1)");
+ ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (1)");
if (iter == whowas.end())
{
/* this should never happen, if it does maps are corrupt */
if (iter == whowas.end())
{
/* this should never happen, if it does maps are corrupt */
- ServerInstance->Log(DEFAULT, "BUG: Whowas maps got corrupted! (2)");
+ ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (2)");
return;
}
whowas_set* n = (whowas_set*)iter->second;
return;
}
whowas_set* n = (whowas_set*)iter->second;
if (iter == whowas.end())
{
/* this should never happen, if it does maps are corrupt */
if (iter == whowas.end())
{
/* this should never happen, if it does maps are corrupt */
- ServerInstance->Log(DEFAULT, "BUG: Whowas maps got corrupted! (3)");
+ ServerInstance->Logs->Log("WHOWAS",DEFAULT, "BUG: Whowas maps got corrupted! (3)");
{
if ((data.GetInteger() < 0) || (data.GetInteger() > 31))
{
{
if ((data.GetInteger() < 0) || (data.GetInteger() > 31))
{
- conf->GetInstance()->Log(DEFAULT,"WARNING: <options:maxtargets> value is greater than 31 or less than 0, set to 20.");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:maxtargets> value is greater than 31 or less than 0, set to 20.");
data.Set(20);
}
return true;
data.Set(20);
}
return true;
{
if ((data.GetInteger() < 1) || (data.GetInteger() > MAXCLIENTS))
{
{
if ((data.GetInteger() < 1) || (data.GetInteger() > MAXCLIENTS))
{
- conf->GetInstance()->Log(DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS);
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:softlimit> value is greater than %d or less than 0, set to %d.",MAXCLIENTS,MAXCLIENTS);
data.Set(MAXCLIENTS);
}
return true;
data.Set(MAXCLIENTS);
}
return true;
bool ValidateMaxConn(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
if (data.GetInteger() > SOMAXCONN)
bool ValidateMaxConn(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
if (data.GetInteger() > SOMAXCONN)
- conf->GetInstance()->Log(DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <options:somaxconn> value may be higher than the system-defined SOMAXCONN value!");
{
std::string nameserver;
// attempt to look up their nameserver from /etc/resolv.conf
{
std::string nameserver;
// attempt to look up their nameserver from /etc/resolv.conf
- conf->GetInstance()->Log(DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf...");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf...");
std::ifstream resolv("/etc/resolv.conf");
bool found_server = false;
std::ifstream resolv("/etc/resolv.conf");
bool found_server = false;
resolv >> nameserver;
data.Set(nameserver.c_str());
found_server = true;
resolv >> nameserver;
data.Set(nameserver.c_str());
found_server = true;
- conf->GetInstance()->Log(DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str());
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"<dns:server> set to '%s' as first resolver in /etc/resolv.conf.",nameserver.c_str());
- conf->GetInstance()->Log(DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf contains no viable nameserver entries! Defaulting to nameserver '127.0.0.1'!");
data.Set("127.0.0.1");
}
}
else
{
data.Set("127.0.0.1");
}
}
else
{
- conf->GetInstance()->Log(DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"/etc/resolv.conf can't be opened! Defaulting to nameserver '127.0.0.1'!");
data.Set("127.0.0.1");
}
}
data.Set("127.0.0.1");
}
}
}
if (!strchr(data.GetString(),'.'))
{
}
if (!strchr(data.GetString(),'.'))
{
- conf->GetInstance()->Log(DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",data.GetString(),data.GetString(),'.');
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",data.GetString(),data.GetString(),'.');
std::string moo = std::string(data.GetString()).append(".");
data.Set(moo.c_str());
}
std::string moo = std::string(data.GetString()).append(".");
data.Set(moo.c_str());
}
{
if ((!data.GetInteger()) || (data.GetInteger() > 65535) || (data.GetInteger() < 1024))
{
{
if ((!data.GetInteger()) || (data.GetInteger() > 65535) || (data.GetInteger() < 1024))
{
- conf->GetInstance()->Log(DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"No NetBufferSize specified or size out of range, setting to default of 10240.");
data.Set(10240);
}
return true;
data.Set(10240);
}
return true;
{
if ((data.GetInteger() > 65535) || (data.GetInteger() < 1))
{
{
if ((data.GetInteger() > 65535) || (data.GetInteger() < 1))
{
- conf->GetInstance()->Log(DEFAULT,"<options:maxwhoresults> size out of range, setting to default of 128.");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"<options:maxwhoresults> size out of range, setting to default of 128.");
data.Set(128);
}
return true;
data.Set(128);
}
return true;
if (conf->WhoWasMaxKeep < 3600)
{
conf->WhoWasMaxKeep = 3600;
if (conf->WhoWasMaxKeep < 3600)
{
conf->WhoWasMaxKeep = 3600;
- conf->GetInstance()->Log(DEFAULT,"WARNING: <whowas:maxkeep> value less than 3600, setting to default 3600");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"WARNING: <whowas:maxkeep> value less than 3600, setting to default 3600");
}
Command* whowas_command = conf->GetInstance()->Parser->GetHandler("WHOWAS");
}
Command* whowas_command = conf->GetInstance()->Parser->GetHandler("WHOWAS");
*/
bool InitConnect(ServerConfig* conf, const char*)
{
*/
bool InitConnect(ServerConfig* conf, const char*)
{
- conf->GetInstance()->Log(DEFAULT,"Reading connect classes...");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Reading connect classes...");
for (ClassVector::iterator i = conf->Classes.begin(); i != conf->Classes.end(); i++)
{
ConnectClass *c = *i;
for (ClassVector::iterator i = conf->Classes.begin(); i != conf->Classes.end(); i++)
{
ConnectClass *c = *i;
- conf->GetInstance()->Log(DEBUG, "Address of class is %p", c);
+ conf->GetInstance()->Logs->Log("CONFIG",DEBUG, "Address of class is %p", c);
}
for (ClassVector::iterator i = conf->Classes.begin(); i != conf->Classes.end() ; )
}
for (ClassVector::iterator i = conf->Classes.begin(); i != conf->Classes.end() ; )
/* only delete a class with refcount 0 */
if (c->RefCount == 0)
{
/* only delete a class with refcount 0 */
if (c->RefCount == 0)
{
- conf->GetInstance()->Log(DEFAULT, "Removing connect class, refcount is 0!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT, "Removing connect class, refcount is 0!");
/* This was causing a crash, because we'd set i to .begin() just here, but then the for loop's increment would
* set it to .begin() + 1. Which if it was already the last thing in the list, wasn't good.
/* This was causing a crash, because we'd set i to .begin() just here, but then the for loop's increment would
* set it to .begin() + 1. Which if it was already the last thing in the list, wasn't good.
{
/* reenable class so users can be shoved into it :P */
cc->SetDisabled(false);
{
/* reenable class so users can be shoved into it :P */
cc->SetDisabled(false);
- conf->GetInstance()->Log(DEFAULT, "Not adding class, it already exists!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT, "Not adding class, it already exists!");
- conf->GetInstance()->Log(DEFAULT,"Adding a connect class!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT,"Adding a connect class!");
for (; item != conf->Classes.end(); ++item)
{
ConnectClass* cc = *item;
for (; item != conf->Classes.end(); ++item)
{
ConnectClass* cc = *item;
- conf->GetInstance()->Log(DEBUG,"Class: %s", cc->GetName().c_str());
+ conf->GetInstance()->Logs->Log("CONFIG",DEBUG,"Class: %s", cc->GetName().c_str());
if (cc->GetName() == parent)
{
ConnectClass* newclass = new ConnectClass(name, cc);
if (cc->GetName() == parent)
{
ConnectClass* newclass = new ConnectClass(name, cc);
*/
bool DoneConnect(ServerConfig *conf, const char*)
{
*/
bool DoneConnect(ServerConfig *conf, const char*)
{
- conf->GetInstance()->Log(DEFAULT, "Done adding connect classes!");
+ conf->GetInstance()->Logs->Log("CONFIG",DEFAULT, "Done adding connect classes!");
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail, User* user)
{
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail, User* user)
{
- ServerInstance->Log(DEFAULT, "There were errors in your configuration file: %s", errormessage.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEFAULT, "There were errors in your configuration file: %s", errormessage.c_str());
if (bail)
{
/* Unneeded because of the ServerInstance->Log() aboive? */
if (bail)
{
/* Unneeded because of the ServerInstance->Log() aboive? */
- ServerInstance->Log(DEBUG,"End config pass %d", pass);
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"End config pass %d", pass);
- ServerInstance->Log(DEBUG, "Downloading configuration");
+ ServerInstance->Logs->Log("CONFIG",DEBUG, "Downloading configuration");
TotalDownloaded = 0;
FileErrors = 0;
TotalDownloaded = 0;
FileErrors = 0;
// write once here, to try it out and make sure its ok
ServerInstance->WritePID(this->PID);
// write once here, to try it out and make sure its ok
ServerInstance->WritePID(this->PID);
- ServerInstance->Log(DEFAULT,"Done reading configuration file.");
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"Done reading configuration file.");
/* If we're rehashing, let's load any new modules, and unload old ones
*/
/* If we're rehashing, let's load any new modules, and unload old ones
*/
- ServerInstance->Log(DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"Successfully unloaded %lu of %lu modules and loaded %lu of %lu modules.",(unsigned long)rem,(unsigned long)removed_modules.size(),(unsigned long)add,(unsigned long)added_modules.size());
if (user)
user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick);
if (user)
user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick);
/* XXX: This can and will block! */
void ServerConfig::DoDownloads()
{
/* XXX: This can and will block! */
void ServerConfig::DoDownloads()
{
- ServerInstance->Log(DEBUG,"In DoDownloads()");
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"In DoDownloads()");
/* Reads all local files into the IncludedFiles map, then initiates sockets for the remote ones */
for (std::map<std::string, std::istream*>::iterator x = IncludedFiles.begin(); x != IncludedFiles.end(); ++x)
/* Reads all local files into the IncludedFiles map, then initiates sockets for the remote ones */
for (std::map<std::string, std::istream*>::iterator x = IncludedFiles.begin(); x != IncludedFiles.end(); ++x)
if (CompletedFiles.find(x->first) != CompletedFiles.end())
continue;
if (CompletedFiles.find(x->first) != CompletedFiles.end())
continue;
- ServerInstance->Log(DEBUG,"StartDownloads File: %s", x->first.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"StartDownloads File: %s", x->first.c_str());
std::string file = x->first;
if ((file[0] == '/') || (file.substr(0, 7) == "file://"))
std::string file = x->first;
if ((file[0] == '/') || (file.substr(0, 7) == "file://"))
std::ifstream* conf = new std::ifstream(file.c_str());
if (!conf->fail())
{
std::ifstream* conf = new std::ifstream(file.c_str());
if (!conf->fail())
{
- ServerInstance->Log(DEBUG,"file:// schema file %s loaded OK", file.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"file:// schema file %s loaded OK", file.c_str());
delete x->second;
x->second = conf;
}
delete x->second;
x->second = conf;
}
else
{
/* Modules handle these */
else
{
/* Modules handle these */
- ServerInstance->Log(DEBUG,"Module-handled schema for %s", x->first.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"Module-handled schema for %s", x->first.c_str());
/* For now, error it */
int MOD_RESULT = 0;
/* For now, error it */
int MOD_RESULT = 0;
if (scan_for_includes_only)
{
if (scan_for_includes_only)
{
- ServerInstance->Log(DEBUG,"scan_for_includes_only set");
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"scan_for_includes_only set");
conf = scan_for_includes_only;
}
conf = scan_for_includes_only;
}
- ServerInstance->Log(DEBUG,"Push include file %s onto map", filename);
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"Push include file %s onto map", filename);
/* First pass, we insert the file into a map, and just return true */
IncludedFiles.insert(std::make_pair(filename,new std::stringstream));
return true;
/* First pass, we insert the file into a map, and just return true */
IncludedFiles.insert(std::make_pair(filename,new std::stringstream));
return true;
else
{
/* Second pass, look for the file in the map */
else
{
/* Second pass, look for the file in the map */
- ServerInstance->Log(DEBUG,"We are in the second pass, and %s is not in the map!", filename);
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"We are in the second pass, and %s is not in the map!", filename);
errorstream << "File " << filename << " could not be opened." << std::endl;
return false;
}
errorstream << "File " << filename << " could not be opened." << std::endl;
return false;
}
- ServerInstance->Log(DEBUG,"Start to read conf %s %08lx", filename, conf);
+ ServerInstance->Logs->Log("CONFIG",DEBUG,"Start to read conf %s %08lx", filename, conf);
/* Start reading characters... */
while (conf->get(ch))
/* Start reading characters... */
while (conf->get(ch))
{
if ((!allow_linefeeds) && (j->second.find('\n') != std::string::npos))
{
{
if ((!allow_linefeeds) && (j->second.find('\n') != std::string::npos))
{
- ServerInstance->Log(DEFAULT, "Value of <" + tag + ":" + var+ "> contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces.");
+ ServerInstance->Logs->Log("CONFIG",DEFAULT, "Value of <" + tag + ":" + var+ "> contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces.");
for (std::string::iterator n = j->second.begin(); n != j->second.end(); n++)
if (*n == '\n')
*n = ' ';
for (std::string::iterator n = j->second.begin(); n != j->second.end(); n++)
if (*n == '\n')
*n = ' ';
- ServerInstance->Log(DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick);
+ ServerInstance->Logs->Log("CULLLIST",DEBUG, "*** Warning *** - You tried to quit a user (%s) twice. Did your module call QuitUser twice?", user->nick);
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- ServerInstance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ ServerInstance->Logs->Log("CULLLIST",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
/** Send requests we have previously built down the UDP socket */
int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryType qt)
{
/** Send requests we have previously built down the UDP socket */
int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryType qt)
{
- ServerInstance->Log(DEBUG,"DNSRequest::SendRequests");
+ ServerInstance->Logs->Log("RESOLVER", DEBUG,"DNSRequest::SendRequests");
unsigned char payload[sizeof(DNSHeader)];
unsigned char payload[sizeof(DNSHeader)];
- ServerInstance->Log(DEBUG,"Sent OK");
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"Sent OK");
if ((strstr(ServerInstance->Config->DNSServer,"::ffff:") == (char*)&ServerInstance->Config->DNSServer) || (strstr(ServerInstance->Config->DNSServer,"::FFFF:") == (char*)&ServerInstance->Config->DNSServer))
{
if ((strstr(ServerInstance->Config->DNSServer,"::ffff:") == (char*)&ServerInstance->Config->DNSServer) || (strstr(ServerInstance->Config->DNSServer,"::FFFF:") == (char*)&ServerInstance->Config->DNSServer))
{
- ServerInstance->Log(DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled.");
- ServerInstance->Log(DEFAULT," This should not cause a problem, however it is recommended you migrate");
- ServerInstance->Log(DEFAULT," to a true IPv6 environment.");
+ ServerInstance->Logs->Log("RESOLVER",DEFAULT,"WARNING: Using IPv4 addresses over IPv6 forces some DNS checks to be disabled.");
+ ServerInstance->Logs->Log("RESOLVER",DEFAULT," This should not cause a problem, however it is recommended you migrate");
+ ServerInstance->Logs->Log("RESOLVER",DEFAULT," to a true IPv6 environment.");
if (!ServerInstance->BindSocket(this->GetFd(), portpass, "", false))
{
/* Failed to bind */
if (!ServerInstance->BindSocket(this->GetFd(), portpass, "", false))
{
/* Failed to bind */
- ServerInstance->Log(DEBUG,"Error binding dns socket");
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"Error binding dns socket");
ServerInstance->SE->Shutdown(this, 2);
ServerInstance->SE->Close(this);
this->SetFd(-1);
ServerInstance->SE->Shutdown(this, 2);
ServerInstance->SE->Close(this);
this->SetFd(-1);
{
if (!ServerInstance->SE->AddFd(this))
{
{
if (!ServerInstance->SE->AddFd(this))
{
- ServerInstance->Log(DEFAULT,"Internal error starting DNS - hostnames will NOT resolve.");
+ ServerInstance->Logs->Log("RESOLVER",DEFAULT,"Internal error starting DNS - hostnames will NOT resolve.");
ServerInstance->SE->Shutdown(this, 2);
ServerInstance->SE->Close(this);
this->SetFd(-1);
ServerInstance->SE->Shutdown(this, 2);
ServerInstance->SE->Close(this);
this->SetFd(-1);
- ServerInstance->Log(DEBUG,"Error creating dns socket");
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"Error creating dns socket");
}
}
/** Initialise the DNS UDP socket so that we can send requests */
DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
{
}
}
/** Initialise the DNS UDP socket so that we can send requests */
DNS::DNS(InspIRCd* Instance) : ServerInstance(Instance)
{
- ServerInstance->Log(DEBUG,"DNS::DNS");
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS::DNS");
/* Clear the Resolver class table */
memset(Classes,0,sizeof(Classes));
/* Clear the Resolver class table */
memset(Classes,0,sizeof(Classes));
/** High level abstraction of dns used by application at large */
Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, bool &cached, Module* creator) : ServerInstance(Instance), Creator(creator), input(source), querytype(qt)
{
/** High level abstraction of dns used by application at large */
Resolver::Resolver(InspIRCd* Instance, const std::string &source, QueryType qt, bool &cached, Module* creator) : ServerInstance(Instance), Creator(creator), input(source), querytype(qt)
{
- ServerInstance->Log(DEBUG,"Resolver::Resolver");
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"Resolver::Resolver");
cached = false;
CQ = ServerInstance->Res->GetCache(source);
cached = false;
CQ = ServerInstance->Res->GetCache(source);
- ServerInstance->Log(DEBUG,"DNS request id %d", this->myid);
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"DNS request id %d", this->myid);
int resultnum = 0;
DNSResult res(0,"",0,"");
res.id = 0;
int resultnum = 0;
DNSResult res(0,"",0,"");
res.id = 0;
- ServerInstance->Log(DEBUG,"Handle DNS event");
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"Handle DNS event");
res = this->GetResult(resultnum);
res = this->GetResult(resultnum);
- ServerInstance->Log(DEBUG,"Result %d id %d", resultnum, res.id);
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"Result %d id %d", resultnum, res.id);
/* Is there a usable request id? */
if (res.id != -1)
/* Is there a usable request id? */
if (res.id != -1)
/** Add a derived Resolver to the working set */
bool DNS::AddResolverClass(Resolver* r)
{
/** Add a derived Resolver to the working set */
bool DNS::AddResolverClass(Resolver* r)
{
- ServerInstance->Log(DEBUG,"AddResolverClass %08lx", r);
+ ServerInstance->Logs->Log("RESOLVER",DEBUG,"AddResolverClass %08lx", r);
/* Check the pointers validity and the id's validity */
if ((r) && (r->GetId() > -1))
{
/* Check the pointers validity and the id's validity */
if ((r) && (r->GetId() > -1))
{
if (geteuid() == 0)
{
printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n");
if (geteuid() == 0)
{
printf("WARNING!!! You are running an irc server as ROOT!!! DO NOT DO THIS!!!\n\n");
- this->Log(DEFAULT,"Cant start as root");
+ this->Logs->Log("STARTUP",DEFAULT,"Cant start as root");
Exit(EXIT_STATUS_ROOT);
}
}
Exit(EXIT_STATUS_ROOT);
}
}
if (*Config->DieValue)
{
printf("WARNING: %s\n\n",Config->DieValue);
if (*Config->DieValue)
{
printf("WARNING: %s\n\n",Config->DieValue);
- this->Log(DEFAULT,"Died because of <die> tag: %s",Config->DieValue);
+ this->Logs->Log("CONFIG",DEFAULT,"Died because of <die> tag: %s",Config->DieValue);
Exit(EXIT_STATUS_DIETAG);
}
}
Exit(EXIT_STATUS_DIETAG);
}
}
rlimit rl;
if (getrlimit(RLIMIT_CORE, &rl) == -1)
{
rlimit rl;
if (getrlimit(RLIMIT_CORE, &rl) == -1)
{
- this->Log(DEFAULT,"Failed to getrlimit()!");
+ this->Logs->Log("STARTUP",DEFAULT,"Failed to getrlimit()!");
return false;
}
else
{
rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_CORE, &rl) == -1)
return false;
}
else
{
rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_CORE, &rl) == -1)
- this->Log(DEFAULT,"setrlimit() failed, cannot increase coredump size.");
+ this->Logs->Log("STARTUP",DEFAULT,"setrlimit() failed, cannot increase coredump size.");
else
{
printf("Failed to write PID-file '%s', exiting.\n",fname.c_str());
else
{
printf("Failed to write PID-file '%s', exiting.\n",fname.c_str());
- this->Log(DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str());
+ this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str());
Exit(EXIT_STATUS_PID);
}
}
Exit(EXIT_STATUS_PID);
}
}
if (!ServerConfig::FileExists(this->ConfigFileName))
{
printf("ERROR: Cannot open config file: %s\nExiting...\n", this->ConfigFileName);
if (!ServerConfig::FileExists(this->ConfigFileName))
{
printf("ERROR: Cannot open config file: %s\nExiting...\n", this->ConfigFileName);
- this->Log(DEFAULT,"Unable to open config file %s", this->ConfigFileName);
+ this->Logs->Log("STARTUP",DEFAULT,"Unable to open config file %s", this->ConfigFileName);
Exit(EXIT_STATUS_CONFIG);
}
Exit(EXIT_STATUS_CONFIG);
}
{
for (std::map<BufferedSocket*,BufferedSocket*>::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x)
{
{
for (std::map<BufferedSocket*,BufferedSocket*>::iterator x = SocketCull.begin(); x != SocketCull.end(); ++x)
{
- Log(DEBUG,"Cull socket");
+ this->Logs->Log("MISC",DEBUG,"Cull socket");
SE->DelFd(x->second);
x->second->Close();
delete x->second;
SE->DelFd(x->second);
x->second->Close();
delete x->second;
- this->Instance->Log(DEBUG,"BUG: Hostname passed to BufferedSocket, rather than an IP address!");
+ this->Instance->Logs->Log("SOCKET", DEBUG,"BUG: Hostname passed to BufferedSocket, rather than an IP address!");
this->OnError(I_ERR_CONNECT);
this->Close();
this->fd = -1;
this->OnError(I_ERR_CONNECT);
this->Close();
this->fd = -1;
- Instance->Log(DEBUG,"nothing in the config to bind()!");
+ Instance->Logs->Log("SOCKET", DEBUG,"nothing in the config to bind()!");
this->SetQueues(this->fd);
}
this->SetQueues(this->fd);
}
- Instance->Log(DEBUG,"BufferedSocket::DoConnect success");
+ Instance->Logs->Log("SOCKET", DEBUG,"BufferedSocket::DoConnect success");
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ Instance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
}
}
Instance->SE->Shutdown(this, 2);
}
}
Instance->SE->Shutdown(this, 2);
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ Instance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ Instance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
void SocketTimeout::Tick(time_t)
{
void SocketTimeout::Tick(time_t)
{
- ServerInstance->Log(DEBUG,"SocketTimeout::Tick");
+ ServerInstance->Logs->Log("SOCKET", DEBUG,"SocketTimeout::Tick");
if (ServerInstance->SE->GetRef(this->sfd) != this->sock)
return;
if (ServerInstance->SE->GetRef(this->sfd) != this->sock)
return;
if (Instance->Config->GetIOHook(this))
{
if (Instance->Config->GetIOHook(this))
{
- Instance->Log(DEBUG,"Hook for raw connect");
+ Instance->Logs->Log("SOCKET",DEBUG,"Hook for raw connect");
try
{
Instance->Config->GetIOHook(this)->OnRawSocketConnect(this->fd);
}
catch (CoreException& modexcept)
{
try
{
Instance->Config->GetIOHook(this)->OnRawSocketConnect(this->fd);
}
catch (CoreException& modexcept)
{
- Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ Instance->Logs->Log("SOCKET",DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
}
}
return this->OnConnected();
}
}
return this->OnConnected();
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ Instance->Logs->Log("SOCKET",DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
void ModeHandler::ChangeCount(int modifier)
{
count += modifier;
void ModeHandler::ChangeCount(int modifier)
{
count += modifier;
- ServerInstance->Log(DEBUG,"Change count for mode %c is now %d", mode, count);
+ ServerInstance->Logs->Log("MODE", DEBUG,"Change count for mode %c is now %d", mode, count);
}
ModeType ModeHandler::GetModeType()
}
ModeType ModeHandler::GetModeType()
if (!SkipAccessChecks && IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW))
{
if (!SkipAccessChecks && IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW))
{
- ServerInstance->Log(DEBUG,"Enter minimum prefix check");
+ ServerInstance->Logs->Log("MODE", DEBUG,"Enter minimum prefix check");
/* Check access to this mode character */
if ((type == MODETYPE_CHANNEL) && (modehandlers[handler_id]->GetNeededPrefix()))
{
char needed = modehandlers[handler_id]->GetNeededPrefix();
ModeHandler* prefixmode = FindPrefix(needed);
/* Check access to this mode character */
if ((type == MODETYPE_CHANNEL) && (modehandlers[handler_id]->GetNeededPrefix()))
{
char needed = modehandlers[handler_id]->GetNeededPrefix();
ModeHandler* prefixmode = FindPrefix(needed);
- ServerInstance->Log(DEBUG,"Needed prefix: %c", needed);
+ ServerInstance->Logs->Log("MODE", DEBUG,"Needed prefix: %c", needed);
/* If the mode defined by the handler is not '\0', but the handler for it
* cannot be found, they probably dont have the right module loaded to implement
/* If the mode defined by the handler is not '\0', but the handler for it
* cannot be found, they probably dont have the right module loaded to implement
{
if ((!user) || (!chan))
{
{
if ((!user) || (!chan))
{
- ServerInstance->Log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter");
+ ServerInstance->Logs->Log("MODE",DEFAULT,"*** BUG *** AddBan was given an invalid parameter");
dest = "";
return dest;
}
dest = "";
return dest;
}
{
if ((!user) || (!chan))
{
{
if ((!user) || (!chan))
{
- ServerInstance->Log(DEFAULT,"*** BUG *** TakeBan was given an invalid parameter");
+ ServerInstance->Logs->Log("MODE",DEFAULT,"*** BUG *** TakeBan was given an invalid parameter");
dest = "";
return dest;
}
dest = "";
return dest;
}
if (!ServerConfig::DirValid(modfile))
{
LastModuleError = "Module " + filename_str + " is not within the modules directory.";
if (!ServerConfig::DirValid(modfile))
{
LastModuleError = "Module " + filename_str + " is not within the modules directory.";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
return false;
}
if (!ServerConfig::FileExists(modfile))
{
LastModuleError = "Module file could not be found: " + filename_str;
return false;
}
if (!ServerConfig::FileExists(modfile))
{
LastModuleError = "Module file could not be found: " + filename_str;
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
return false;
}
if (Modules.find(filename_str) != Modules.end())
{
LastModuleError = "Module " + filename_str + " is already loaded, cannot load a module twice!";
return false;
}
if (Modules.find(filename_str) != Modules.end())
{
LastModuleError = "Module " + filename_str + " is already loaded, cannot load a module twice!";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
delete newmod;
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")";
delete newmod;
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
- Instance->Log(DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
+ Instance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %d.%d.%d.%d)%s", filename, v.API, v.Major, v.Minor, v.Revision, v.Build, (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
}
Modules[filename_str] = std::make_pair(newhandle, newmod);
}
Modules[filename_str] = std::make_pair(newhandle, newmod);
{
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Probably missing init_module() entrypoint, but dlsym() didn't notice a problem";
{
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Probably missing init_module() entrypoint, but dlsym() didn't notice a problem";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
if (newhandle)
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Error when loading: " + modexcept.GetReason();
if (newhandle)
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Error when loading: " + modexcept.GetReason();
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
return false;
}
catch (FindSymbolException& modexcept)
return false;
}
catch (FindSymbolException& modexcept)
if (newhandle)
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Error finding symbol: " + modexcept.GetReason();
if (newhandle)
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Error finding symbol: " + modexcept.GetReason();
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
return false;
}
catch (CoreException& modexcept)
return false;
}
catch (CoreException& modexcept)
if (newhandle)
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason();
if (newhandle)
delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason();
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
if (modfind->second.second->GetVersion().Flags & VF_STATIC)
{
LastModuleError = "Module " + filename_str + " not unloadable (marked static)";
if (modfind->second.second->GetVersion().Flags & VF_STATIC)
{
LastModuleError = "Module " + filename_str + " not unloadable (marked static)";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
return false;
}
std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modfind->second.second);
if (intercount.first > 0)
{
LastModuleError = "Failed to unload module " + filename_str + ", being used by " + ConvToStr(intercount.first) + " other(s) via interface '" + intercount.second + "'";
return false;
}
std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modfind->second.second);
if (intercount.first > 0)
{
LastModuleError = "Failed to unload module " + filename_str + ", being used by " + ConvToStr(intercount.first) + " other(s) via interface '" + intercount.second + "'";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
delete modfind->second.first;
Modules.erase(modfind);
delete modfind->second.first;
Modules.erase(modfind);
- Instance->Log(DEFAULT,"Module %s unloaded",filename);
+ Instance->Logs->Log("MODULE", DEFAULT,"Module %s unloaded",filename);
this->ModCount--;
Instance->BuildISupport();
return true;
}
LastModuleError = "Module " + filename_str + " is not loaded, cannot unload it!";
this->ModCount--;
Instance->BuildISupport();
return true;
}
LastModuleError = "Module " + filename_str + " is not loaded, cannot unload it!";
- Instance->Log(DEFAULT, LastModuleError);
+ Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
if (!this->Load(configToken))
{
if (!this->Load(configToken))
{
- Instance->Log(DEFAULT, this->LastError());
+ Instance->Logs->Log("MODULE", DEFAULT, this->LastError());
printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str());
Instance->Exit(EXIT_STATUS_MODULE);
}
printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str());
Instance->Exit(EXIT_STATUS_MODULE);
}
- ServerInstance->Log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", freeform.c_str(), erroffset, error);
- ServerInstance->Log(DEFAULT,"Regular expression %s not loaded.", freeform.c_str());
+ ServerInstance->Logs->Log("m_filter_pcre", DEFAULT,"Error in regular expression: %s at offset %d: %s\n", freeform.c_str(), erroffset, error);
+ ServerInstance->Logs->Log("m_filter_pcre", DEFAULT,"Regular expression %s not loaded.", freeform.c_str());
return std::make_pair(false, "Error in regular expression at offset " + ConvToStr(erroffset) + ": "+error);
}
else
return std::make_pair(false, "Error in regular expression at offset " + ConvToStr(erroffset) + ": "+error);
}
else
- ServerInstance->Log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error);
- ServerInstance->Log(DEFAULT,"Regular expression %s not loaded.", pattern.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error);
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"Regular expression %s not loaded.", pattern.c_str());
}
else
{
filters.push_back(PCREFilter(re, reason, action, gline_time, pattern, flgs));
}
else
{
filters.push_back(PCREFilter(re, reason, action, gline_time, pattern, flgs));
- ServerInstance->Log(DEFAULT,"Regular expression %s loaded.", pattern.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEFAULT,"Regular expression %s loaded.", pattern.c_str());
}
}
FilterBase::OnRehash(user, parameter);
}
}
FilterBase::OnRehash(user, parameter);
{
/* XXX: MUTEX */
pthread_mutex_lock(&logging_mutex);
{
/* XXX: MUTEX */
pthread_mutex_lock(&logging_mutex);
- ServerInstance->Log(DEFAULT,"SQL: Failed to connect database "+i->second->GetHost()+": Error: "+i->second->GetError());
+ ServerInstance->Logs->Log("m_mysql",DEFAULT,"SQL: Failed to connect database "+i->second->GetHost()+": Error: "+i->second->GetError());
i->second->SetEnable(false);
pthread_mutex_unlock(&logging_mutex);
}
i->second->SetEnable(false);
pthread_mutex_unlock(&logging_mutex);
}
rc = pthread_join(Dispatcher, &status);
if (rc)
{
rc = pthread_join(Dispatcher, &status);
if (rc)
{
- ServerInstance->Log(DEFAULT,"SQL: Error code from pthread_join() is " + rc);
+ ServerInstance->Logs->Log("m_mysql",DEFAULT,"SQL: Error code from pthread_join() is " + rc);
}
throw ModuleException("m_mysql: Unable to publish feature 'SQL'");
}
}
throw ModuleException("m_mysql: Unable to publish feature 'SQL'");
}
rc = pthread_join(Dispatcher, &status);
if (rc)
{
rc = pthread_join(Dispatcher, &status);
if (rc)
{
- ServerInstance->Log(DEFAULT,"SQL: Error code from pthread_join() is " + rc);
+ ServerInstance->Logs->Log("m_mysql",DEFAULT,"SQL: Error code from pthread_join() is " + rc);
}
ClearAllConnections();
delete Conf;
}
ClearAllConnections();
delete Conf;
virtual void OnError(ResolverError e, const std::string &errormessage)
{
virtual void OnError(ResolverError e, const std::string &errormessage)
{
- ServerInstance->Log(DEBUG, "PgSQL: DNS lookup failed (%s), dying horribly", errormessage.c_str());
+ ServerInstance->Logs->Log("m_pgsql",DEBUG, "PgSQL: DNS lookup failed (%s), dying horribly", errormessage.c_str());
idle = this->Instance->Time();
if(!DoConnect())
{
idle = this->Instance->Time();
if(!DoConnect())
{
- Instance->Log(DEFAULT, "WARNING: Could not connect to database with id: " + ConvToStr(hi.id));
+ Instance->Logs->Log("m_pgsql",DEFAULT, "WARNING: Could not connect to database with id: " + ConvToStr(hi.id));
if (!this->Instance->SE->AddFd(this))
{
if (!this->Instance->SE->AddFd(this))
{
- Instance->Log(DEBUG, "BUG: Couldn't add pgsql socket to socket engine");
+ Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Couldn't add pgsql socket to socket engine");
- Instance->Log(DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do...");
+ Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Apparently PQescapeStringConn() failed somehow...don't know how or what to do...");
}
/* Incremenet queryend to the end of the newly escaped parameter */
}
/* Incremenet queryend to the end of the newly escaped parameter */
- Instance->Log(DEBUG, "BUG: Found a substitution location but no parameter to substitute :|");
+ Instance->Logs->Log("m_pgsql",DEBUG, "BUG: Found a substitution location but no parameter to substitute :|");
- Instance->Log(DEBUG, "BUG: PQsocket cant be removed from socket engine!");
+ Instance->Logs->Log("m_pgsql",DEBUG, "BUG: PQsocket cant be removed from socket engine!");
else
{
/* Invalid address family, die horribly. */
else
{
/* Invalid address family, die horribly. */
- ServerInstance->Log(DEBUG, "BUG: insp_aton failed returning -1, oh noes.");
+ ServerInstance->Logs->Log("m_pgsql",DEBUG, "BUG: insp_aton failed returning -1, oh noes.");
- ServerInstance->Log(DEFAULT, "WARNING: A pgsql connection with id: %s already exists, possibly due to DNS delay. Aborting connection attempt.", hi.id.c_str());
+ ServerInstance->Logs->Log("m_pgsql",DEFAULT, "WARNING: A pgsql connection with id: %s already exists, possibly due to DNS delay. Aborting connection attempt.", hi.id.c_str());
{
std::string compare = std::string(u->nick) + "!" + u->ident + "@" + u->host + " " + u->fullname;
{
std::string compare = std::string(u->nick) + "!" + u->ident + "@" + u->host + " " + u->fullname;
- ServerInstance->Log(DEBUG, "Matching " + matchtext + " against string " + compare);
+ ServerInstance->Logs->Log("m_rline",DEBUG, "Matching " + matchtext + " against string " + compare);
if (pcre_exec(regex, NULL, compare.c_str(), compare.length(), 0, 0, NULL, 0) > -1)
{
if (pcre_exec(regex, NULL, compare.c_str(), compare.length(), 0, 0, NULL, 0) > -1)
{
{
if (OpenDB() != SQLITE_OK)
{
{
if (OpenDB() != SQLITE_OK)
{
- Instance->Log(DEFAULT, "WARNING: Could not open DB with id: " + host.id);
+ Instance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: Could not open DB with id: " + host.id);
- ServerInstance->Log(DEFAULT, "WARNING: A sqlite connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str());
+ ServerInstance->Logs->Log("m_sqlite3",DEFAULT, "WARNING: A sqlite connection with id: %s already exists. Aborting database open attempt.", hi.id.c_str());
- ServerInstance->Log(SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be able to oper up unless their o:line is statically configured");
+ ServerInstance->Logs->Log("m_sqloper",SPARSE, "WARNING: Couldn't find SQL provider module. NOBODY will be able to oper up unless their o:line is statically configured");
- ServerInstance->Log(DEBUG, "BUG: WHAT?! Why do we have no OPER command?!");
+ ServerInstance->Logs->Log("m_sqloper",DEBUG, "BUG: WHAT?! Why do we have no OPER command?!");
{
if(iter->second != user)
{
{
if(iter->second != user)
{
- ServerInstance->Log(DEBUG, "BUG: ID associated with user %s doesn't have the same User* associated with it in the map (erasing anyway)", user->nick);
+ ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with user %s doesn't have the same User* associated with it in the map (erasing anyway)", user->nick);
}
iduser.erase(iter);
}
else
{
}
iduser.erase(iter);
}
else
{
- ServerInstance->Log(DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick);
+ ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: user %s was extended with sqlutils_queryids but there was nothing matching in the map", user->nick);
{
if(iter->second != chan)
{
{
if(iter->second != chan)
{
- ServerInstance->Log(DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name);
+ ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: ID associated with channel %s doesn't have the same Channel* associated with it in the map (erasing anyway)", chan->name);
}
idchan.erase(iter);
}
else
{
}
idchan.erase(iter);
}
else
{
- ServerInstance->Log(DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name);
+ ServerInstance->Logs->Log("m_sqlutils",DEBUG, "BUG: channel %s was extended with sqlutils_queryids but there was nothing matching in the map", chan->name);
gnutls_global_init(); // This must be called once in the program
if(gnutls_certificate_allocate_credentials(&x509_cred) != 0)
gnutls_global_init(); // This must be called once in the program
if(gnutls_certificate_allocate_credentials(&x509_cred) != 0)
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials");
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials");
// Guessing return meaning
if(gnutls_dh_params_init(&dh_params) < 0)
// Guessing return meaning
if(gnutls_dh_params_init(&dh_params) < 0)
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters");
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters");
// Needs the flag as it ignores a plain /rehash
OnRehash(NULL,"ssl");
// Needs the flag as it ignores a plain /rehash
OnRehash(NULL,"ssl");
for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
if (ServerInstance->Config->ports[i]->GetPort() == portno)
ServerInstance->Config->ports[i]->SetDescription("ssl");
for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
if (ServerInstance->Config->ports[i]->GetPort() == portno)
ServerInstance->Config->ports[i]->SetDescription("ssl");
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno);
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", portno);
sslports.append("*:").append(ConvToStr(portno)).append(";");
}
else
{
sslports.append("*:").append(ConvToStr(portno)).append(";");
}
else
{
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
}
}
catch (ModuleException &e)
{
}
}
catch (ModuleException &e)
{
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have an other SSL or similar module loaded?", portno, e.GetReason());
int ret;
if((ret =gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
int ret;
if((ret =gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret));
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret));
if((ret = gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
if((ret = gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret));
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret));
if((ret = gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
{
if((ret = gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
{
int ret;
if((ret = gnutls_dh_params_generate2(dh_params, dh_bits)) < 0)
int ret;
if((ret = gnutls_dh_params_generate2(dh_params, dh_bits)) < 0)
- ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret));
+ ServerInstance->Logs->Log("m_ssl_gnutls",DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret));
}
virtual ~ModuleSSLGnuTLS()
}
virtual ~ModuleSSLGnuTLS()
for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
if (ServerInstance->Config->ports[i]->GetPort() == portno)
ServerInstance->Config->ports[i]->SetDescription("ssl");
for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++)
if (ServerInstance->Config->ports[i]->GetPort() == portno)
ServerInstance->Config->ports[i]->SetDescription("ssl");
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno);
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Enabling SSL for port %d", portno);
sslports.append("*:").append(ConvToStr(portno)).append(";");
}
else
{
sslports.append("*:").append(ConvToStr(portno)).append(";");
}
else
{
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", portno);
}
}
catch (ModuleException &e)
{
}
}
catch (ModuleException &e)
{
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another SSL or similar module loaded?", portno, e.GetReason());
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: FAILED to enable SSL on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another SSL or similar module loaded?", portno, e.GetReason());
*/
if ((!SSL_CTX_use_certificate_chain_file(ctx, certfile.c_str())) || (!SSL_CTX_use_certificate_chain_file(clictx, certfile.c_str())))
{
*/
if ((!SSL_CTX_use_certificate_chain_file(ctx, certfile.c_str())) || (!SSL_CTX_use_certificate_chain_file(clictx, certfile.c_str())))
{
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s. %s", certfile.c_str(), strerror(errno));
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read certificate file %s. %s", certfile.c_str(), strerror(errno));
ERR_print_errors_cb(error_callback, this);
}
if (((!SSL_CTX_use_PrivateKey_file(ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) || (!SSL_CTX_use_PrivateKey_file(clictx, keyfile.c_str(), SSL_FILETYPE_PEM)))
{
ERR_print_errors_cb(error_callback, this);
}
if (((!SSL_CTX_use_PrivateKey_file(ctx, keyfile.c_str(), SSL_FILETYPE_PEM))) || (!SSL_CTX_use_PrivateKey_file(clictx, keyfile.c_str(), SSL_FILETYPE_PEM)))
{
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read key file %s. %s", keyfile.c_str(), strerror(errno));
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read key file %s. %s", keyfile.c_str(), strerror(errno));
ERR_print_errors_cb(error_callback, this);
}
/* Load the CAs we trust*/
if (((!SSL_CTX_load_verify_locations(ctx, cafile.c_str(), 0))) || (!SSL_CTX_load_verify_locations(clictx, cafile.c_str(), 0)))
{
ERR_print_errors_cb(error_callback, this);
}
/* Load the CAs we trust*/
if (((!SSL_CTX_load_verify_locations(ctx, cafile.c_str(), 0))) || (!SSL_CTX_load_verify_locations(clictx, cafile.c_str(), 0)))
{
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Can't read CA list from %s. %s", cafile.c_str(), strerror(errno));
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Can't read CA list from %s. %s", cafile.c_str(), strerror(errno));
ERR_print_errors_cb(error_callback, this);
}
ERR_print_errors_cb(error_callback, this);
}
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno));
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so Couldn't open DH file %s: %s", dhfile.c_str(), strerror(errno));
throw ModuleException("Couldn't open DH file " + dhfile + ": " + strerror(errno));
}
else
throw ModuleException("Couldn't open DH file " + dhfile + ": " + strerror(errno));
}
else
ret = PEM_read_DHparams(dhpfile, NULL, NULL, NULL);
if ((SSL_CTX_set_tmp_dh(ctx, ret) < 0) || (SSL_CTX_set_tmp_dh(clictx, ret) < 0))
{
ret = PEM_read_DHparams(dhpfile, NULL, NULL, NULL);
if ((SSL_CTX_set_tmp_dh(ctx, ret) < 0) || (SSL_CTX_set_tmp_dh(clictx, ret) < 0))
{
- ServerInstance->Log(DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str());
+ ServerInstance->Logs->Log("m_ssl_openssl",DEFAULT, "m_ssl_openssl.so: Couldn't set DH parameters %s. SSL errors follow:", dhfile.c_str());
ERR_print_errors_cb(error_callback, this);
}
}
ERR_print_errors_cb(error_callback, this);
}
}
if (SSL_set_fd(session->sess, fd) == 0)
{
if (SSL_set_fd(session->sess, fd) == 0)
{
- ServerInstance->Log(DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd);
+ ServerInstance->Logs->Log("m_ssl_openssl",DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd);
if (SSL_set_fd(session->sess, fd) == 0)
{
if (SSL_set_fd(session->sess, fd) == 0)
{
- ServerInstance->Log(DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd);
+ ServerInstance->Logs->Log("m_ssl_openssl",DEBUG,"BUG: Can't set fd with SSL_set_fd: %d", fd);
static int error_callback(const char *str, size_t len, void *u)
{
ModuleSSLOpenSSL* mssl = (ModuleSSLOpenSSL*)u;
static int error_callback(const char *str, size_t len, void *u)
{
ModuleSSLOpenSSL* mssl = (ModuleSSLOpenSSL*)u;
- mssl->PublicInstance->Log(DEFAULT, "SSL error: " + std::string(str, len - 1));
+ mssl->PublicInstance->Logs->Log("m_ssl_openssl",DEFAULT, "SSL error: " + std::string(str, len - 1));
{
user->WriteServ("491 %s :This oper login name requires a matching key fingerprint.",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"'%s' cannot oper, does not match fingerprint", user->nick);
{
user->WriteServ("491 %s :This oper login name requires a matching key fingerprint.",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"'%s' cannot oper, does not match fingerprint", user->nick);
- ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.",user->nick,user->ident,user->host);
+ ServerInstance->Logs->Log("m_ssl_oper_cert",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.",user->nick,user->ident,user->host);
capsmap[(unsigned char)*n] = 1;
if (percent < 1 || percent > 100)
{
capsmap[(unsigned char)*n] = 1;
if (percent < 1 || percent > 100)
{
- ServerInstance->Log(DEFAULT, "<blockcaps:percent> out of range, setting to default of 100.");
+ ServerInstance->Logs->Log("CONFIG",DEFAULT, "<blockcaps:percent> out of range, setting to default of 100.");
percent = 100;
}
if (minlen < 1 || minlen > MAXBUF-1)
{
percent = 100;
}
if (minlen < 1 || minlen > MAXBUF-1)
{
- ServerInstance->Log(DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1.");
+ ServerInstance->Logs->Log("CONFIG",DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1.");
if(hostmask.length())
{
if (type == "webirc" && !password.length()) {
if(hostmask.length())
{
if (type == "webirc" && !password.length()) {
- ServerInstance->Log(DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str());
- ServerInstance->Log(DEFAULT, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str());
+ ServerInstance->Logs->Log("CONFIG",DEFAULT, "m_cgiirc.so: Invalid <cgihost:mask> value in config: %s", hostmask.c_str());
- ServerInstance->Log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their message filtered, target was ")+target+": "+f->reason+" Action: "+f->action);
+ ServerInstance->Logs->Log("FILTER",DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their message filtered, target was ")+target+": "+f->reason+" Action: "+f->action);
// method called when a user connects
std::string b = user->nick;
// method called when a user connects
std::string b = user->nick;
- ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b);
+ ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User connecting: "+b);
}
virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
}
virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
// method called when a user disconnects
std::string b = user->nick;
// method called when a user disconnects
std::string b = user->nick;
- ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
+ ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User quitting: "+b);
}
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
}
virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
std::string c = channel->name;
std::string b = user->nick;
std::string c = channel->name;
std::string b = user->nick;
- ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
+ ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User "+b+" joined "+c);
}
virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent)
}
virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent)
std::string c = channel->name;
std::string b = user->nick;
std::string c = channel->name;
std::string b = user->nick;
- ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c);
+ ServerInstance->Logs->Log("m_foobar",DEBUG,"Foobar: User "+b+" parted "+c);
public:
HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const std::string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s)
{
public:
HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const std::string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s)
{
- ServerInstance->Log(DEBUG,">>>>>>>>>>>>>>>>>> HTTPResolver::HTTPResolver <<<<<<<<<<<<<<<");
+ ServerInstance->Logs->Log("m_http_client",DEBUG,">>>>>>>>>>>>>>>>>> HTTPResolver::HTTPResolver <<<<<<<<<<<<<<<");
orig = hostname;
}
void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
orig = hostname;
}
void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
- ServerInstance->Log(DEBUG,"************* HTTPResolver::OnLookupComplete ***************");
+ ServerInstance->Logs->Log("m_http_client",DEBUG,"************* HTTPResolver::OnLookupComplete ***************");
if (!resultnum)
socket->Connect(result);
else
if (!resultnum)
socket->Connect(result);
else
void OnError(ResolverError e, const std::string &errmsg)
{
void OnError(ResolverError e, const std::string &errmsg)
{
- ServerInstance->Log(DEBUG,"!!!!!!!!!!!!!!!! HTTPResolver::OnError: %s", errmsg.c_str());
+ ServerInstance->Logs->Log("m_http_client",DEBUG,"!!!!!!!!!!!!!!!! HTTPResolver::OnError: %s", errmsg.c_str());
HTTPSocket::HTTPSocket(InspIRCd *SI, ModuleHTTPClient *m)
: BufferedSocket(SI), Server(SI), Mod(m), status(HTTP_CLOSED)
{
HTTPSocket::HTTPSocket(InspIRCd *SI, ModuleHTTPClient *m)
: BufferedSocket(SI), Server(SI), Mod(m), status(HTTP_CLOSED)
{
- Instance->Log(DEBUG,"HTTPSocket::HTTPSocket");
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::HTTPSocket");
this->port = 80;
response = NULL;
closed = false;
this->port = 80;
response = NULL;
closed = false;
bool HTTPSocket::DoRequest(HTTPClientRequest *request)
{
bool HTTPSocket::DoRequest(HTTPClientRequest *request)
{
- Instance->Log(DEBUG,"HTTPSocket::DoRequest");
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::DoRequest");
/* Tweak by brain - we take a copy of this,
* so that the caller doesnt need to leave
* pointers knocking around, less chance of
/* Tweak by brain - we take a copy of this,
* so that the caller doesnt need to leave
* pointers knocking around, less chance of
this->port = url.port;
strlcpy(this->host, url.domain.c_str(), MAXBUF);
this->port = url.port;
strlcpy(this->host, url.domain.c_str(), MAXBUF);
- Instance->Log(DEBUG,"Doing request for %s", url.url.c_str());
+ Instance->Logs->Log("m_http_client",DEBUG,"Doing request for %s", url.url.c_str());
bool cached;
HTTPResolver* r = new HTTPResolver(this, Server, url.domain, cached, (Module*)Mod);
Instance->AddResolver(r, cached);
bool cached;
HTTPResolver* r = new HTTPResolver(this, Server, url.domain, cached, (Module*)Mod);
Instance->AddResolver(r, cached);
- Instance->Log(DEBUG,"Resolver added, cached=%d", cached);
+ Instance->Logs->Log("m_http_client",DEBUG,"Resolver added, cached=%d", cached);
}
else
Connect(url.domain);
}
else
Connect(url.domain);
bool HTTPSocket::ParseURL(const std::string &iurl)
{
bool HTTPSocket::ParseURL(const std::string &iurl)
{
- Instance->Log(DEBUG,"HTTPSocket::ParseURL %s", iurl.c_str());
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::ParseURL %s", iurl.c_str());
url.url = iurl;
url.port = 80;
url.protocol = "http";
url.url = iurl;
url.port = 80;
url.protocol = "http";
if ((url.domain.empty()) || (!url.port) || (url.protocol.empty()))
{
if ((url.domain.empty()) || (!url.port) || (url.protocol.empty()))
{
- Instance->Log(DEFAULT, "Invalid URL (%s): Missing required value", iurl.c_str());
+ Instance->Logs->Log("m_http_client",DEFAULT, "Invalid URL (%s): Missing required value", iurl.c_str());
return false;
}
if (url.protocol != "http")
{
return false;
}
if (url.protocol != "http")
{
- Instance->Log(DEFAULT, "Invalid URL (%s): Unsupported protocol '%s'", iurl.c_str(), url.protocol.c_str());
+ Instance->Logs->Log("m_http_client",DEFAULT, "Invalid URL (%s): Unsupported protocol '%s'", iurl.c_str(), url.protocol.c_str());
{
this->response = new HTTPClientResponse((Module*)Mod, req.GetSource() , url.url, 0, "");
{
this->response = new HTTPClientResponse((Module*)Mod, req.GetSource() , url.url, 0, "");
- Instance->Log(DEBUG,"HTTPSocket::Connect(%s) response=%08lx", ip.c_str(), response);
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::Connect(%s) response=%08lx", ip.c_str(), response);
strlcpy(this->IP, ip.c_str(), MAXBUF);
strlcpy(this->host, ip.c_str(), MAXBUF);
if (!this->DoConnect())
{
strlcpy(this->IP, ip.c_str(), MAXBUF);
strlcpy(this->host, ip.c_str(), MAXBUF);
if (!this->DoConnect())
{
- Instance->Log(DEBUG,"DoConnect failed, bailing");
+ Instance->Logs->Log("m_http_client",DEBUG,"DoConnect failed, bailing");
this->Close();
}
}
bool HTTPSocket::OnConnected()
{
this->Close();
}
}
bool HTTPSocket::OnConnected()
{
- Instance->Log(DEBUG,"HTTPSocket::OnConnected");
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnConnected");
std::string request = "GET " + url.request + " HTTP/1.1\r\n";
std::string request = "GET " + url.request + " HTTP/1.1\r\n";
bool HTTPSocket::OnDataReady()
{
bool HTTPSocket::OnDataReady()
{
- Instance->Log(DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str());
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str());
const char *sdata = this->Read();
if (!sdata)
const char *sdata = this->Read();
if (!sdata)
if (!closed)
{
closed = true;
if (!closed)
{
closed = true;
- Instance->Log(DEBUG,"HTTPSocket::OnClose response=%08lx", response);
+ Instance->Logs->Log("m_http_client",DEBUG,"HTTPSocket::OnClose response=%08lx", response);
std::string e;
if (data.empty())
{
std::string e;
if (data.empty())
{
- Instance->Log(DEBUG,"Send error");
+ Instance->Logs->Log("m_http_client",DEBUG,"Send error");
HTTPClientError* err = new HTTPClientError((Module*)Mod, req.GetSource(), req.GetURL(), 0);
err->Send();
delete err;
return;
}
HTTPClientError* err = new HTTPClientError((Module*)Mod, req.GetSource(), req.GetURL(), 0);
err->Send();
delete err;
return;
}
- Instance->Log(DEBUG,"Set data and send, %s", response->GetURL().c_str());
+ Instance->Logs->Log("m_http_client",DEBUG,"Set data and send, %s", response->GetURL().c_str());
response->SetData(data);
response->Send();
delete response;
response->SetData(data);
response->Send();
delete response;
if (reqbuffer.length() >= 8192)
{
if (reqbuffer.length() >= 8192)
{
- Instance->Log(DEBUG, "m_httpd dropped connection due to an oversized request buffer");
+ Instance->Logs->Log("m_httpd",DEBUG, "m_httpd dropped connection due to an oversized request buffer");
reqbuffer.clear();
return false;
}
reqbuffer.clear();
return false;
}
virtual void OnConnected()
{
virtual void OnConnected()
{
- ServerInstance->Log(DEBUG,"OnConnected()");
+ ServerInstance->Logs->Log("m_ident",DEBUG,"OnConnected()");
/* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the
* only members we use are in a part of the struct that should always be identical (at the
/* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the
* only members we use are in a part of the struct that should always be identical (at the
break;
case EVENT_ERROR:
/* fd error event, ohshi- */
break;
case EVENT_ERROR:
/* fd error event, ohshi- */
- ServerInstance->Log(DEBUG,"EVENT_ERROR");
+ ServerInstance->Logs->Log("m_ident",DEBUG,"EVENT_ERROR");
/* We *must* Close() here immediately or we get a
* huge storm of EVENT_ERROR events!
*/
/* We *must* Close() here immediately or we get a
* huge storm of EVENT_ERROR events!
*/
- ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd());
+ ServerInstance->Logs->Log("m_ident",DEBUG,"Close ident socket %d", GetFd());
ServerInstance->SE->DelFd(this);
ServerInstance->SE->Close(GetFd());
ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
ServerInstance->SE->DelFd(this);
ServerInstance->SE->Close(GetFd());
ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
- ServerInstance->Log(DEBUG,"ReadResponse()");
+ ServerInstance->Logs->Log("m_ident",DEBUG,"ReadResponse()");
irc::sepstream sep(ibuf, ':');
std::string token;
irc::sepstream sep(ibuf, ':');
std::string token;
}
catch (ModuleException &e)
{
}
catch (ModuleException &e)
{
- ServerInstance->Log(DEBUG,"Ident exception: %s", e.GetReason());
+ ServerInstance->Logs->Log("m_ident",DEBUG,"Ident exception: %s", e.GetReason());
*/
virtual bool OnCheckReady(User *user)
{
*/
virtual bool OnCheckReady(User *user)
{
- ServerInstance->Log(DEBUG,"OnCheckReady %s", user->nick);
+ ServerInstance->Logs->Log("m_ident",DEBUG,"OnCheckReady %s", user->nick);
/* Does user have an ident socket attached at all? */
IdentRequestSocket *isock = NULL;
if (!user->GetExt("ident_socket", isock))
{
/* Does user have an ident socket attached at all? */
IdentRequestSocket *isock = NULL;
if (!user->GetExt("ident_socket", isock))
{
- ServerInstance->Log(DEBUG, "No ident socket :(");
+ ServerInstance->Logs->Log("m_ident",DEBUG, "No ident socket :(");
- ServerInstance->Log(DEBUG, "Has ident_socket");
+ ServerInstance->Logs->Log("m_ident",DEBUG, "Has ident_socket");
time_t compare = isock->age;
compare += RequestTimeout;
time_t compare = isock->age;
compare += RequestTimeout;
{
/* Ident timeout */
user->WriteServ("NOTICE Auth :*** Ident request timed out.");
{
/* Ident timeout */
user->WriteServ("NOTICE Auth :*** Ident request timed out.");
- ServerInstance->Log(DEBUG, "Timeout");
+ ServerInstance->Logs->Log("m_ident",DEBUG, "Timeout");
/* The user isnt actually disconnecting,
* we call this to clean up the user
*/
/* The user isnt actually disconnecting,
* we call this to clean up the user
*/
/* Got a result yet? */
if (!isock->HasResult())
{
/* Got a result yet? */
if (!isock->HasResult())
{
- ServerInstance->Log(DEBUG, "No result yet");
+ ServerInstance->Logs->Log("m_ident",DEBUG, "No result yet");
- ServerInstance->Log(DEBUG, "Yay, result!");
+ ServerInstance->Logs->Log("m_ident",DEBUG, "Yay, result!");
/* wooo, got a result (it will be good, or bad) */
if (*(isock->GetResult()) != '~')
/* wooo, got a result (it will be good, or bad) */
if (*(isock->GetResult()) != '~')
isock->Close();
delete isock;
user->Shrink("ident_socket");
isock->Close();
delete isock;
user->Shrink("ident_socket");
- ServerInstance->Log(DEBUG, "Removed ident socket from %s", user->nick);
+ ServerInstance->Logs->Log("m_ident",DEBUG, "Removed ident socket from %s", user->nick);
for (int j = 0; j < pcnt; j++)
plist.append(std::string(" ")+std::string(parameters[j]));
for (int j = 0; j < pcnt; j++)
plist.append(std::string(" ")+std::string(parameters[j]));
- ServerInstance->Log(DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
+ ServerInstance->Logs->Log("m_operlog",DEFAULT,"OPERLOG: [%s!%s@%s] %s%s",user->nick,user->ident,user->host,command.c_str(),plist.c_str());
{
if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest"))
{
{
if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest"))
{
- ServerInstance->Log(DEBUG, "Post-load registering hasher: %s", name.c_str());
+ ServerInstance->Logs->Log("m_password-hash",DEBUG, "Post-load registering hasher: %s", name.c_str());
std::string sname = HashNameRequest(this, mod).Send();
hashers[sname.c_str()] = mod;
names.push_back(sname);
std::string sname = HashNameRequest(this, mod).Send();
hashers[sname.c_str()] = mod;
names.push_back(sname);
virtual void OnConnected()
{
virtual void OnConnected()
{
- ServerInstance->Log(DEBUG,"OnConnected()");
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG,"OnConnected()");
/* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the
* only members we use are in a part of the struct that should always be identical (at the
/* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the
* only members we use are in a part of the struct that should always be identical (at the
/* Send failed if we didnt write the whole ident request --
* might as well give up if this happens!
*/
/* Send failed if we didnt write the whole ident request --
* might as well give up if this happens!
*/
- ServerInstance->Log(DEBUG, "Sending");
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Sending");
if (ServerInstance->SE->Send(this, this->challenge, this->clen, 0) < this->clen)
{
if (ServerInstance->SE->Send(this, this->challenge, this->clen, 0) < this->clen)
{
- ServerInstance->Log(DEBUG, "Send incomplete");
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Send incomplete");
break;
case EVENT_ERROR:
/* fd error event, ohshi- */
break;
case EVENT_ERROR:
/* fd error event, ohshi- */
- ServerInstance->Log(DEBUG,"EVENT_ERROR");
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG,"EVENT_ERROR");
/* We *must* Close() here immediately or we get a
* huge storm of EVENT_ERROR events!
*/
/* We *must* Close() here immediately or we get a
* huge storm of EVENT_ERROR events!
*/
- ServerInstance->Log(DEBUG,"Close ident socket %d", GetFd());
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG,"Close ident socket %d", GetFd());
ServerInstance->SE->DelFd(this);
ServerInstance->SE->Close(GetFd());
ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
ServerInstance->SE->DelFd(this);
ServerInstance->SE->Close(GetFd());
ServerInstance->SE->Shutdown(GetFd(), SHUT_WR);
char ibuf[MAXBUF];
int recvresult = ServerInstance->SE->Recv(this, ibuf, MAXBUF-1, 0);
char ibuf[MAXBUF];
int recvresult = ServerInstance->SE->Recv(this, ibuf, MAXBUF-1, 0);
- ServerInstance->Log(DEBUG,"ReadResponse(): %s -- %d", ibuf, recvresult);
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG,"ReadResponse(): %s -- %d", ibuf, recvresult);
bool match = true;
int i;
bool match = true;
int i;
{
if (this->response[i] != ibuf[i])
{
{
if (this->response[i] != ibuf[i])
{
- ServerInstance->Log(DEBUG, "No match at pos %d: %c ne %c", i, this->response[i], ibuf[i]);
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG, "No match at pos %d: %c ne %c", i, this->response[i], ibuf[i]);
/* no match */
match = false;
}
/* no match */
match = false;
}
}
catch (ModuleException &e)
{
}
catch (ModuleException &e)
{
- ServerInstance->Log(DEBUG,"Proxy exception: %s", e.GetReason());
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG,"Proxy exception: %s", e.GetReason());
p->Close();
delete p;
user->Shrink("proxy_socket");
p->Close();
delete p;
user->Shrink("proxy_socket");
- ServerInstance->Log(DEBUG, "Removed proxy socket from %s", user->nick);
+ ServerInstance->Logs->Log("m_proxyscan",DEBUG, "Removed proxy socket from %s", user->nick);
if (i != quits.end())
{
i->second++;
if (i != quits.end())
{
i->second++;
- ServerInstance->Log(DEBUG, "quitban: Count for IP is now %d", i->second);
+ ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Count for IP is now %d", i->second);
if (i->second >= threshold)
{
if (i->second >= threshold)
{
else
{
quits[u->GetIPString()] = 1;
else
{
quits[u->GetIPString()] = 1;
- ServerInstance->Log(DEBUG, "quitban: Added new record");
+ ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Added new record");
}
}
virtual void OnGarbageCollect()
{
}
}
virtual void OnGarbageCollect()
{
- ServerInstance->Log(DEBUG, "quitban: Clearing map.");
+ ServerInstance->Logs->Log("m_quitban",DEBUG, "quitban: Clearing map.");
return 0;
#else
std::stringstream* gotfile = (std::stringstream*)filedata;
return 0;
#else
std::stringstream* gotfile = (std::stringstream*)filedata;
- ServerInstance->Log(DEBUG,"OnDownloadFile in m_remoteinclude_http");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"OnDownloadFile in m_remoteinclude_http");
int sockfd, portno, n;
struct sockaddr_in serv_addr;
struct hostent *server;
int sockfd, portno, n;
struct sockaddr_in serv_addr;
struct hostent *server;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
{
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
{
- ServerInstance->Log(DEBUG,"Failed to socket()");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Failed to socket()");
return 0;
}
if (server == NULL)
{
return 0;
}
if (server == NULL)
{
- ServerInstance->Log(DEBUG,"No such host");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"No such host");
if (connect(sockfd, (const sockaddr*)&serv_addr, sizeof(serv_addr)) < 0)
{
if (connect(sockfd, (const sockaddr*)&serv_addr, sizeof(serv_addr)) < 0)
{
- ServerInstance->Log(DEBUG,"Failed to connect()");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Failed to connect()");
- ServerInstance->Log(DEBUG,"Connected to brainbox");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Connected to brainbox");
n = this->SockSend(sockfd, "GET / HTTP/1.1\r\nConnection: close\r\nHost: neuron.brainbox.winbot.co.uk\r\n\r\n");
if (n < 0)
{
n = this->SockSend(sockfd, "GET / HTTP/1.1\r\nConnection: close\r\nHost: neuron.brainbox.winbot.co.uk\r\n\r\n");
if (n < 0)
{
- ServerInstance->Log(DEBUG,"Failed to send()");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Failed to send()");
- ServerInstance->Log(DEBUG,"Sent GET request");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Sent GET request");
while (((n = read(sockfd,buffer,65535)) > 0))
{
while (((n = read(sockfd,buffer,65535)) > 0))
{
(*(gotfile)) << output;
}
(*(gotfile)) << output;
}
- ServerInstance->Log(DEBUG,"Read page");
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Read page");
std::string version, result;
(*(gotfile)) >> version;
std::string version, result;
(*(gotfile)) >> version;
- ServerInstance->Log(DEBUG,"Result: %s", result.c_str());
+ ServerInstance->Logs->Log("m_remoteinclude_http",DEBUG,"Result: %s", result.c_str());
return (result == "200");
#endif
return (result == "200");
#endif
if (*parameters[0] == '<')
{
maxusers = atoi(parameters[0]+1);
if (*parameters[0] == '<')
{
maxusers = atoi(parameters[0]+1);
- ServerInstance->Log(DEBUG,"Max users: %d", maxusers);
+ ServerInstance->Logs->Log("m_safelist",DEBUG,"Max users: %d", maxusers);
pcnt = 0;
}
else if (*parameters[0] == '>')
{
minusers = atoi(parameters[0]+1);
pcnt = 0;
}
else if (*parameters[0] == '>')
{
minusers = atoi(parameters[0]+1);
- ServerInstance->Log(DEBUG,"Min users: %d", minusers);
+ ServerInstance->Logs->Log("m_safelist",DEBUG,"Min users: %d", minusers);
- ServerInstance->Log(DEBUG, "SAPART: pcnt is %d", pcnt);
+ ServerInstance->Logs->Log("m_sapart",DEBUG, "SAPART: pcnt is %d", pcnt);
if (pcnt == 3)
reason = parameters[2];
else
if (pcnt == 3)
reason = parameters[2];
else
- Instance->Log(DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
+ Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FJOIN. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", source.c_str());
return true;
}
Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FJOIN with a TS of zero. Total craq. Command was dropped.", source.c_str());
return true;
}
- Instance->Log(SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str());
+ Instance->Logs->Log("m_spanningtree",SPARSE,"Warning! Invalid user %s in FJOIN to channel %s IGNORED", usr, channel.c_str());
- Instance->Log(DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
+ Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG? *** TS of 0 sent to FMODE. Are some services authors smoking craq, or is it 1970 again?. Dropped.");
Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq. Mode was dropped.", sourceserv.c_str());
return true;
}
Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending FMODE with a TS of zero. Total craq. Mode was dropped.", sourceserv.c_str());
return true;
}
if (TS <= ourTS)
{
if ((TS < ourTS) && (!dst))
if (TS <= ourTS)
{
if ((TS < ourTS) && (!dst))
- Instance->Log(DEFAULT,"*** BUG *** Channel TS sent in FMODE to %s is %lu which is not equal to %lu!", params[0].c_str(), TS, ourTS);
+ Instance->Logs->Log("m_spanningtree",DEFAULT,"*** BUG *** Channel TS sent in FMODE to %s is %lu which is not equal to %lu!", params[0].c_str(), TS, ourTS);
return "HMAC-SHA256:"+ hmac;
}
else if (!challenge.empty() && !sha256)
return "HMAC-SHA256:"+ hmac;
}
else if (!challenge.empty() && !sha256)
- Instance->Log(DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!");
+ Instance->Logs->Log("m_spanningtree",DEFAULT,"Not authenticating to server using SHA256/HMAC because we don't have m_sha256 loaded!");
std::deque<std::string> list;
std::string n = this->Instance->Config->GetSID();
const char* sn = n.c_str();
std::deque<std::string> list;
std::string n = this->Instance->Config->GetSID();
const char* sn = n.c_str();
- Instance->Log(DEBUG,"Sending channels and modes, %d to send", this->Instance->chanlist->size());
+ Instance->Logs->Log("m_spanningtree",DEBUG,"Sending channels and modes, %d to send", this->Instance->chanlist->size());
for (chan_hash::iterator c = this->Instance->chanlist->begin(); c != this->Instance->chanlist->end(); c++)
{
SendFJoins(Current, c->second);
for (chan_hash::iterator c = this->Instance->chanlist->begin(); c != this->Instance->chanlist->end(); c++)
{
SendFJoins(Current, c->second);
else
translate_to = TR_TEXT;
else
translate_to = TR_TEXT;
- ServerInstance->Log(DEBUG,"TRANSLATION: %s - type is %d", parameters[j], translate_to);
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"TRANSLATION: %s - type is %d", parameters[j], translate_to);
ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target);
if (j == (pcnt - 1))
ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target);
if (j == (pcnt - 1))
ServerInstance->AddResolver(res, cached);
return;
}
ServerInstance->AddResolver(res, cached);
return;
}
- ServerInstance->Log(DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());
+ ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"Could not resolve IP associated with Link '%s': %s",MyLink.Name.c_str(),errormessage.c_str());
if ((x->Name == servername) && ((ComparePass(this->MakePass(x->RecvPass,this->GetOurChallenge()),password) || x->RecvPass == password && (this->GetTheirChallenge().empty()))))
{
/* Check for fully initialized instances of the server by id */
if ((x->Name == servername) && ((ComparePass(this->MakePass(x->RecvPass,this->GetOurChallenge()),password) || x->RecvPass == password && (this->GetTheirChallenge().empty()))))
{
/* Check for fully initialized instances of the server by id */
- Instance->Log(DEBUG,"Looking for dupe SID %s", sid.c_str());
+ Instance->Logs->Log("m_spanningtree",DEBUG,"Looking for dupe SID %s", sid.c_str());
TreeServer* CheckDupeSID = Utils->FindServerID(sid);
if (CheckDupeSID)
{
TreeServer* CheckDupeSID = Utils->FindServerID(sid);
if (CheckDupeSID)
{
gettimeofday(&t, NULL);
long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
this->StartBurst = ts;
gettimeofday(&t, NULL);
long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000);
this->StartBurst = ts;
- Instance->Log(DEBUG, "Started bursting at time %lu", ts);
+ Instance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts);
/* find the 'route' for this server (e.g. the one directly connected
* to the local server, which we can use to reach it)
/* find the 'route' for this server (e.g. the one directly connected
* to the local server, which we can use to reach it)
void TreeServer::SetID(const std::string &id)
{
void TreeServer::SetID(const std::string &id)
{
- ServerInstance->Log(DEBUG, "Setting SID to " + id);
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Setting SID to " + id);
sid = id;
server_hash::iterator iter = Utils->sidlist.find(sid);
if (iter == Utils->sidlist.end())
sid = id;
server_hash::iterator iter = Utils->sidlist.find(sid);
if (iter == Utils->sidlist.end())
this->Instance->SNO->WriteToSnoMask('l',"Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers);
}
else
this->Instance->SNO->WriteToSnoMask('l',"Netsplit complete, lost \002%d\002 users on \002%d\002 servers.", num_lost_users, num_lost_servers);
}
else
- Instance->Log(DEFAULT,"Squit from unknown server");
+ Instance->Logs->Log("m_spanningtree",DEFAULT,"Squit from unknown server");
}
/** This function is called when we receive data from a remote
}
/** This function is called when we receive data from a remote
int TreeSocket::WriteLine(std::string line)
{
int TreeSocket::WriteLine(std::string line)
{
- Instance->Log(DEBUG, "S[%d] O %s", this->GetFd(), line.c_str());
+ Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str());
line.append("\r\n");
return this->Write(line);
}
line.append("\r\n");
return this->Write(line);
}
if (line.empty())
return true;
if (line.empty())
return true;
- Instance->Log(DEBUG, "S[%d] I %s", this->GetFd(), line.c_str());
+ Instance->Logs->Log("m_spanningtree",DEBUG, "S[%d] I %s", this->GetFd(), line.c_str());
this->Split(line.c_str(),params);
this->Split(line.c_str(),params);
if ((!route_back_again) || (route_back_again->GetSocket() != this))
{
if (route_back_again)
if ((!route_back_again) || (route_back_again->GetSocket() != this))
{
if (route_back_again)
- Instance->Log(DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str());
+ Instance->Logs->Log("m_spanningtree",DEBUG,"Protocol violation: Fake direction in command '%s' from connection '%s'",line.c_str(),this->GetName().c_str());
return true;
}
/* Fix by brain:
return true;
}
/* Fix by brain:
{
if (warned.find(x->server) == warned.end())
{
{
if (warned.find(x->server) == warned.end())
{
- Instance->Log(DEFAULT,"WARNING: I revceived modes '%s' from another server '%s'. This is not compliant with InspIRCd. Please check that server for bugs.", params[1].c_str(), x->server);
+ Instance->Logs->Log("m_spanningtree",DEFAULT,"WARNING: I revceived modes '%s' from another server '%s'. This is not compliant with InspIRCd. Please check that server for bugs.", params[1].c_str(), x->server);
Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending nonstandard modes: '%s MODE %s' where FMODE should be used, and may cause desyncs.", x->server, x->nick, params[1].c_str());
warned[x->server] = x->nick;
}
Instance->SNO->WriteToSnoMask('d', "WARNING: The server %s is sending nonstandard modes: '%s MODE %s' where FMODE should be used, and may cause desyncs.", x->server, x->nick, params[1].c_str());
warned[x->server] = x->nick;
}
- Instance->Log(DEBUG,"*** Collision on %s", tempnick);
+ Instance->Logs->Log("m_spanningtree",DEBUG,"*** Collision on %s", tempnick);
int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str());
if (collide == 2)
int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str());
if (collide == 2)
TreeSocket* listener = new TreeSocket(this, ServerInstance, IP.c_str(), portno, true, 10, transport.empty() ? NULL : hooks[transport.c_str()]);
if (listener->GetState() == I_LISTENING)
{
TreeSocket* listener = new TreeSocket(this, ServerInstance, IP.c_str(), portno, true, 10, transport.empty() ? NULL : hooks[transport.c_str()]);
if (listener->GetState() == I_LISTENING)
{
- ServerInstance->Log(DEFAULT,"m_spanningtree: Binding server port %s:%d successful!", IP.c_str(), portno);
+ ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"m_spanningtree: Binding server port %s:%d successful!", IP.c_str(), portno);
Bindings.push_back(listener);
}
else
{
Bindings.push_back(listener);
}
else
{
- ServerInstance->Log(DEFAULT,"m_spanningtree: Warning: Failed to bind server port: %s:%d: %s",IP.c_str(), portno, strerror(errno));
+ ServerInstance->Logs->Log("m_spanningtree",DEFAULT,"m_spanningtree: Warning: Failed to bind server port: %s:%d: %s",IP.c_str(), portno, strerror(errno));
TreeServer* CheckDupe = this->FindServer(x->FailOver.c_str());
if (CheckDupe)
{
TreeServer* CheckDupe = this->FindServer(x->FailOver.c_str());
if (CheckDupe)
{
- ServerInstance->Log(DEBUG,"Skipping existing failover: %s", x->FailOver.c_str());
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Skipping existing failover: %s", x->FailOver.c_str());
{
if ((*iter)->set_on + (*iter)->length <= ServerInstance->Time())
{
{
if ((*iter)->set_on + (*iter)->length <= ServerInstance->Time())
{
- ServerInstance->Log(DEBUG, "m_svshold.so: hold on %s expired, removing...", (*iter)->nickname.c_str());
+ ServerInstance->Logs->Log("m_svshold",DEBUG, "m_svshold.so: hold on %s expired, removing...", (*iter)->nickname.c_str());
ServerInstance->SNO->WriteToSnoMask('A',"%li second SVSHOLD on %s (%s) set %u seconds ago expired", (*iter)->length, (*iter)->nickname.c_str(), (*iter)->reason.c_str(), ServerInstance->Time() - (*iter)->set_on);
HoldMap.erase(assign((*iter)->nickname));
delete *iter;
ServerInstance->SNO->WriteToSnoMask('A',"%li second SVSHOLD on %s (%s) set %u seconds ago expired", (*iter)->length, (*iter)->nickname.c_str(), (*iter)->reason.c_str(), ServerInstance->Time() - (*iter)->set_on);
HoldMap.erase(assign((*iter)->nickname));
delete *iter;
*/
void OnAddLine(User* source, XLine* line)
{
*/
void OnAddLine(User* source, XLine* line)
{
- ServerInstance->Log(DEBUG, "xlinedb: Adding a line");
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Adding a line");
xlines.push_back(line);
if (!reading_db)
xlines.push_back(line);
if (!reading_db)
void RemoveLine(XLine *line)
{
void RemoveLine(XLine *line)
{
- ServerInstance->Log(DEBUG, "xlinedb: Removing a line");
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Removing a line");
for (std::vector<XLine *>::iterator i = xlines.begin(); i != xlines.end(); i++)
{
if ((*i) == line)
for (std::vector<XLine *>::iterator i = xlines.begin(); i != xlines.end(); i++)
{
if ((*i) == line)
* Technically, that means that this can block, but I have *never* seen that.
* -- w00t
*/
* Technically, that means that this can block, but I have *never* seen that.
* -- w00t
*/
- ServerInstance->Log(DEBUG, "xlinedb: Opening temporary database");
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Opening temporary database");
f = fopen("xline.db.new", "w");
if (!f)
{
f = fopen("xline.db.new", "w");
if (!f)
{
- ServerInstance->Log(DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno);
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot create new db: %s (%d)", strerror(errno), errno);
return false;
}
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot create new db: %s (%d)", strerror(errno), errno);
return false;
}
- ServerInstance->Log(DEBUG, "xlinedb: Opened. Writing..");
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Opened. Writing..");
/*
* Now, much as I hate writing semi-unportable formats, additional
/*
* Now, much as I hate writing semi-unportable formats, additional
ServerInstance->Config->ServerName, line->set_time, line->duration, line->reason);
}
ServerInstance->Config->ServerName, line->set_time, line->duration, line->reason);
}
- ServerInstance->Log(DEBUG, "xlinedb: Finished writing XLines. Checking for error..");
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Finished writing XLines. Checking for error..");
int write_error = 0;
write_error = ferror(f);
write_error |= fclose(f);
if (write_error)
{
int write_error = 0;
write_error = ferror(f);
write_error |= fclose(f);
if (write_error)
{
- ServerInstance->Log(DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno);
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot write to new db: %s (%d)", strerror(errno), errno);
return false;
}
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot write to new db: %s (%d)", strerror(errno), errno);
return false;
}
// Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash.
if (rename("xline.db.new", "xline.db") < 0)
{
// Use rename to move temporary to new db - this is guarenteed not to fuck up, even in case of a crash.
if (rename("xline.db.new", "xline.db") < 0)
{
- ServerInstance->Log(DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno);
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno);
return false;
}
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno);
return false;
}
else
{
/* this might be slightly more problematic. */
else
{
/* this might be slightly more problematic. */
- ServerInstance->Log(DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno);
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot read db: %s (%d)", strerror(errno), errno);
return false;
}
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot read db: %s (%d)", strerror(errno), errno);
return false;
}
- ServerInstance->Log(DEBUG, "xlinedb: Processing %s", linebuf);
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Processing %s", linebuf);
if (command_p[0] == "VERSION")
{
if (command_p[1] == "1")
{
if (command_p[0] == "VERSION")
{
if (command_p[1] == "1")
{
- ServerInstance->Log(DEBUG, "xlinedb: Reading db version %s", command_p[1].c_str());
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Reading db version %s", command_p[1].c_str());
- ServerInstance->Log(DEBUG, "xlinedb: I got database version %s - I don't understand it", command_p[1].c_str());
+ ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: I got database version %s - I don't understand it", command_p[1].c_str());
ServerInstance->SNO->WriteToSnoMask('x', "database: I got a database version (%s) I don't understand", command_p[1].c_str());
return false;
}
ServerInstance->SNO->WriteToSnoMask('x', "database: I got a database version (%s) I don't understand", command_p[1].c_str());
return false;
}
- ServerInstance->Log(DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d, maybe you have another similar module loaded?", portno);
+ ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d, maybe you have another similar module loaded?", portno);
}
}
catch (ModuleException &e)
{
}
}
catch (ModuleException &e)
{
- ServerInstance->Log(DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another similar module loaded?", portno, e.GetReason());
+ ServerInstance->Logs->Log("m_xmlsocket",DEFAULT, "m_xmlsocket.so: FAILED to enable XMLSocket on port %d: %s. Maybe it's already hooked by the same port on a different IP, or you have another similar module loaded?", portno, e.GetReason());
if (this->GetFd() > -1)
{
ServerInstance->SE->DelFd(this);
if (this->GetFd() > -1)
{
ServerInstance->SE->DelFd(this);
- ServerInstance->Log(DEBUG,"Shut down listener on fd %d", this->fd);
+ ServerInstance->Logs->Log("SOCKET", DEBUG,"Shut down listener on fd %d", this->fd);
if (ServerInstance->SE->Shutdown(this, 2) || ServerInstance->SE->Close(this))
if (ServerInstance->SE->Shutdown(this, 2) || ServerInstance->SE->Close(this))
- ServerInstance->Log(DEBUG,"Failed to cancel listener: %s", strerror(errno));
+ ServerInstance->Logs->Log("SOCKET", DEBUG,"Failed to cancel listener: %s", strerror(errno));
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- ServerInstance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ ServerInstance->Logs->Log("SOCKET", DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
}
}
ServerInstance->stats->statsAccept++;
}
}
ServerInstance->stats->statsAccept++;
{
if (SE->Listen(sockfd, Config->MaxConn) == -1)
{
{
if (SE->Listen(sockfd, Config->MaxConn) == -1)
{
- this->Log(DEFAULT,"ERROR in listen(): %s",strerror(errno));
+ this->Logs->Log("SOCKET",DEFAULT,"ERROR in listen(): %s",strerror(errno));
- this->Log(DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port);
+ this->Logs->Log("SOCKET",DEBUG,"New socket binding for %d with listen: %s:%d", sockfd, addr, port);
SE->NonBlocking(sockfd);
return true;
}
}
else
{
SE->NonBlocking(sockfd);
return true;
}
}
else
{
- this->Log(DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port);
+ this->Logs->Log("SOCKET",DEBUG,"New socket binding for %d without listen: %s:%d", sockfd, addr, port);
Config->ConfValue(Config->config_data, "bind", "type", count, Type, MAXBUF);
if (strncmp(Addr, "::ffff:", 7) == 0)
Config->ConfValue(Config->config_data, "bind", "type", count, Type, MAXBUF);
if (strncmp(Addr, "::ffff:", 7) == 0)
- this->Log(DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead.");
+ this->Logs->Log("SOCKET",DEFAULT, "Using 4in6 (::ffff:) isn't recommended. You should bind IPv4 addresses directly instead.");
if ((!*Type) || (!strcmp(Type,"clients")))
{
if ((!*Type) || (!strcmp(Type,"clients")))
{
{
if (((*n)->GetIP() == old_ports[k].first) && ((*n)->GetPort() == old_ports[k].second))
{
{
if (((*n)->GetIP() == old_ports[k].first) && ((*n)->GetPort() == old_ports[k].second))
{
- this->Log(DEFAULT,"Port binding %s:%d was removed from the config file, closing.", old_ports[k].first.c_str(), old_ports[k].second);
+ this->Logs->Log("SOCKET",DEFAULT,"Port binding %s:%d was removed from the config file, closing.", old_ports[k].first.c_str(), old_ports[k].second);
delete *n;
Config->ports.erase(n);
break;
delete *n;
Config->ports.erase(n);
break;
if (EngineHandle == -1)
{
if (EngineHandle == -1)
{
- ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine: %s", strerror(errno));
- ServerInstance->Log(DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.");
+ ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Could not initialize socket engine: %s", strerror(errno));
+ ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.");
printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno));
printf("ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno));
printf("ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
int fd = eh->GetFd();
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
{
int fd = eh->GetFd();
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
{
- ServerInstance->Log(DEBUG,"Out of range FD");
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"Out of range FD");
- ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd);
ref[fd] = eh;
CurrentSetSize++;
ref[fd] = eh;
CurrentSetSize++;
- ServerInstance->Log(DEBUG,"Cant remove socket: %s", strerror(errno));
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"Cant remove socket: %s", strerror(errno));
return false;
}
ref[fd] = NULL;
CurrentSetSize--;
return false;
}
ref[fd] = NULL;
CurrentSetSize--;
- ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
- ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
- ServerInstance->Log(DEFAULT, "ERROR: this is a fatal error, exiting now.");
+ ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
+ ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: this is a fatal error, exiting now.");
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n");
printf("ERROR: this is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n");
printf("ERROR: this is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
PostReadEvent(eh);
/* log message */
PostReadEvent(eh);
/* log message */
- ServerInstance->Log(DEBUG, "New fake fd: %u, real fd: %u, address 0x%p", *fake_fd, eh->GetFd(), eh);
+ ServerInstance->Logs->Log("SOCKET",DEBUG, "New fake fd: %u, real fd: %u, address 0x%p", *fake_fd, eh->GetFd(), eh);
/* post a write event if there is data to be written */
if(eh->Writeable())
/* post a write event if there is data to be written */
if(eh->Writeable())
void* m_writeEvent = NULL;
void* m_acceptEvent = NULL;
void* m_writeEvent = NULL;
void* m_acceptEvent = NULL;
- ServerInstance->Log(DEBUG, "Removing fake fd %u, real fd %u, address 0x%p", *fake_fd, eh->GetFd(), eh);
+ ServerInstance->Logs->Log("SOCKET",DEBUG, "Removing fake fd %u, real fd %u, address 0x%p", *fake_fd, eh->GetFd(), eh);
/* Cancel pending i/o operations. */
if (CancelIo((HANDLE)fd) == FALSE)
/* Cancel pending i/o operations. */
if (CancelIo((HANDLE)fd) == FALSE)
EngineHandle = kqueue();
if (EngineHandle == -1)
{
EngineHandle = kqueue();
if (EngineHandle == -1)
{
- ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
- ServerInstance->Log(DEFAULT, "ERROR: this is a fatal error, exiting now.");
+ ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.");
+ ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: this is a fatal error, exiting now.");
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n");
printf("ERROR: this is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n");
printf("ERROR: this is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
ref[fd] = eh;
CurrentSetSize++;
ref[fd] = eh;
CurrentSetSize++;
- ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd);
CurrentSetSize--;
ref[fd] = NULL;
CurrentSetSize--;
ref[fd] = NULL;
- ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
if (EngineHandle == -1)
{
if (EngineHandle == -1)
{
- ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno));
- ServerInstance->Log(SPARSE,"ERROR: This is a fatal error, exiting now.");
+ ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno));
+ ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: This is a fatal error, exiting now.");
printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno));
printf("ERROR: This is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno));
printf("ERROR: This is a fatal error, exiting now.\n");
ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
ref[fd] = eh;
port_associate(EngineHandle, PORT_SOURCE_FD, fd, eh->Readable() ? POLLRDNORM : POLLWRNORM, eh);
ref[fd] = eh;
port_associate(EngineHandle, PORT_SOURCE_FD, fd, eh->Readable() ? POLLRDNORM : POLLWRNORM, eh);
- ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd);
CurrentSetSize++;
return true;
}
CurrentSetSize++;
return true;
}
CurrentSetSize--;
ref[fd] = NULL;
CurrentSetSize--;
ref[fd] = NULL;
- ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
ref[fd] = eh;
CurrentSetSize++;
ref[fd] = eh;
CurrentSetSize++;
- ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd);
ref[fd] = NULL;
fds[fd] = 0;
ref[fd] = NULL;
fds[fd] = 0;
- ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
+ ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
}
catch (CoreException& e)
{
}
catch (CoreException& e)
{
- ServerInstance->Log(DEBUG,"Error in resolver: %s",e.GetReason());
+ ServerInstance->Logs->Log("RESOLVER", DEBUG,"Error in resolver: %s",e.GetReason());
}
}
else if ((this->fwd) && (ServerInstance->SE->GetRef(this->bound_fd) == this->bound_user))
}
}
else if ((this->fwd) && (ServerInstance->SE->GetRef(this->bound_fd) == this->bound_user))
- Instance->Log(DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed.");
+ Instance->Logs->Log("USERS", DEFAULT,"*** WTF *** Duplicated UUID! -- Crack smoking monkies have been unleashed.");
Instance->SNO->WriteToSnoMask('A', "WARNING *** Duplicate UUID allocated!");
return;
}
Instance->SNO->WriteToSnoMask('A', "WARNING *** Duplicate UUID allocated!");
return;
}
- Instance->Log(DEBUG,"New user fd: %d", socket);
+ Instance->Logs->Log("USERS", DEBUG,"New user fd: %d", socket);
if (!b->Type.empty() && !New->exempt)
{
/* user banned */
if (!b->Type.empty() && !New->exempt)
{
/* user banned */
- Instance->Log(DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString());
+ Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Positive hit for ") + New->GetIPString());
if (*Instance->Config->MoronBanner)
New->WriteServ("NOTICE %s :*** %s", New->nick, Instance->Config->MoronBanner);
User::QuitUser(Instance, New, b->Reason);
if (*Instance->Config->MoronBanner)
New->WriteServ("NOTICE %s :*** %s", New->nick, Instance->Config->MoronBanner);
User::QuitUser(Instance, New, b->Reason);
- Instance->Log(DEBUG, std::string("BanCache: Negative hit for ") + New->GetIPString());
+ Instance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Negative hit for ") + New->GetIPString());
if (!Instance->SE->AddFd(New))
{
if (!Instance->SE->AddFd(New))
{
- Instance->Log(DEBUG,"Internal error on new connection");
+ Instance->Logs->Log("USERS", DEBUG,"Internal error on new connection");
User::QuitUser(Instance, New, "Internal error handling connection");
}
User::QuitUser(Instance, New, "Internal error handling connection");
}
if (!text || !modes || !flags)
{
if (!text || !modes || !flags)
{
- ServerInstance->Log(DEFAULT,"*** BUG *** WriteMode was given an invalid parameter");
+ ServerInstance->Logs->Log("USERS", DEFAULT,"*** BUG *** WriteMode was given an invalid parameter");
void FloodQuitUserHandler::Call(User* current)
{
void FloodQuitUserHandler::Call(User* current)
{
- Server->Log(DEFAULT,"Excess flood from: %s@%s", current->ident, current->host);
+ Server->Logs->Log("USERS",DEFAULT,"Excess flood from: %s@%s", current->ident, current->host);
Server->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s",
current->registered == REG_ALL ? current->nick : "",
current->registered == REG_ALL ? "!" : "", current->ident, current->host);
Server->SNO->WriteToSnoMask('f',"Excess flood from: %s%s%s@%s",
current->registered == REG_ALL ? current->nick : "",
current->registered == REG_ALL ? "!" : "", current->ident, current->host);
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- Server->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ Server->Logs->Log("USERS",DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
- ServerInstance->Log(DEBUG,"Exception in User::Oper()");
+ ServerInstance->Logs->Log("OPER", DEBUG,"Exception in User::Oper()");
- ServerInstance->Log(DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
+ ServerInstance->Logs->Log("USERS",DEBUG,"Uh oh, I dont know protocol %d to be set on '%s'!", protocol_family, this->nick);
- ServerInstance->Log(DEBUG,"Exception in User::Write() std::string::append");
+ ServerInstance->Logs->Log("USEROUTPUT", DEBUG,"Exception in User::Write() std::string::append");
}
catch (CoreException& modexcept)
{
}
catch (CoreException& modexcept)
{
- ServerInstance->Log(DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
+ ServerInstance->Logs->Log("USEROUTPUT", DEBUG, "%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
/* deny change if change will take class over the limit */
if (found->limit && (found->RefCount + 1 >= found->limit))
{
/* deny change if change will take class over the limit */
if (found->limit && (found->RefCount + 1 >= found->limit))
{
- ServerInstance->Log(DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit);
+ ServerInstance->Logs->Log("USERS", DEBUG, "OOPS: Connect class limit (%u) hit, denying", found->limit);
if (found == this->MyClass) // no point changing this shit :P
return this->MyClass;
this->MyClass->RefCount--;
if (found == this->MyClass) // no point changing this shit :P
return this->MyClass;
this->MyClass->RefCount--;
- ServerInstance->Log(DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount);
+ ServerInstance->Logs->Log("USERS", DEBUG, "Untying user from connect class -- refcount: %u", this->MyClass->RefCount);
}
this->MyClass = found;
this->MyClass->RefCount++;
}
this->MyClass = found;
this->MyClass->RefCount++;
- ServerInstance->Log(DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount);
+ ServerInstance->Logs->Log("USERS", DEBUG, "User tied to new class -- connect refcount now: %u", this->MyClass->RefCount);
- ServerInstance->Log(DEBUG,"Exception in User::PurgeEmptyChannels to_delete.push_back()");
+ ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::PurgeEmptyChannels to_delete.push_back()");
- ServerInstance->Log(DEBUG,"Exception in User::HandleEvent intercepted");
+ ServerInstance->Logs->Log("USERS", DEBUG,"Exception in User::HandleEvent intercepted");
}
/* If the user has raised an error whilst being processed, quit them now we're safe to */
}
/* If the user has raised an error whilst being processed, quit them now we're safe to */
- ServerInstance->Log(DEBUG, std::string("BanCache: Adding positive hit (") + line + ") for " + u->GetIPString());
+ ServerInstance->Logs->Log("BANCACHE", DEBUG, std::string("BanCache: Adding positive hit (") + line + ") for " + u->GetIPString());
ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason);
}
}
ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason);
}
}