1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 02:43:12 +02:00

Allow userless command sources

This commit is contained in:
Adam
2012-06-18 05:04:30 -04:00
parent 873d4287de
commit 2dec8e767a
153 changed files with 1029 additions and 1060 deletions
+6 -7
View File
@@ -28,11 +28,10 @@ public:
{
const Anope::string &channel = params[0];
User *u = source.u;
ChannelInfo *ci = cs_findchan(channel);
if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str());
else if (!ci->AccessFor(u).HasPriv("SET") && !u->HasPriv("chanserv/set"))
else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/set"))
source.Reply(ACCESS_DENIED);
else if (params.size() == 1)
{
@@ -108,7 +107,7 @@ public:
return;
}
bool override = !ci->AccessFor(u).HasPriv("SET");
bool override = !source.AccessFor(ci).HasPriv("SET");
for (unsigned i = ci->log_settings->size(); i > 0; --i)
{
@@ -120,13 +119,13 @@ public:
{
log->destroy();
ci->log_settings->erase(ci->log_settings->begin() + i - 1);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
source.Reply(_("Logging for command %s on %s with log method %s%s%s has been removed."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
}
else
{
log->extra = extra;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to change logging for " << command << " to method " << method << (extra == "" ? "" : " ") << extra;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to change logging for " << command << " to method " << method << (extra == "" ? "" : " ") << extra;
source.Reply(_("Logging changed for command %s on %s, now using log method %s%s%s."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
}
return;
@@ -141,10 +140,10 @@ public:
log->method = method;
log->extra = extra;
log->created = Anope::CurTime;
log->creator = u->nick;
log->creator = source.GetNick();
ci->log_settings->push_back(log);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
source.Reply(_("Logging is now active for command %s on %s, using log method %s%s%s."), command_name.c_str(), bi->nick.c_str(), method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str());
}