mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Changed the log:normal config directive to a list like the other log values, and fixed a potential crash from rehashing while sending mail
This commit is contained in:
+3
-3
@@ -574,7 +574,7 @@ log
|
||||
* servers - Server actions, linking, squitting, etc.
|
||||
* channels - Actions in channels such as joins, parts, kicks, etc.
|
||||
* users - User actions such as connecting, disconnecting, changing name, etc.
|
||||
* normal - Miscellaneous messages.
|
||||
* other - All other messages without a category.
|
||||
* rawio - Logs raw input and output from services
|
||||
* debug - Debug messages (log files can become VERY large from this).
|
||||
*
|
||||
@@ -595,7 +595,7 @@ log
|
||||
* Valid user options are:
|
||||
* connect, disconnect, quit, nick, ident, host, mode, maxusers
|
||||
*
|
||||
* Normal and debug are simple yes/no answers, there are no types for them.
|
||||
* Rawio and debug are simple yes/no answers, there are no types for them.
|
||||
*
|
||||
* Note that modules may add their own values to these options.
|
||||
*/
|
||||
@@ -605,7 +605,7 @@ log
|
||||
servers = "*"
|
||||
//channels = "~mode *"
|
||||
users = "connect disconnect nick"
|
||||
normal = yes
|
||||
other = "*"
|
||||
rawio = no
|
||||
debug = no
|
||||
}
|
||||
|
||||
+2
-2
@@ -78,11 +78,11 @@ class CoreExport LogInfo
|
||||
std::list<Anope::string> Servers;
|
||||
std::list<Anope::string> Users;
|
||||
std::list<Anope::string> Channels;
|
||||
bool Normal;
|
||||
std::list<Anope::string> Normal;
|
||||
bool RawIO;
|
||||
bool Debug;
|
||||
|
||||
LogInfo(int logage, bool inhabit, bool normal, bool rawio, bool debug);
|
||||
LogInfo(int logage, bool inhabit, bool rawio, bool debug);
|
||||
|
||||
~LogInfo();
|
||||
|
||||
|
||||
+2
-3
@@ -15,12 +15,11 @@ class MailThread : public Thread
|
||||
Anope::string Addr;
|
||||
Anope::string Subject;
|
||||
Anope::string Message;
|
||||
bool DontQuoteAddresses;
|
||||
|
||||
bool Success;
|
||||
public:
|
||||
MailThread(const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message) : Thread(), MailTo(mailto), Addr(addr), Subject(subject), Message(message), Success(false)
|
||||
{
|
||||
}
|
||||
MailThread(const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
|
||||
|
||||
~MailThread();
|
||||
|
||||
|
||||
+6
-5
@@ -938,7 +938,7 @@ bool InitLogs(ServerConfig *config, const Anope::string &)
|
||||
|
||||
bool DoLogs(ServerConfig *config, const Anope::string &, const Anope::string *, ValueList &values, int *)
|
||||
{
|
||||
//{"target", "source", "logage", "inhabit", "admin", "override", "commands", "servers", "channels", "users", "normal", "rawio", "debug"},
|
||||
//{"target", "source", "logage", "inhabit", "admin", "override", "commands", "servers", "channels", "users", "other", "rawio", "debug"},
|
||||
Anope::string targets = values[0].GetValue();
|
||||
ValueItem vi(targets);
|
||||
if (!ValidateNotEmpty(config, "log", "target", vi))
|
||||
@@ -953,11 +953,11 @@ bool DoLogs(ServerConfig *config, const Anope::string &, const Anope::string *,
|
||||
Anope::string servers = values[7].GetValue();
|
||||
Anope::string channels = values[8].GetValue();
|
||||
Anope::string users = values[9].GetValue();
|
||||
bool normal = values[10].GetBool();
|
||||
Anope::string normal = values[10].GetValue();
|
||||
bool rawio = values[11].GetBool();
|
||||
bool ldebug = values[12].GetBool();
|
||||
|
||||
LogInfo *l = new LogInfo(logage, inhabit, normal, rawio, ldebug);
|
||||
LogInfo *l = new LogInfo(logage, inhabit, rawio, ldebug);
|
||||
l->Targets = BuildStringList(targets);
|
||||
l->Sources = BuildStringList(source);
|
||||
l->Admin = BuildStringList(admin);
|
||||
@@ -966,6 +966,7 @@ bool DoLogs(ServerConfig *config, const Anope::string &, const Anope::string *,
|
||||
l->Servers = BuildStringList(servers);
|
||||
l->Channels = BuildStringList(channels);
|
||||
l->Users = BuildStringList(users);
|
||||
l->Normal = BuildStringList(normal);
|
||||
|
||||
config->LogInfos.push_back(l);
|
||||
|
||||
@@ -1213,9 +1214,9 @@ void ServerConfig::Read()
|
||||
{DT_CHARPTR},
|
||||
InitModules, DoModule, DoneModules},
|
||||
{"log",
|
||||
{"target", "source", "logage", "inhabitlogchannel", "admin", "override", "commands", "servers", "channels", "users", "normal", "rawio", "debug", ""},
|
||||
{"target", "source", "logage", "inhabitlogchannel", "admin", "override", "commands", "servers", "channels", "users", "other", "rawio", "debug", ""},
|
||||
{"", "", "7", "yes", "", "", "", "", "", "", "no", "no", ""},
|
||||
{DT_STRING, DT_STRING, DT_INTEGER, DT_BOOLEAN, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_BOOLEAN, DT_BOOLEAN, DT_BOOLEAN},
|
||||
{DT_STRING, DT_STRING, DT_INTEGER, DT_BOOLEAN, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_BOOLEAN, DT_BOOLEAN},
|
||||
InitLogs, DoLogs, DoneLogs},
|
||||
{"opertype",
|
||||
{"name", "inherits", "commands", "privs", ""},
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@ DNSSocket::~DNSSocket()
|
||||
for (unsigned i = DNSEngine->packets.size(); i > 0; --i)
|
||||
delete DNSEngine->packets[i - 1];
|
||||
DNSEngine->packets.clear();
|
||||
Log() << "Resolver: Lost connection to nameserver";
|
||||
Log(LOG_NORMAL, "dns") << "Resolver: Lost connection to nameserver";
|
||||
DNSEngine->sock = NULL;
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -205,7 +205,7 @@ Log::~Log()
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo::LogInfo(int logage, bool inhabit, bool normal, bool rawio, bool ldebug) : LogAge(logage), Inhabit(inhabit), Normal(normal), RawIO(rawio), Debug(ldebug)
|
||||
LogInfo::LogInfo(int logage, bool inhabit, bool rawio, bool ldebug) : LogAge(logage), Inhabit(inhabit), RawIO(rawio), Debug(ldebug)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -272,6 +272,8 @@ std::list<Anope::string> &LogInfo::GetList(LogType type)
|
||||
return this->Channels;
|
||||
case LOG_USER:
|
||||
return this->Users;
|
||||
case LOG_NORMAL:
|
||||
return this->Normal;
|
||||
default:
|
||||
return empty;
|
||||
}
|
||||
@@ -287,9 +289,8 @@ bool LogInfo::HasType(LogType type)
|
||||
case LOG_SERVER:
|
||||
case LOG_CHANNEL:
|
||||
case LOG_USER:
|
||||
return !this->GetList(type).empty();
|
||||
case LOG_NORMAL:
|
||||
return this->Normal;
|
||||
return !this->GetList(type).empty();
|
||||
case LOG_TERMINAL:
|
||||
return true;
|
||||
case LOG_RAWIO:
|
||||
|
||||
+7
-3
@@ -1,11 +1,15 @@
|
||||
#include "services.h"
|
||||
|
||||
MailThread::MailThread(const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message) : Thread(), MailTo(mailto), Addr(addr), Subject(subject), Message(message), Success(false), DontQuoteAddresses(Config->DontQuoteAddresses)
|
||||
{
|
||||
}
|
||||
|
||||
MailThread::~MailThread()
|
||||
{
|
||||
if (Success)
|
||||
Log() << "Successfully delivered mail for " << MailTo << " (" << Addr << ")";
|
||||
Log(LOG_NORMAL, "mail") << "Successfully delivered mail for " << MailTo << " (" << Addr << ")";
|
||||
else
|
||||
Log() << "Error delivering mail for " << MailTo << " (" << Addr << ")";
|
||||
Log(LOG_NORMAL, "mail") << "Error delivering mail for " << MailTo << " (" << Addr << ")";
|
||||
}
|
||||
|
||||
void MailThread::Run()
|
||||
@@ -19,7 +23,7 @@ void MailThread::Run()
|
||||
}
|
||||
|
||||
fprintf(pipe, "From: %s\n", Config->SendFrom.c_str());
|
||||
if (Config->DontQuoteAddresses)
|
||||
if (this->DontQuoteAddresses)
|
||||
fprintf(pipe, "To: %s <%s>\n", MailTo.c_str(), Addr.c_str());
|
||||
else
|
||||
fprintf(pipe, "To: \"%s\" <%s>\n", MailTo.c_str(), Addr.c_str());
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ void sighandler(int signum)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
case SIGHUP:
|
||||
Log() << "Received SIGHUP: Saving Databases & Rehash Configuration";
|
||||
Log() << "Received SIGHUP: Saving databases & rehashing configuration";
|
||||
|
||||
expire_all();
|
||||
save_databases();
|
||||
|
||||
+1
-1
@@ -575,7 +575,7 @@ void EnforceQlinedNick(const Anope::string &nick, const Anope::string &killer)
|
||||
|
||||
if (u2)
|
||||
{
|
||||
Log() << "Killed Q-lined nick: " << u2->GetMask();
|
||||
Log(LOG_NORMAL, "xline") << "Killed Q-lined nick: " << u2->GetMask();
|
||||
kill_user(killer, u2->nick, "This nick is reserved for Services. Please use a non Q-Lined nick.");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ NickCore::~NickCore()
|
||||
NickCoreList.erase(this->display);
|
||||
|
||||
/* Log .. */
|
||||
Log() << Config->s_NickServ << ": deleting nickname group " << this->display;
|
||||
Log(NickServ, "nick") << "deleting nickname group " << this->display;
|
||||
|
||||
/* Clear access before deleting display name, we want to be able to use the display name in the clear access event */
|
||||
this->ClearAccess();
|
||||
|
||||
+3
-3
@@ -263,7 +263,7 @@ void expire_nicks()
|
||||
FOREACH_RESULT(I_OnPreNickExpire, OnPreNickExpire(na));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
continue;
|
||||
Log() << "Expiring nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
|
||||
Log(LOG_NORMAL, "expire") << "Expiring nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
|
||||
FOREACH_MOD(I_OnNickExpire, OnNickExpire(na));
|
||||
delete na;
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void expire_requests()
|
||||
|
||||
if (Config->NSRExpire && Anope::CurTime - nr->requested >= Config->NSRExpire)
|
||||
{
|
||||
Log() << "Request for nick " << nr->nick << " expiring";
|
||||
Log(LOG_NORMAL, "expire") << "Request for nick " << nr->nick << " expiring";
|
||||
delete nr;
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ void change_core_display(NickCore *nc, const Anope::string &newdisplay)
|
||||
{
|
||||
/* Log ... */
|
||||
FOREACH_MOD(I_OnChangeCoreDisplay, OnChangeCoreDisplay(nc, newdisplay));
|
||||
Log() << Config->s_NickServ << ": changing " << nc->display << " nickname group display to " << newdisplay;
|
||||
Log(LOG_NORMAL, "nick") << Config->s_NickServ << ": changing " << nc->display << " nickname group display to " << newdisplay;
|
||||
|
||||
/* Remove the core from the list */
|
||||
NickCoreList.erase(nc->display);
|
||||
|
||||
Reference in New Issue
Block a user