summaryrefslogtreecommitdiff
path: root/src/logger.cpp
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 /src/logger.cpp
parent089c85b27e0674dc8102b15e507ebdd7386eeb87 (diff)
Removed operserv:notifications in favor of log blocks, as well as some other notifiications
Diffstat (limited to 'src/logger.cpp')
-rw-r--r--src/logger.cpp24
1 files changed, 15 insertions, 9 deletions
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: