mirror of
https://github.com/anope/anope.git
synced 2026-07-02 03:26:39 +02:00
Fix logging for log type 'other'.
os_ignore: Log expired ignores to the normal log level. cs_drop: Allow Services Operators to actually drop channels in Read-Only mode. os_akill, os_sxline, cs_akick: Log deletions by number.
This commit is contained in:
@@ -222,10 +222,11 @@ class CommandCSAccess : public Command
|
||||
Command *c;
|
||||
unsigned deleted;
|
||||
Anope::string Nicks;
|
||||
bool Denied;
|
||||
bool denied;
|
||||
bool override;
|
||||
AccessGroup ag;
|
||||
public:
|
||||
AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), Denied(false), override(false)
|
||||
AccessDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false), ag(source.AccessFor(ci))
|
||||
{
|
||||
if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify"))
|
||||
this->override = true;
|
||||
@@ -233,7 +234,7 @@ class CommandCSAccess : public Command
|
||||
|
||||
~AccessDelCallback()
|
||||
{
|
||||
if (Denied && !deleted)
|
||||
if (denied && !deleted)
|
||||
source.Reply(ACCESS_DENIED);
|
||||
else if (!deleted)
|
||||
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
|
||||
@@ -255,12 +256,11 @@ class CommandCSAccess : public Command
|
||||
|
||||
ChanAccess *access = ci->GetAccess(Number - 1);
|
||||
|
||||
AccessGroup u_access = source.AccessFor(ci);
|
||||
const ChanAccess *u_highest = u_access.Highest();
|
||||
const ChanAccess *u_highest = ag.Highest();
|
||||
|
||||
if ((!u_highest || *u_highest <= *access) && !u_access.founder && !this->override && !access->mask.equals_ci(source.nc->display))
|
||||
if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && !access->mask.equals_ci(source.nc->display))
|
||||
{
|
||||
Denied = true;
|
||||
denied = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,16 +187,14 @@ class CommandCSAKick : public Command
|
||||
ChannelInfo *ci;
|
||||
Command *c;
|
||||
unsigned deleted;
|
||||
AccessGroup ag;
|
||||
public:
|
||||
AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0)
|
||||
AkickDelCallback(CommandSource &_source, ChannelInfo *_ci, Command *_c, const Anope::string &list) : NumberList(list, true), source(_source), ci(_ci), c(_c), deleted(0), ag(source.AccessFor(ci))
|
||||
{
|
||||
}
|
||||
|
||||
~AkickDelCallback()
|
||||
{
|
||||
bool override = !source.AccessFor(ci).HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << deleted << (deleted == 1 ? " entry" : " entries");
|
||||
|
||||
if (!deleted)
|
||||
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
|
||||
else if (deleted == 1)
|
||||
@@ -210,7 +208,12 @@ class CommandCSAKick : public Command
|
||||
if (!number || number > ci->GetAkickCount())
|
||||
return;
|
||||
|
||||
FOREACH_MOD(OnAkickDel, (source, ci, ci->GetAkick(number - 1)));
|
||||
const AutoKick *akick = ci->GetAkick(number - 1);
|
||||
|
||||
FOREACH_MOD(OnAkickDel, (source, ci, akick));
|
||||
|
||||
bool override = !ag.HasPriv("AKICK");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << (akick->nc ? akick->nc->display : akick->mask);
|
||||
|
||||
++deleted;
|
||||
ci->EraseAkick(number - 1);
|
||||
|
||||
@@ -24,7 +24,7 @@ class CommandCSDrop : public Command
|
||||
{
|
||||
const Anope::string &chan = params[0];
|
||||
|
||||
if (Anope::ReadOnly)
|
||||
if (Anope::ReadOnly && !source.HasPriv("chanserv/administration"))
|
||||
{
|
||||
source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); // XXX: READ_ONLY_MODE?
|
||||
return;
|
||||
|
||||
@@ -1087,13 +1087,13 @@ class CommandNSSASetNoexpire : public Command
|
||||
|
||||
if (param.equals_ci("ON"))
|
||||
{
|
||||
Log(LOG_ADMIN, source, this) << "to enable noexpire " << na->nc->display;
|
||||
Log(LOG_ADMIN, source, this) << "to enable noexpire for " << na->nc->display;
|
||||
na->Extend<bool>("NS_NO_EXPIRE");
|
||||
source.Reply(_("Nick %s \002will not\002 expire."), na->nick.c_str());
|
||||
}
|
||||
else if (param.equals_ci("OFF"))
|
||||
{
|
||||
Log(LOG_ADMIN, source, this) << "to disable noexpire " << na->nc->display;
|
||||
Log(LOG_ADMIN, source, this) << "to disable noexpire for " << na->nc->display;
|
||||
na->Shrink<bool>("NS_NO_EXPIRE");
|
||||
source.Reply(_("Nick %s \002will\002 expire."), na->nick.c_str());
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ class NSSuspend : public Module
|
||||
na->last_seen = Anope::CurTime;
|
||||
suspend.Unset(na->nc);
|
||||
|
||||
Log(LOG_NORMAL, "expire", Config->GetClient("NickServ")) << "Expiring suspend for " << na->nick;
|
||||
Log(LOG_NORMAL, "nickserv/expire", Config->GetClient("NickServ")) << "Expiring suspend for " << na->nick;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class MyForbidService : public ForbidService
|
||||
else if (d->type == FT_EMAIL)
|
||||
ftype = "email";
|
||||
|
||||
Log(LOG_NORMAL, "expire/forbid") << "Expiring forbid for " << d->mask << " type " << ftype;
|
||||
Log(LOG_NORMAL, "expire/forbid", Config->GetClient("OperServ")) << "Expiring forbid for " << d->mask << " type " << ftype;
|
||||
this->forbids(j).erase(this->forbids(j).begin() + i - 1);
|
||||
delete d;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class CommandOSForbid : public Command
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "to add a forbid on " << entry << " of type " << subcommand;
|
||||
source.Reply(_("Added a forbid on %s to expire on %s."), entry.c_str(), d->expires ? Anope::strftime(d->expires, source.GetAccount()).c_str() : "never");
|
||||
source.Reply(_("Added a forbid on %s of type %s to expire on %s."), entry.c_str(), type.c_str(), d->expires ? Anope::strftime(d->expires, source.GetAccount()).c_str() : "never");
|
||||
|
||||
/* apply forbid */
|
||||
switch (ftype)
|
||||
|
||||
@@ -105,7 +105,7 @@ class OSIgnoreService : public IgnoreService
|
||||
|
||||
if (id.time && id.time <= Anope::CurTime)
|
||||
{
|
||||
Log(LOG_DEBUG) << "Expiring ignore entry " << id.mask;
|
||||
Log(LOG_NORMAL, "expire/ignore", Config->GetClient("OperServ")) << "Expiring ignore entry " << id.mask;
|
||||
this->ignores.erase(ign);
|
||||
}
|
||||
else
|
||||
@@ -212,7 +212,7 @@ class CommandOSIgnore : public Command
|
||||
|
||||
if (id.time && id.time <= Anope::CurTime)
|
||||
{
|
||||
Log(LOG_DEBUG) << "Expiring ignore entry " << id.mask;
|
||||
Log(LOG_NORMAL, "expire/ignore", Config->GetClient("OperServ")) << "Expiring ignore entry " << id.mask;
|
||||
ignores.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,8 +128,9 @@ class ExceptionDelCallback : public NumberList
|
||||
protected:
|
||||
CommandSource &source;
|
||||
unsigned deleted;
|
||||
Command *cmd;
|
||||
public:
|
||||
ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist) : NumberList(numlist, true), source(_source), deleted(0)
|
||||
ExceptionDelCallback(CommandSource &_source, const Anope::string &numlist, Command *c) : NumberList(numlist, true), source(_source), deleted(0), cmd(c)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -148,8 +149,9 @@ class ExceptionDelCallback : public NumberList
|
||||
if (!number || number > session_service->GetExceptions().size())
|
||||
return;
|
||||
|
||||
++deleted;
|
||||
Log(LOG_ADMIN, source, cmd) << "to remove the session limit exception for " << session_service->GetExceptions()[number - 1]->mask;
|
||||
|
||||
++deleted;
|
||||
DoDel(source, number - 1);
|
||||
}
|
||||
|
||||
@@ -393,7 +395,7 @@ class CommandOSException : public Command
|
||||
|
||||
if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
|
||||
{
|
||||
ExceptionDelCallback list(source, mask);
|
||||
ExceptionDelCallback list(source, mask, this);
|
||||
list.Process();
|
||||
}
|
||||
else
|
||||
@@ -402,7 +404,7 @@ class CommandOSException : public Command
|
||||
for (; i < end; ++i)
|
||||
if (mask.equals_ci(session_service->GetExceptions()[i]->mask))
|
||||
{
|
||||
Log(LOG_ADMIN, source, this) << "to remove session limit exception for " << mask;
|
||||
Log(LOG_ADMIN, source, this) << "to remove the session limit exception for " << mask;
|
||||
ExceptionDelCallback::DoDel(source, i);
|
||||
source.Reply(_("\002%s\002 deleted from session-limit exception list."), mask.c_str());
|
||||
break;
|
||||
|
||||
@@ -25,11 +25,11 @@ class SXLineDelCallback : public NumberList
|
||||
~SXLineDelCallback()
|
||||
{
|
||||
if (!deleted)
|
||||
source.Reply(_("No matching entries on the %s list."), this->command->name.c_str());
|
||||
source.Reply(_("No matching entries on the %s list."), source.command.c_str());
|
||||
else if (deleted == 1)
|
||||
source.Reply(_("Deleted 1 entry from the %s list."), this->command->name.c_str());
|
||||
source.Reply(_("Deleted 1 entry from the %s list."), source.command.c_str());
|
||||
else
|
||||
source.Reply(_("Deleted %d entries from the %s list."), deleted, this->command->name.c_str());
|
||||
source.Reply(_("Deleted %d entries from the %s list."), deleted, source.command.c_str());
|
||||
}
|
||||
|
||||
void HandleNumber(unsigned number) anope_override
|
||||
@@ -42,6 +42,8 @@ class SXLineDelCallback : public NumberList
|
||||
if (!x)
|
||||
return;
|
||||
|
||||
Log(LOG_ADMIN, source, command) << "to remove " << x->mask << " from the list";
|
||||
|
||||
++deleted;
|
||||
DoDel(this->xlm, source, x);
|
||||
}
|
||||
|
||||
@@ -162,13 +162,13 @@ class ChanServCore : public Module, public ChanServService
|
||||
|
||||
if (newowner)
|
||||
{
|
||||
Log(LOG_NORMAL, "chanserv/expire") << "Transferring foundership of " << ci->name << " from deleted nick " << nc->display << " to " << newowner->display;
|
||||
Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Transferring foundership of " << ci->name << " from deleted nick " << nc->display << " to " << newowner->display;
|
||||
ci->SetFounder(newowner);
|
||||
ci->SetSuccessor(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(LOG_NORMAL, "chanserv/expire") << "Deleting channel " << ci->name << " owned by deleted nick " << nc->display;
|
||||
Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Deleting channel " << ci->name << " owned by deleted nick " << nc->display;
|
||||
|
||||
delete ci;
|
||||
continue;
|
||||
@@ -365,7 +365,7 @@ class ChanServCore : public Module, public ChanServService
|
||||
|
||||
if (expire)
|
||||
{
|
||||
Log(LOG_NORMAL, "chanserv/expire") << "Expiring channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")";
|
||||
Log(LOG_NORMAL, "chanserv/expire", ChanServ) << "Expiring channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")";
|
||||
FOREACH_MOD(OnChanExpire, (ci));
|
||||
delete ci;
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ class NickServCore : public Module, public NickServService
|
||||
|
||||
void OnDelCore(NickCore *nc) anope_override
|
||||
{
|
||||
Log(NickServ, "nick") << "deleting nickname group " << nc->display;
|
||||
Log(NickServ, "nick") << "Deleting nickname group " << nc->display;
|
||||
|
||||
/* Clean up this nick core from any users online */
|
||||
for (std::list<User *>::iterator it = nc->users.begin(); it != nc->users.end();)
|
||||
@@ -509,7 +509,7 @@ class NickServCore : public Module, public NickServService
|
||||
|
||||
if (expire)
|
||||
{
|
||||
Log(LOG_NORMAL, "expire") << "Expiring nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
|
||||
Log(LOG_NORMAL, "nickserv/expire", NickServ) << "Expiring nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
|
||||
FOREACH_MOD(OnNickExpire, (na));
|
||||
delete na;
|
||||
}
|
||||
|
||||
+1
-1
@@ -420,7 +420,7 @@ Conf::Conf() : Block("")
|
||||
spacesepstream(log->Get<const Anope::string>("servers")).GetTokens(l.servers);
|
||||
spacesepstream(log->Get<const Anope::string>("channels")).GetTokens(l.channels);
|
||||
spacesepstream(log->Get<const Anope::string>("users")).GetTokens(l.users);
|
||||
spacesepstream(log->Get<const Anope::string>("normal")).GetTokens(l.normal);
|
||||
spacesepstream(log->Get<const Anope::string>("other")).GetTokens(l.normal);
|
||||
|
||||
this->LogInfos.push_back(l);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user