diff options
author | Adam <Adam@anope.org> | 2010-10-21 23:20:48 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-10-21 23:20:48 -0400 |
commit | 791c2b89a5b09d3e3e3785669b29438ffec26295 (patch) | |
tree | 60a4647572e80d5f037fe2d9e49338a34cc0d6ea | |
parent | 4f317a242104b623d2e5257bc672fd56c0240a0e (diff) |
Changed the log:normal config directive to a list like the other log values, and fixed a potential crash from rehashing while sending mail
-rw-r--r-- | data/example.conf | 6 | ||||
-rw-r--r-- | include/logger.h | 4 | ||||
-rw-r--r-- | include/mail.h | 5 | ||||
-rw-r--r-- | src/config.cpp | 11 | ||||
-rw-r--r-- | src/dns.cpp | 2 | ||||
-rw-r--r-- | src/logger.cpp | 7 | ||||
-rw-r--r-- | src/mail.cpp | 10 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/misc.cpp | 2 | ||||
-rw-r--r-- | src/nickcore.cpp | 2 | ||||
-rw-r--r-- | src/nickserv.cpp | 6 |
11 files changed, 31 insertions, 26 deletions
diff --git a/data/example.conf b/data/example.conf index a4ba7ca82..08e79d9f8 100644 --- a/data/example.conf +++ b/data/example.conf @@ -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 } diff --git a/include/logger.h b/include/logger.h index 518e2114f..6d134c227 100644 --- a/include/logger.h +++ b/include/logger.h @@ -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(); diff --git a/include/mail.h b/include/mail.h index 826f48253..c62bfb3be 100644 --- a/include/mail.h +++ b/include/mail.h @@ -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(); diff --git a/src/config.cpp b/src/config.cpp index 898f9bf70..61dfe7bc0 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -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", ""}, diff --git a/src/dns.cpp b/src/dns.cpp index ffd34e669..adedf9e61 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -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; } diff --git a/src/logger.cpp b/src/logger.cpp index 58183c8b0..e2833b2c8 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -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: diff --git a/src/mail.cpp b/src/mail.cpp index 66cf1b81e..d59903726 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -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()); diff --git a/src/main.cpp b/src/main.cpp index 2cacfd8f2..c87b0a7fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(); diff --git a/src/misc.cpp b/src/misc.cpp index f9a8befc9..d00bbbcc6 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -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."); } } diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 61130b878..40cd873a8 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -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(); diff --git a/src/nickserv.cpp b/src/nickserv.cpp index 54dc82b98..e21d85e45 100644 --- a/src/nickserv.cpp +++ b/src/nickserv.cpp @@ -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); |