summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-02-08 18:00:24 -0500
committerAdam <Adam@anope.org>2012-02-08 18:00:24 -0500
commit1bc8e2ab82db9ce00faaa44887338873a2cd9210 (patch)
tree22523f23f143af444fbb79fdc252966b2e44c5ff
parent089c85b27e0674dc8102b15e507ebdd7386eeb87 (diff)
Removed operserv:notifications in favor of log blocks, as well as some other notifiications
-rw-r--r--data/example.conf9
-rw-r--r--data/operserv.example.conf15
-rw-r--r--docs/Changes.conf1
-rw-r--r--include/config.h12
-rw-r--r--include/logger.h6
-rw-r--r--modules/commands/os_defcon.cpp8
-rw-r--r--modules/commands/os_forbid.cpp2
-rw-r--r--modules/commands/os_module.cpp6
-rw-r--r--modules/commands/os_oline.cpp4
-rw-r--r--modules/commands/os_session.cpp14
-rw-r--r--modules/commands/os_set.cpp2
-rw-r--r--modules/commands/os_svsnick.cpp2
-rw-r--r--modules/pseudoclients/operserv.cpp22
-rw-r--r--src/config.cpp25
-rw-r--r--src/logger.cpp24
15 files changed, 52 insertions, 100 deletions
diff --git a/data/example.conf b/data/example.conf
index 53fceecf4..8e271dc87 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -667,13 +667,13 @@ log
* pesudo-serv/commandname (eg, operserv/akill, chanserv/set)
*
* Valid server options are:
- * connect, quit, sync
+ * connect, quit, sync, squit
*
* Valid channel options are:
* create, destroy, join, part, kick, leave, mode
*
* Valid user options are:
- * connect, disconnect, quit, nick, ident, host, mode, maxusers
+ * connect, disconnect, quit, nick, ident, host, mode, maxusers, oper
*
* Rawio and debug are simple yes/no answers, there are no types for them.
*
@@ -696,7 +696,10 @@ log
log
{
target = "globops"
- admin = "global/* operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe */forbid nickserv/getpass */drop"
+ admin = "global/* operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/oline operserv/set operserv/svsnick nickserv/getpass */drop"
+ servers = "squit"
+ users = "oper"
+ other = "expire/* bados akill/*"
}
/*
diff --git a/data/operserv.example.conf b/data/operserv.example.conf
index dbedb69e6..08410eb1c 100644
--- a/data/operserv.example.conf
+++ b/data/operserv.example.conf
@@ -111,21 +111,6 @@ operserv
#killonsqline = yes
/*
- * Defines what actions should trigger notifications. The list must be separated by spaces.
- *
- * The notifications are:
- * - oper: A user has become an IRC operator
- * - bados: A non-IRCop attempts to use OperServ
- * - akillexpire: An AKILL has expired
- * - snlineexpire: An SNLINE has expired
- * - sqlineexpire: An SQLINE has expired
- * - exceptionexpire: A session exception has expired
- *
- * This directive is optional, if left blank, there will be no notifications.
- */
- notifications = "oper"
-
- /*
* Enables session limiting. Session limiting prevents users from connecting more than a certain
* number of times from the same host at the same time - thus preventing most types of cloning.
* Once a host reaches it's session limit, all clients attempting to connect from that host will
diff --git a/docs/Changes.conf b/docs/Changes.conf
index 03db49299..cdfbfa094 100644
--- a/docs/Changes.conf
+++ b/docs/Changes.conf
@@ -1,5 +1,6 @@
Anope Version 1.9.7
-------------------
+operserv:notifications removed in favor of log{} blocks
Anope Version 1.9.6
-------------------
diff --git a/include/config.h b/include/config.h
index b411cb897..cb0029c0d 100644
--- a/include/config.h
+++ b/include/config.h
@@ -598,18 +598,6 @@ class CoreExport ServerConfig
bool KillonSNline;
/* Kill users on SQline */
bool KillonSQline;
- /* Send a WALLOPS/GLOBOPS when a user opers */
- bool WallOper;
- /* Send a WALLOPS/GLOBOPS when a nonoper tries to use OperServ */
- bool WallBadOS;
- /* Send a WALLOPS/GLOBOPS when an akill expires */
- bool WallAkillExpire;
- /* Send a WALLOPS/GLOBOPS when SNLines expire */
- bool WallSNLineExpire;
- /* Send a WALLOPS/GLOBOPS when SQLines expire */
- bool WallSQLineExpire;
- /* Send a WALLOPS/GLOBOPS when exceptions expire */
- bool WallExceptionExpire;
/* Add the akillers nick to the akill reason */
bool AddAkiller;
/* Add akill ids to akill reason */
diff --git a/include/logger.h b/include/logger.h
index 5f611b277..3ba93a1e9 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -55,12 +55,12 @@ class CoreExport Log
Log(User *u, Channel *c, const Anope::string &category = "");
/* LOG_USER */
- explicit Log(User *u, const Anope::string &category = "");
+ explicit Log(User *u, const Anope::string &category = "", BotInfo *bi = NULL);
/* LOG_SERVER */
- Log(Server *s, const Anope::string &category = "");
+ explicit Log(Server *s, const Anope::string &category = "", BotInfo *bi = NULL);
- Log(BotInfo *b, const Anope::string &category = "");
+ explicit Log(BotInfo *b, const Anope::string &category = "");
~Log();
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp
index 7e40a5c02..3bd1fc111 100644
--- a/modules/commands/os_defcon.cpp
+++ b/modules/commands/os_defcon.cpp
@@ -549,13 +549,17 @@ class OSDefcon : public Module
if (!Config->SessionLimitDetailsLoc.empty())
ircdproto->SendMessage(findbot(Config->OperServ), u->nick, "%s", Config->SessionLimitDetailsLoc.c_str());
- u->Kill(Config->OperServ, "Defcon session limit exceeded");
++session->hits;
if (akills && Config->MaxSessionKill && session->hits >= Config->MaxSessionKill)
{
XLine x("*@" + u->host, Config->OperServ, Anope::CurTime + Config->SessionAutoKillExpiry, "Defcon session limit exceeded", XLineManager::GenerateUID());
akills->Send(NULL, &x);
- ircdproto->SendGlobops(findbot(Config->OperServ), "[DEFCON] Added a temporary AKILL for \2*@%s\2 due to excessive connections", u->host.c_str());
+ Log(findbot(Config->OperServ), "akill/defcon") << "[DEFCON] Added a temporary AKILL for \2*@" << u->host << "\2 due to excessive connections";
+ }
+ else
+ {
+ u->Kill(Config->OperServ, "Defcon session limit exceeded");
+ u = NULL; /* No guarentee u still exists */
}
}
}
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index a60b362db..7d20c5539 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -63,7 +63,7 @@ class MyForbidService : public ForbidService
else if (d->type == FT_EMAIL)
ftype = "email";
- Log(LOG_NORMAL, Config->OperServ + "/forbid") << "Expiring forbid for " << d->mask << " type " << ftype;
+ Log(LOG_NORMAL, "expire/forbid") << "Expiring forbid for " << d->mask << " type " << ftype;
this->forbidData.erase(this->forbidData.begin() + i - 1);
delete d;
}
diff --git a/modules/commands/os_module.cpp b/modules/commands/os_module.cpp
index 074cc1c1a..196a9bed8 100644
--- a/modules/commands/os_module.cpp
+++ b/modules/commands/os_module.cpp
@@ -30,7 +30,7 @@ class CommandOSModLoad : public Command
ModuleReturn status = ModuleManager::LoadModule(mname, u);
if (status == MOD_ERR_OK)
{
- ircdproto->SendGlobops(source.owner, "%s loaded module %s", u->nick.c_str(), mname.c_str());
+ Log(LOG_ADMIN, u, this) << "to load module " << mname;
source.Reply(_("Module \002%s\002 loaded"), mname.c_str());
}
else if (status == MOD_ERR_EXISTS)
@@ -91,7 +91,7 @@ class CommandOSModReLoad : public Command
status = ModuleManager::LoadModule(mname, u);
if (status == MOD_ERR_OK)
{
- ircdproto->SendGlobops(source.owner, "%s reloaded module %s", u->nick.c_str(), mname.c_str());
+ Log(LOG_ADMIN, u, this) << "to reload module " << mname;
source.Reply(_("Module \002%s\002 reloaded"), mname.c_str());
}
else
@@ -150,8 +150,8 @@ class CommandOSModUnLoad : public Command
if (status == MOD_ERR_OK)
{
+ Log(LOG_ADMIN, u, this) << "to unload module " << mname;
source.Reply(_("Module \002%s\002 unloaded"), mname.c_str());
- ircdproto->SendGlobops(source.owner, "%s unloaded module %s", u->nick.c_str(), mname.c_str());
}
else
source.Reply(_("Unable to remove module \002%s\002"), mname.c_str());
diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp
index 6daae2fed..9ce76d95c 100644
--- a/modules/commands/os_oline.cpp
+++ b/modules/commands/os_oline.cpp
@@ -38,13 +38,13 @@ class CommandOSOLine : public Command
u2->SetMode(source.owner, UMODE_OPER);
u2->SendMessage(source.owner, _("You are now an IRC Operator."));
source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str());
- ircdproto->SendGlobops(source.owner, "\2%s\2 used OLINE for %s", u->nick.c_str(), nick.c_str());
+ Log(LOG_ADMIN, u, this) << "for " << nick;
}
else if (u2 && flag[0] == '-')
{
ircdproto->SendSVSO(Config->OperServ, nick, flag);
source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str());
- ircdproto->SendGlobops(source.owner, "\2%s\2 used OLINE for %s", u->nick.c_str(), nick.c_str());
+ Log(LOG_ADMIN, u, this) << "for " << nick;
}
else
this->OnSyntaxError(source, "");
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index c35be7b09..12267b651 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -100,9 +100,7 @@ class ExpireTimer : public Timer
if (!e->expires || e->expires > Anope::CurTime)
continue;
- BotInfo *bi = findbot(Config->OperServ);
- if (Config->WallExceptionExpire && bi)
- ircdproto->SendGlobops(bi, "Session exception for %s has expired.", e->mask.c_str());
+ Log(findbot(Config->OperServ), "expire/exception") << "Session exception for " << e->mask << "has expired.";
session_service->DelException(e);
delete e;
}
@@ -646,8 +644,6 @@ class OSSession : public Module
u->SendMessage(bi, "%s", Config->SessionLimitDetailsLoc.c_str());
}
- u->Kill(Config->OperServ, "Session limit exceeded");
-
++session->hits;
if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill && akills)
{
@@ -655,8 +651,12 @@ class OSSession : public Module
XLine *x = new XLine(akillmask, Config->OperServ, Anope::CurTime + Config->SessionAutoKillExpiry, "Session limit exceeded", XLineManager::GenerateUID());
akills->AddXLine(x);
akills->Send(NULL, x);
- if (bi)
- ircdproto->SendGlobops(bi, "Added a temporary AKILL for \2%s\2 due to excessive connections", akillmask.c_str());
+ Log(bi, "akill/session") << "Added a temporary AKILL for \2" << akillmask << "\2 due to excessive connections";
+ }
+ else
+ {
+ u->Kill(Config->OperServ, "Session limit exceeded");
+ u = NULL; /* No guarentee u still exists */
}
}
}
diff --git a/modules/commands/os_set.cpp b/modules/commands/os_set.cpp
index fbdfd2814..1cea0e90c 100644
--- a/modules/commands/os_set.cpp
+++ b/modules/commands/os_set.cpp
@@ -84,14 +84,12 @@ class CommandOSSet : public Command
u->SuperAdmin = true;
source.Reply(_("You are now a SuperAdmin"));
Log(LOG_ADMIN, u, this) << "SUPERADMIN ON";
- ircdproto->SendGlobops(source.owner, _("%s is now a Super-Admin"), u->nick.c_str());
}
else if (setting.equals_ci("OFF"))
{
u->SuperAdmin = false;
source.Reply(_("You are no longer a SuperAdmin"));
Log(LOG_ADMIN, u, this) << "SUPERADMIN OFF";
- ircdproto->SendGlobops(source.owner, _("%s is no longer a Super-Admin"), u->nick.c_str());
}
else
source.Reply(_("Setting for SuperAdmin must be \002on\002 or \002off\002 (must be enabled in services.conf)"));
diff --git a/modules/commands/os_svsnick.cpp b/modules/commands/os_svsnick.cpp
index 1d88779b1..be5f8c320 100644
--- a/modules/commands/os_svsnick.cpp
+++ b/modules/commands/os_svsnick.cpp
@@ -57,7 +57,7 @@ class CommandOSSVSNick : public Command
else
{
source.Reply(_("The nick \002%s\002 is now being changed to \002%s\002."), nick.c_str(), newnick.c_str());
- ircdproto->SendGlobops(source.owner, "%s used SVSNICK to change %s to %s", u->nick.c_str(), nick.c_str(), newnick.c_str());
+ Log(LOG_ADMIN, u, this) << "to change " << nick << " to " << newnick;
ircdproto->SendForceNickChange(u2, newnick, Anope::CurTime);
}
return;
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index ab7d70887..7dfaf40bb 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -29,8 +29,7 @@ class SGLineManager : public XLineManager
void OnExpire(XLine *x)
{
- if (Config->WallAkillExpire)
- ircdproto->SendGlobops(OperServ, "AKILL on %s has expired", x->Mask.c_str());
+ Log(OperServ, "expire/akill") << "AKILL on \2" << x->Mask << "\2 has expired";
}
void Send(User *u, XLine *x)
@@ -86,8 +85,7 @@ class SQLineManager : public XLineManager
void OnExpire(XLine *x)
{
- if (Config->WallSQLineExpire)
- ircdproto->SendGlobops(OperServ, "SQLINE on \2%s\2 has expired", x->Mask.c_str());
+ Log(OperServ, "expire/sqline") << "SQLINE on \2" << x->Mask << "\2 has expired";
}
void Send(User *u, XLine *x)
@@ -127,8 +125,7 @@ class SNLineManager : public XLineManager
void OnExpire(XLine *x)
{
- if (Config->WallSNLineExpire)
- ircdproto->SendGlobops(OperServ, "SNLINE on \2%s\2 has expired", x->Mask.c_str());
+ Log(OperServ, "expire/snline") << "SNLINE on \2" << x->Mask << "\2 has expired";
}
void Send(User *u, XLine *x)
@@ -206,8 +203,7 @@ class OperServCore : public Module
if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ)
{
u->SendMessage(bi, ACCESS_DENIED);
- if (Config->WallBadOS)
- ircdproto->SendGlobops(OperServ, "Denied access to %s from %s!%s@%s (non-oper)", Config->OperServ.c_str(), u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str());
+ Log(OperServ, "bados") << "Denied access to " << Config->OperServ << " from " << u->GetMask() << " (non-oper)";
return EVENT_STOP;
}
@@ -217,23 +213,19 @@ class OperServCore : public Module
void OnServerQuit(Server *server)
{
if (server->HasFlag(SERVER_JUPED))
- ircdproto->SendGlobops(OperServ, "Received SQUIT for juped server %s", server->GetName().c_str());
+ Log(server, "squit", OperServ) << "Received SQUIT for juped server " << server->GetName();
}
void OnUserModeSet(User *u, UserModeName Name)
{
if (Name == UMODE_OPER)
- {
- if (Config->WallOper)
- ircdproto->SendGlobops(OperServ, "\2%s\2 is now an IRC operator.", u->nick.c_str());
- Log(OperServ) << u->nick << " is now an IRC operator";
- }
+ Log(u, "oper", OperServ) << "is now an IRC operator.";
}
void OnUserModeUnset(User *u, UserModeName Name)
{
if (Name == UMODE_OPER)
- Log(OperServ) << u->nick << " is no longer an IRC operator";
+ Log(u, "oper", OperServ) << "is no longer an IRC operator";
}
void OnUserConnect(dynamic_reference<User> &u, bool &exempt)
diff --git a/src/config.cpp b/src/config.cpp
index e1c5e773a..952da263c 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -19,7 +19,6 @@ ConfigurationFile services_conf("services.conf", false); // Services configurati
ServerConfig *Config = NULL;
static Anope::string UlineServers;
-static Anope::string OSNotifications;
static Anope::string BSDefaults;
static Anope::string CSDefaults;
static Anope::string NSDefaults;
@@ -138,29 +137,6 @@ ServerConfig::ServerConfig() : config_data(), NSDefFlags(NickCoreFlagStrings), C
}
}
- this->WallOper = this->WallBadOS = this->WallAkillExpire = this->WallSNLineExpire = this->WallSQLineExpire =
- this->WallExceptionExpire = false;
- if (!OSNotifications.empty())
- {
- spacesepstream notifications(OSNotifications);
- Anope::string notice;
- while (notifications.GetToken(notice))
- {
- if (notice.equals_ci("oper"))
- this->WallOper = true;
- else if (notice.equals_ci("bados"))
- this->WallBadOS = true;
- else if (notice.equals_ci("akillexpire"))
- this->WallAkillExpire = true;
- else if (notice.equals_ci("snlineexpire"))
- this->WallSNLineExpire = true;
- else if (notice.equals_ci("sqlineexpire"))
- this->WallSQLineExpire = true;
- else if (notice.equals_ci("exceptionexpire"))
- this->WallExceptionExpire = true;
- }
- }
-
/* Ulines */
if (!UlineServers.empty())
{
@@ -1267,7 +1243,6 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"operserv", "akillonadd", "no", new ValueContainerBool(&conf->AkillOnAdd), DT_BOOLEAN, NoValidation},
{"operserv", "killonsnline", "no", new ValueContainerBool(&conf->KillonSNline), DT_BOOLEAN, NoValidation},
{"operserv", "killonsqline", "no", new ValueContainerBool(&conf->KillonSQline), DT_BOOLEAN, NoValidation},
- {"operserv", "notifications", "", new ValueContainerString(&OSNotifications), DT_STRING, NoValidation},
{"operserv", "limitsessions", "no", new ValueContainerBool(&conf->LimitSessions), DT_BOOLEAN, NoValidation},
{"operserv", "defaultsessionlimit", "0", new ValueContainerUInt(&conf->DefSessionLimit), DT_UINTEGER, NoValidation},
{"operserv", "maxsessionlimit", "0", new ValueContainerUInt(&conf->MaxSessionLimit), DT_UINTEGER, ValidateOperServ},
diff --git a/src/logger.cpp b/src/logger.cpp
index bdb46bd97..978c9cd44 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -108,23 +108,25 @@ Log::Log(User *_u, Channel *ch, const Anope::string &category) : u(_u), c(NULL),
this->Sources.push_back(chan->name);
}
-Log::Log(User *_u, const Anope::string &category) : bi(NULL), u(_u), c(NULL), chan(NULL), ci(NULL), s(NULL), Type(LOG_USER), Category(category)
+Log::Log(User *_u, const Anope::string &category, BotInfo *_bi) : bi(_bi), u(_u), c(NULL), chan(NULL), ci(NULL), s(NULL), Type(LOG_USER), Category(category)
{
if (!u)
throw CoreException("Invalid pointers passed to Log::Log");
- this->bi = Config ? findbot(Config->Global) : NULL;
+ if (!this->bi)
+ this->bi = Config ? findbot(Config->Global) : NULL;
if (this->bi)
this->Sources.push_back(this->bi->nick);
this->Sources.push_back(u->nick);
}
-Log::Log(Server *serv, const Anope::string &category) : bi(NULL), u(NULL), c(NULL), chan(NULL), ci(NULL), s(serv), Type(LOG_SERVER), Category(category)
+Log::Log(Server *serv, const Anope::string &category, BotInfo *_bi) : bi(_bi), u(NULL), c(NULL), chan(NULL), ci(NULL), s(serv), Type(LOG_SERVER), Category(category)
{
if (!s)
throw CoreException("Invalid pointer passed to Log::Log");
- this->bi = Config ? findbot(Config->OperServ) : NULL;
+ if (!this->bi)
+ this->bi = Config ? findbot(Config->OperServ) : NULL;
if (!this->bi)
this->bi = Config ? findbot(Config->Global) : NULL;
if (this->bi)
@@ -167,7 +169,7 @@ Anope::string Log::BuildPrefix() const
{
case LOG_ADMIN:
{
- if (!this->c)
+ if (!this->c || !this->u)
break;
buffer += "ADMIN: ";
size_t sl = this->c->name.find('/');
@@ -179,7 +181,7 @@ Anope::string Log::BuildPrefix() const
}
case LOG_OVERRIDE:
{
- if (!this->c)
+ if (!this->c || !this->u)
break;
buffer += "OVERRIDE: ";
size_t sl = this->c->name.find('/');
@@ -191,7 +193,7 @@ Anope::string Log::BuildPrefix() const
}
case LOG_COMMAND:
{
- if (!this->c)
+ if (!this->c || !this->u)
break;
buffer += "COMMAND: ";
size_t sl = this->c->name.find('/');
@@ -203,6 +205,8 @@ Anope::string Log::BuildPrefix() const
}
case LOG_CHANNEL:
{
+ if (!this->chan)
+ break;
buffer += "CHANNEL: ";
if (this->u)
buffer += this->u->GetMask() + " " + this->Category + " " + this->chan->name + " ";
@@ -212,12 +216,14 @@ Anope::string Log::BuildPrefix() const
}
case LOG_USER:
{
- buffer += "USERS: " + this->u->GetMask() + " ";
+ if (this->u)
+ buffer += "USERS: " + this->u->GetMask() + " ";
break;
}
case LOG_SERVER:
{
- buffer += "SERVER: " + this->s->GetName() + " (" + this->s->GetDescription() + ") ";
+ if (this->s)
+ buffer += "SERVER: " + this->s->GetName() + " (" + this->s->GetDescription() + ") ";
break;
}
default: