Introduce "X" snomask for remote *:line messages [patch by jackmcbarn]

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11721 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
danieldg 2009-09-14 17:09:16 +00:00
parent 7c8a2de390
commit 63d3e056b7
17 changed files with 55 additions and 46 deletions

View File

@ -111,7 +111,7 @@ CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User
{
if (ServerInstance->XLines->DelLine(target.c_str(), "E", user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed E-line on %s.",user->nick.c_str(),target.c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed E-line on %s",user->nick.c_str(),target.c_str());
}
else
{

View File

@ -97,7 +97,7 @@ CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User
{
if (ServerInstance->XLines->DelLine(target.c_str(),"G",user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed G-line on %s.",user->nick.c_str(),target.c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed G-line on %s",user->nick.c_str(),target.c_str());
}
else
{

View File

@ -96,7 +96,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
{
if (ServerInstance->XLines->DelLine(target.c_str(),"K",user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed K-line on %s.",user->nick.c_str(),target.c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed K-line on %s",user->nick.c_str(),target.c_str());
}
else
{

View File

@ -111,7 +111,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User
{
if (user->registered == REG_ALL)
{
ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s",
ServerInstance->SNO->WriteGlobalSno('a', "Q-Lined nickname %s from %s!%s@%s: %s",
parameters[0].c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str(), mq->reason.c_str());
}
user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick.c_str(), parameters[0].c_str(), mq->reason.c_str());

View File

@ -23,7 +23,7 @@ class CommandQline : public Command
CommandQline ( Module* parent) : Command(parent,"QLINE",1,3) { flags_needed = 'o'; Penalty = 0; syntax = "<nick> [<duration> :<reason>]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
* @param pcnt The number of parameters passed to the command
* @param user The user issuing the command
* @return A value from CmdResult to indicate command success or failure.
*/
@ -70,7 +70,7 @@ CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User
{
if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "Q", user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick.c_str(),parameters[0].c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed Q-line on %s",user->nick.c_str(),parameters[0].c_str());
}
else
{

View File

@ -91,7 +91,7 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User
{
if (ServerInstance->XLines->DelLine(target.c_str(),"Z",user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Z-line on %s.",user->nick.c_str(),target.c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed Z-line on %s",user->nick.c_str(),target.c_str());
}
else
{

View File

@ -50,7 +50,6 @@ public:
{
ServerInstance->SNO->WriteToSnoMask('x',"Removing expired CBan %s (set by %s %ld seconds ago)",
this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
ServerInstance->PI->SendSNONotice("x", "Removing expired CBan " + assign(this->matchtext) + " (set by " + this->source + " " + ConvToStr(ServerInstance->Time() - this->set_time) + " seconds ago)");
}
const char* Displayable()
@ -99,8 +98,7 @@ class CommandCBan : public Command
{
if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "CBAN", user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s removed CBan on %s.",user->nick.c_str(),parameters[0].c_str());
ServerInstance->PI->SendSNONotice("x", user->nick + " removed CBan on " + parameters[0]);
ServerInstance->SNO->WriteGlobalSno('x', "%s removed CBan on %s.",user->nick.c_str(),parameters[0].c_str());
}
else
{
@ -131,14 +129,12 @@ class CommandCBan : public Command
{
if (!duration)
{
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent CBan for %s: %s", user->nick.c_str(), parameters[0].c_str(), reason);
ServerInstance->PI->SendSNONotice("x", user->nick + " added permenant CBan for " + parameters[0] + ": " + std::string(reason));
ServerInstance->SNO->WriteGlobalSno('x', "%s added permanent CBan for %s: %s", user->nick.c_str(), parameters[0].c_str(), reason);
}
else
{
time_t c_requires_crap = duration + ServerInstance->Time();
ServerInstance->SNO->WriteToSnoMask('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), reason);
ServerInstance->PI->SendSNONotice("x", user->nick + " added timed CBan for " + parameters[0] + ", expires on " + ServerInstance->TimeString(c_requires_crap) + ": " + std::string(reason));
ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), reason);
}
ServerInstance->XLines->ApplyLines();

View File

@ -97,7 +97,9 @@ class ModuleConnectBan : public Module
else
delete zl;
ServerInstance->SNO->WriteToSnoMask('x', "Connect flooding from IP range %s (%d)", u->GetCIDRMask(range), threshold);
ServerInstance->SNO->WriteGlobalSno('x',"Module m_connectban added Z:line on *@%s to expire on %s: Connect flooding",
u->GetCIDRMask(range), ServerInstance->TimeString(zl->expiry).c_str());
ServerInstance->SNO->WriteGlobalSno('a', "Connect flooding from IP range %s (%d)", u->GetCIDRMask(range), threshold);
connects.erase(i);
}
}

View File

@ -129,7 +129,7 @@ class DNSBLResolver : public Resolver
"*", them->GetIPString());
if (ServerInstance->XLines->AddLine(kl,NULL))
{
ServerInstance->SNO->WriteToSnoMask('x',"m_dnsbl added K:line on *@%s to expire on %s (%s).",
ServerInstance->SNO->WriteGlobalSno('x',"K:line added due to DNSBL match on *@%s to expire on %s: %s",
them->GetIPString(), ServerInstance->TimeString(kl->expiry).c_str(), reason.c_str());
ServerInstance->XLines->ApplyLines();
}
@ -143,7 +143,7 @@ class DNSBLResolver : public Resolver
"*", them->GetIPString());
if (ServerInstance->XLines->AddLine(gl,NULL))
{
ServerInstance->SNO->WriteToSnoMask('x',"m_dnsbl added G:line on *@%s to expire on %s (%s).",
ServerInstance->SNO->WriteGlobalSno('x',"G:line added due to DNSBL match on *@%s to expire on %s: %s",
them->GetIPString(), ServerInstance->TimeString(gl->expiry).c_str(), reason.c_str());
ServerInstance->XLines->ApplyLines();
}
@ -157,7 +157,7 @@ class DNSBLResolver : public Resolver
them->GetIPString());
if (ServerInstance->XLines->AddLine(zl,NULL))
{
ServerInstance->SNO->WriteToSnoMask('x',"m_dnsbl added Z:line on *@%s to expire on %s (%s).",
ServerInstance->SNO->WriteGlobalSno('x',"Z:line added due to DNSBL match on *@%s to expire on %s: %s",
them->GetIPString(), ServerInstance->TimeString(zl->expiry).c_str(), reason.c_str());
ServerInstance->XLines->ApplyLines();
}

View File

@ -61,7 +61,7 @@ static bool WriteDatabase()
if (write_error)
{
ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot write to new database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot write to new db: %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('a', "database: cannot write to new db: %s (%d)", strerror(errno), errno);
return false;
}
@ -69,7 +69,7 @@ static bool WriteDatabase()
if (rename(tempname.c_str(), permchannelsconf.c_str()) < 0)
{
ServerInstance->Logs->Log("m_permchannels",DEFAULT, "permchannels: Cannot move new to old database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('a', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno);
return false;
}

View File

@ -39,7 +39,7 @@ class RLine : public XLine
if (!rxengine)
{
ServerInstance->SNO->WriteToSnoMask('x', "Cannot create regexes until engine is set to a loaded provider!");
ServerInstance->SNO->WriteToSnoMask('a', "Cannot create regexes until engine is set to a loaded provider!");
throw ModuleException("Regex engine not set or loaded!");
}
@ -77,7 +77,7 @@ class RLine : public XLine
void DisplayExpiry()
{
ServerInstance->SNO->WriteToSnoMask('x',"Removing expired R-Line %s (set by %s %ld seconds ago)",
ServerInstance->SNO->WriteToSnoMask('x',"Removing expired R-line %s (set by %s %ld seconds ago)",
this->matchtext.c_str(), this->source.c_str(), (long int)(ServerInstance->Time() - this->set_time));
}
@ -142,7 +142,7 @@ class CommandRLine : public Command
}
catch (ModuleException &e)
{
ServerInstance->SNO->WriteToSnoMask('x',"Could not add RLINE: %s", e.GetReason());
ServerInstance->SNO->WriteToSnoMask('a',"Could not add RLINE: %s", e.GetReason());
}
if (r)
@ -151,12 +151,12 @@ class CommandRLine : public Command
{
if (!duration)
{
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent R-Line for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent R-line for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
}
else
{
time_t c_requires_crap = duration + ServerInstance->Time();
ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-Line for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
@ -172,7 +172,7 @@ class CommandRLine : public Command
{
if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed R-Line on %s.",user->nick.c_str(),parameters[0].c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed R-line on %s",user->nick.c_str(),parameters[0].c_str());
}
else
{
@ -261,14 +261,14 @@ class ModuleRLine : public Module
{
if (RegexNameRequest(this, *i).Send() == newrxengine)
{
ServerInstance->SNO->WriteToSnoMask('x', "R-Line now using engine '%s'", RegexEngine.c_str());
ServerInstance->SNO->WriteToSnoMask('a', "R-Line now using engine '%s'", RegexEngine.c_str());
rxengine = *i;
}
}
}
if (!rxengine)
{
ServerInstance->SNO->WriteToSnoMask('x', "WARNING: Regex engine '%s' is not loaded - R-Line functionality disabled until this is corrected.", RegexEngine.c_str());
ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Regex engine '%s' is not loaded - R-Line functionality disabled until this is corrected.", RegexEngine.c_str());
}
}
@ -288,7 +288,7 @@ class ModuleRLine : public Module
std::string rxname = RegexNameRequest(this, mod).Send();
if (rxname == RegexEngine)
{
ServerInstance->SNO->WriteToSnoMask('x', "R-Line now using engine '%s'", RegexEngine.c_str());
ServerInstance->SNO->WriteToSnoMask('a', "R-Line now using engine '%s'", RegexEngine.c_str());
rxengine = mod;
}
}

View File

@ -107,7 +107,7 @@ class CommandShun : public Command
{
if (ServerInstance->XLines->DelLine(target.c_str(), "SHUN", user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed shun on %s.",user->nick.c_str(),target.c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed SHUN on %s",user->nick.c_str(),target.c_str());
}
else
{
@ -149,13 +149,13 @@ class CommandShun : public Command
{
if (!duration)
{
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s: %s",
ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent SHUN for %s: %s",
user->nick.c_str(), target.c_str(), expr.c_str());
}
else
{
time_t c_requires_crap = duration + ServerInstance->Time();
ServerInstance->SNO->WriteToSnoMask('x', "%s added timed shun for %s, expires on %s: %s",
ServerInstance->SNO->WriteToSnoMask('x', "%s added timed SHUN for %s to expire on %s: %s",
user->nick.c_str(), target.c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), expr.c_str());
}

View File

@ -24,7 +24,7 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
{
if (params.size() < 6)
{
this->ServerInstance->SNO->WriteToSnoMask('x',"%s sent me a malformed ADDLINE of type %s.",prefix.c_str(),params[0].c_str());
this->ServerInstance->SNO->WriteToSnoMask('d',"%s sent me a malformed ADDLINE of type %s.",prefix.c_str(),params[0].c_str());
return true;
}
@ -43,7 +43,7 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
if (!xlf)
{
this->ServerInstance->SNO->WriteToSnoMask('x',"%s sent me an unknown ADDLINE type (%s).",setter.c_str(),params[0].c_str());
this->ServerInstance->SNO->WriteToSnoMask('d',"%s sent me an unknown ADDLINE type (%s).",setter.c_str(),params[0].c_str());
return true;
}
@ -54,7 +54,7 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
}
catch (ModuleException &e)
{
this->ServerInstance->SNO->WriteToSnoMask('x',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason());
this->ServerInstance->SNO->WriteToSnoMask('d',"Unable to ADDLINE type %s from %s: %s", params[0].c_str(), setter.c_str(), e.GetReason());
return true;
}
xl->SetCreateTime(atoi(params[3].c_str()));
@ -62,12 +62,12 @@ bool TreeSocket::AddLine(const std::string &prefix, parameterlist &params)
{
if (xl->duration)
{
this->ServerInstance->SNO->WriteToSnoMask('x',"%s added %s%s on %s to expire on %s (%s).",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "",
this->ServerInstance->SNO->WriteToSnoMask('X',"%s added %s%s on %s to expire on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "",
params[1].c_str(),ServerInstance->TimeString(xl->expiry).c_str(),params[5].c_str());
}
else
{
this->ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent %s%s on %s (%s).",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "",
this->ServerInstance->SNO->WriteToSnoMask('X',"%s added permanent %s%s on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "",
params[1].c_str(),params[5].c_str());
}
params[5] = ":" + params[5];

View File

@ -42,8 +42,8 @@ bool TreeSocket::DelLine(const std::string &prefix, parameterlist &params)
/* NOTE: No check needed on 'user', this function safely handles NULL */
if (ServerInstance->XLines->DelLine(params[1].c_str(), params[0], user))
{
this->ServerInstance->SNO->WriteToSnoMask('x',"%s removed %s%s on %s.", setter.c_str(),
params[0].c_str(), params[0].length() == 1 ? "LINE" : "", params[1].c_str());
this->ServerInstance->SNO->WriteToSnoMask('X',"%s removed %s%s on %s", setter.c_str(),
params[0].c_str(), params[0].length() == 1 ? "-line" : "", params[1].c_str());
Utils->DoOneToAllButSender(prefix,"DELLINE", params, prefix);
}
return true;

View File

@ -100,7 +100,7 @@ class CommandSvshold : public Command
{
if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SVSHOLD", user))
{
ServerInstance->SNO->WriteToSnoMask('x',"%s Removed SVSHOLD on %s.",user->nick.c_str(),parameters[0].c_str());
ServerInstance->SNO->WriteToSnoMask('x',"%s removed SVSHOLD on %s",user->nick.c_str(),parameters[0].c_str());
}
else
{
@ -128,6 +128,16 @@ class CommandSvshold : public Command
{
if (ServerInstance->XLines->AddLine(r, user))
{
if (!duration)
{
ServerInstance->SNO->WriteGlobalSno('x', "%s added permanent SVSHOLD for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
}
else
{
time_t c_requires_crap = duration + ServerInstance->Time();
ServerInstance->SNO->WriteGlobalSno('x', "%s added timed SVSHOLD for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
}
else

View File

@ -97,7 +97,7 @@ class ModuleXLineDB : public Module
if (!f)
{
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot create database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot create new db: %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('a', "database: cannot create new db: %s (%d)", strerror(errno), errno);
return false;
}
@ -129,7 +129,7 @@ class ModuleXLineDB : public Module
if (write_error)
{
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot write to new database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot write to new db: %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('a', "database: cannot write to new db: %s (%d)", strerror(errno), errno);
return false;
}
@ -137,7 +137,7 @@ class ModuleXLineDB : public Module
if (rename("xline.db.new", "xline.db") < 0)
{
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot move new to old database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('a', "database: cannot replace old with new db: %s (%d)", strerror(errno), errno);
return false;
}
@ -162,7 +162,7 @@ class ModuleXLineDB : public Module
{
/* this might be slightly more problematic. */
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: Cannot read database! %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('x', "database: cannot read db: %s (%d)", strerror(errno), errno);
ServerInstance->SNO->WriteToSnoMask('a', "database: cannot read db: %s (%d)", strerror(errno), errno);
return false;
}
}
@ -207,7 +207,7 @@ class ModuleXLineDB : public Module
{
fclose(f);
ServerInstance->Logs->Log("m_xline_db",DEBUG, "xlinedb: I got database version %s - I don't understand it", command_p[1].c_str());
ServerInstance->SNO->WriteToSnoMask('x', "database: I got a database version (%s) I don't understand", command_p[1].c_str());
ServerInstance->SNO->WriteToSnoMask('a', "database: I got a database version (%s) I don't understand", command_p[1].c_str());
return false;
}
}
@ -218,7 +218,7 @@ class ModuleXLineDB : public Module
if (!xlf)
{
ServerInstance->SNO->WriteToSnoMask('x', "database: Unknown line type (%s).", command_p[1].c_str());
ServerInstance->SNO->WriteToSnoMask('a', "database: Unknown line type (%s).", command_p[1].c_str());
continue;
}

View File

@ -125,6 +125,7 @@ void SnomaskManager::SetupDefaults()
this->EnableSnomask('A',"REMOTEANNOUNCEMENT"); /* formerly WriteOpers() - generic notices to all opers */
this->EnableSnomask('d',"DEBUG"); /* Debug notices */
this->EnableSnomask('x',"XLINE"); /* Xline notice (g/z/q/k/e) */
this->EnableSnomask('X',"REMOTEXLINE"); /* Remove Xline notice (g/z/q/k/e) */
this->EnableSnomask('t',"STATS"); /* Local or remote stats request */
this->EnableSnomask('f',"FLOOD"); /* Flooding notices */
}