summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol')
-rw-r--r--modules/protocol/bahamut.cpp7
-rw-r--r--modules/protocol/hybrid.cpp6
-rw-r--r--modules/protocol/inspircd20.cpp34
-rw-r--r--modules/protocol/ngircd.cpp17
-rw-r--r--modules/protocol/rfc1459.cpp17
-rw-r--r--modules/protocol/unreal.cpp9
6 files changed, 46 insertions, 44 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 66e7cca61..3814cba05 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -50,7 +50,8 @@ void bahamut::senders::Akill::Send(User* u, XLine* x)
x->SetID(old->GetID());
old->GetManager()->AddXLine(x);
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask();
+ Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"),
+ x->GetMask(), u->GetMask(), u->realname, old->GetMask());
}
/* ZLine if we can instead */
@@ -354,7 +355,7 @@ void bahamut::Nick::Run(MessageSource &source, const std::vector<Anope::string>
Server *s = Server::Find(params[6]);
if (s == nullptr)
{
- Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[6] << "?";
+ Anope::Logger.Debug("User {0} introduced from non-existent server {1}", params[0], params[6]);
return;
}
@@ -436,7 +437,7 @@ void bahamut::SJoin::Run(MessageSource &source, const std::vector<Anope::string>
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1];
+ Anope::Logger.Log("SJOIN for non-existent user {0} on {1}", buf, params[1]);
continue;
}
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index 2cb508f0e..e296229c3 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -58,8 +58,8 @@ void hybrid::senders::Akill::Send(User* u, XLine* x)
old->GetManager()->AddXLine(xl);
x = xl;
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#"
- << u->realname << " matches " << old->GetMask();
+ Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"),
+ x->GetMask(), u->GetMask(), u->realname, old->GetMask());
}
/* Calculate the time left before this would expire, capping it at 2 days */
@@ -451,7 +451,7 @@ void hybrid::SJoin::Run(MessageSource &source, const std::vector<Anope::string>
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1];
+ Anope::Logger.Debug("SJOIN for non-existent user {0} on {1}", buf, params[1]);
continue;
}
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 381596ee6..e53a88eaa 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -78,7 +78,8 @@ void inspircd20::senders::Akill::Send(User* u, XLine* x)
x->SetReason(old->GetReason());
old->GetManager()->AddXLine(x);
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask();
+ Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"),
+ x->GetMask(), u->GetMask(), u->realname, old->GetMask());
}
/* ZLine if we can instead */
@@ -360,7 +361,7 @@ void inspircd20::senders::Wallops::Send(const MessageSource &source, const Anope
void inspircd20::Proto::SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent)
{
if (!Servers::Capab.count("CHGIDENT"))
- Log() << "CHGIDENT not loaded!";
+ Anope::Logger.Log("CHGIDENT not loaded!");
else
Uplink::Send(Me, "CHGIDENT", nick, vIdent);
}
@@ -368,7 +369,7 @@ void inspircd20::Proto::SendChgIdentInternal(const Anope::string &nick, const An
void inspircd20::Proto::SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost)
{
if (!Servers::Capab.count("CHGHOST"))
- Log() << "CHGHOST not loaded!";
+ Anope::Logger.Log("CHGHOST not loaded!");
else
Uplink::Send(Me, "CHGHOST", nick, vhost);
}
@@ -666,14 +667,16 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri
ChannelMode *cm = ModeManager::FindChannelModeByChar(modechar[0]);
if (cm == nullptr)
{
- Log(this->GetOwner()) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar;
+ this->GetOwner()->logger.Log("Warning: Uplink has unknown channel mode {0}={1}",
+ modename, modechar);
continue;
}
char modesymbol = cm->type == MODE_STATUS ? (anope_dynamic_static_cast<ChannelModeStatus *>(cm))->symbol : 0;
if (symbol != modesymbol)
{
- Log(this->GetOwner()) << "Warning: Channel mode " << modename << " has a misconfigured status character";
+ this->GetOwner()->logger.Log("Warning: Channel mode {0} has a misconfigured status character",
+ modename);
continue;
}
}
@@ -697,7 +700,8 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri
UserMode *um = ModeManager::FindUserModeByChar(modechar[0]);
if (um == nullptr)
{
- Log(this->GetOwner()) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar;
+ this->GetOwner()->logger.Log("Warning: Uplink has unknown user mode {0}={1}",
+ modename, modechar);
continue;
}
}
@@ -716,7 +720,9 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri
Servers::Capab.insert("RLINE");
const Anope::string &regexengine = Config->GetBlock("options")->Get<Anope::string>("regexengine");
if (!regexengine.empty() && module.length() > 11 && regexengine != module.substr(11))
- Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << regexengine << ". This may cause inconsistencies.";
+ this->GetOwner()->logger.Log("Warning: InspIRCd is using regex engine {0}, but we have {1}. "
+ "This may cause inconsistencies.",
+ module.substr(11), regexengine);
}
else if (module.equals_cs("m_topiclock.so"))
Servers::Capab.insert("TOPICLOCK");
@@ -769,11 +775,11 @@ void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::stri
return;
}
if (!IRCD->CanSVSHold)
- Log() << "SVSHOLD missing, Usage disabled until module is loaded.";
+ this->GetOwner()->logger.Log("SVSHOLD missing, Usage disabled until module is loaded.");
if (!Servers::Capab.count("CHGHOST"))
- Log() << "CHGHOST missing, Usage disabled until module is loaded.";
+ this->GetOwner()->logger.Log("CHGHOST missing, Usage disabled until module is loaded.");
if (!Servers::Capab.count("CHGIDENT"))
- Log() << "CHGIDENT missing, Usage disabled until module is loaded.";
+ this->GetOwner()->logger.Log("CHGIDENT missing, Usage disabled until module is loaded.");
}
rfc1459::Capab::Run(source, params);
@@ -824,7 +830,7 @@ void inspircd20::Endburst::Run(MessageSource &source, const std::vector<Anope::s
{
Server *s = source.GetServer();
- Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName();
+ s->logger.Debug("Processed ENDBURST for {0}", s->GetName());
s->Sync(true);
}
@@ -874,7 +880,7 @@ void inspircd20::FJoin::Run(MessageSource &source, const std::vector<Anope::stri
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "FJOIN for non-existent user " << buf << " on " << params[0];
+ this->GetOwner()->logger.Debug("FJOIN for non-existent user {0} on {1}", buf, params[0]);
continue;
}
@@ -1044,7 +1050,7 @@ void inspircd20::Metadata::Run(MessageSource &source, const std::vector<Anope::s
if (required)
{
if (!plus)
- Log() << "Warning: InspIRCd unloaded module " << module << ", Anope won't function correctly without it";
+ this->GetOwner()->logger.Log("Warning: InspIRCd unloaded module {0}, Anope won't function correctly without it");
}
else
{
@@ -1053,7 +1059,7 @@ void inspircd20::Metadata::Run(MessageSource &source, const std::vector<Anope::s
else
Servers::Capab.erase(capab);
- Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " module " << module << ", adjusted functionality";
+ this->GetOwner()->logger.Log("InspIRCd {0} module {1}, adjusted functionality", plus ? "loaded" : "unloaded", module);
}
}
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 7712aec8f..ce18cbbf7 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -131,7 +131,7 @@ void ngircd::Numeric005::Run(MessageSource &source, const std::vector<Anope::str
unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen");
if (len != newlen)
{
- Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len;
+ Anope::Logger.Log("Warning: NICKLEN is {0} but networkinfo:nicklen is {1}", newlen, len);
}
}
}
@@ -240,10 +240,8 @@ void ngircd::Metadata::Run(MessageSource &source, const std::vector<Anope::strin
{
User *u = User::Find(params[0]);
if (!u)
- {
- Log() << "received METADATA for non-existent user " << params[0];
return;
- }
+
if (params[1].equals_cs("accountname"))
{
NickServ::Account *nc = NickServ::FindAccount(params[2]);
@@ -339,15 +337,10 @@ void ngircd::Nick::Run(MessageSource &source, const std::vector<Anope::string> &
Server *s = Server::Find(params[4]);
if (s == nullptr)
{
- Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[4] << "?";
+ Anope::Logger.Debug("User {0} introduced from non-existent server {1}", params[0], params[4]);
return;
}
User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL);
- Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << ".";
- }
- else
- {
- Log(LOG_DEBUG) << "Received NICK with invalid number of parameters. source = " << source.GetName() << "params[0] = " << params[0] << "params.size() = " << params.size();
}
}
@@ -374,7 +367,7 @@ void ngircd::NJoin::Run(MessageSource &source, const std::vector<Anope::string>
rfc1459::Join::SJoinUser sju;
/* Get prefixes from the nick */
- for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));)
+ for (char ch; !buf.empty() && (ch = ModeManager::GetStatusChar(buf[0]));)
{
buf.erase(buf.begin());
sju.first.AddMode(ch);
@@ -383,7 +376,7 @@ void ngircd::NJoin::Run(MessageSource &source, const std::vector<Anope::string>
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "NJOIN for non-existent user " << buf << " on " << params[0];
+ Anope::Logger.Debug("NJOIN for non-existent user {0} on {1}", buf, params[0]);
continue;
}
users.push_back(sju);
diff --git a/modules/protocol/rfc1459.cpp b/modules/protocol/rfc1459.cpp
index 1405e121e..d1ac3eeaf 100644
--- a/modules/protocol/rfc1459.cpp
+++ b/modules/protocol/rfc1459.cpp
@@ -165,14 +165,15 @@ void senders::Wallops::Send(const MessageSource &source, const Anope::string &ms
void Away::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
+ User *u = source.GetUser();
const Anope::string &msg = !params.empty() ? params[0] : "";
- EventManager::Get()->Dispatch(&Event::UserAway::OnUserAway, source.GetUser(), msg);
+ EventManager::Get()->Dispatch(&Event::UserAway::OnUserAway, u, msg);
if (!msg.empty())
- Log(source.GetUser(), "away") << "is now away: " << msg;
+ u->logger.Category("away").Log(_("{0} is now away: {1}"), u->GetMask(), msg);
else
- Log(source.GetUser(), "away") << "is no longer away";
+ u->logger.Category("away").Log(_("{0} is no longer away"), u->GetMask());
}
void Capab::Run(MessageSource &source, const std::vector<Anope::string> &params)
@@ -191,7 +192,7 @@ void Capab::Run(MessageSource &source, const std::vector<Anope::string> &params)
void Error::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
- Log(LOG_TERMINAL) << "ERROR: " << params[0];
+ Anope::Logger.Terminal("ERROR: {0}", params[0]);
Anope::QuitReason = "Received ERROR from uplink: " + params[0];
Anope::Quitting = true;
}
@@ -430,7 +431,7 @@ void Part::Run(MessageSource &source, const std::vector<Anope::string> &params)
if (!c || !u->FindChannel(c))
continue;
- Log(u, c, "part") << "Reason: " << (!reason.empty() ? reason : "No reason");
+ c->logger.User(u).Category("part").Log(_("{0} parted {1}: {2}"), u->GetMask(), c->GetName(), !reason.empty() ? reason : "No reason");
EventManager::Get()->Dispatch(&Event::PrePartChannel::OnPrePartChannel, u, c);
c->DeleteUser(u);
@@ -478,7 +479,7 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> &param
ServiceBot *bi = ServiceBot::Find(receiver);
if (!bi)
return;
- Log(LOG_DEBUG) << "Ignored PRIVMSG without @ from " << u->nick;
+ bi->logger.Debug("Ignored PRIVMSG without @ from {0}", u->nick);
u->SendMessage(bi, _("\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead."), bi->nick.c_str(), bi->nick.c_str(), Me->GetName().c_str(), bi->nick.c_str());
return;
}
@@ -518,7 +519,7 @@ void Quit::Run(MessageSource &source, const std::vector<Anope::string> &params)
const Anope::string &reason = params[0];
User *user = source.GetUser();
- Log(user, "quit") << "quit (Reason: " << (!reason.empty() ? reason : "no reason") << ")";
+ user->logger.Category("quit").Log(_("{0} quit: {1}"), user->GetMask(), (!reason.empty() ? reason : "no reason"));
user->Quit(reason);
}
@@ -529,7 +530,7 @@ void SQuit::Run(MessageSource &source, const std::vector<Anope::string> &params)
if (!s)
{
- Log(LOG_DEBUG) << "SQUIT for nonexistent server " << params[0];
+ Anope::Logger.Debug("SQUIT for nonexistent server {0}", params[0]);
return;
}
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index f319268b7..fd6e31875 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -58,7 +58,8 @@ void unreal::senders::Akill::Send(User* u, XLine* x)
old->GetManager()->AddXLine(xl);
x = xl;
- Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask();
+ Anope::Logger.Bot("OperServ").Category("akill").Log(_("AKILL: Added an akill for {0} because {1}#{2} matches {3}"),
+ x->GetMask(), u->GetMask(), u->realname, old->GetMask());
}
/* ZLine if we can instead */
@@ -731,7 +732,7 @@ void unreal::Nick::Run(MessageSource &source, const std::vector<Anope::string> &
Server *s = Server::Find(params[5]);
if (s == NULL)
{
- Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[5] << "?";
+ Anope::Logger.Debug("User {0} introduced from non-existent server {1}", params[0], params[5]);
return;
}
@@ -912,7 +913,7 @@ void unreal::SJoin::Run(MessageSource &source, const std::vector<Anope::string>
rfc1459::Join::SJoinUser sju;
/* Get prefixes from the nick */
- for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));)
+ for (char ch; !buf.empty() && (ch = ModeManager::GetStatusChar(buf[0]));)
{
sju.first.AddMode(ch);
buf.erase(buf.begin());
@@ -921,7 +922,7 @@ void unreal::SJoin::Run(MessageSource &source, const std::vector<Anope::string>
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1];
+ Anope::Logger.Debug("SJOIN for non-existent user {0} on {1}", buf, params[1]);
continue;
}