mirror of
https://github.com/anope/anope.git
synced 2026-06-25 15:06:37 +02:00
Fix cs_mode lock reply if nothing is done
Fix not clearing forbids when os_forbid is unloaded Apply nick and chan forbids when added Fix loading forbids until after the service is constructed
This commit is contained in:
+1
-1
@@ -864,7 +864,7 @@ opertype
|
||||
inherits = "Helper, Another Helper"
|
||||
|
||||
/* What commands (see above) this opertype may use */
|
||||
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
|
||||
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/kick operserv/ignore operserv/snline"
|
||||
|
||||
/* What privs (see above) this opertype has */
|
||||
privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm"
|
||||
|
||||
@@ -353,8 +353,11 @@ class CommandCSMode : public Command
|
||||
neg.clear();
|
||||
Anope::string reply = pos + neg + pos_params + neg_params;
|
||||
|
||||
source.Reply(_("%s locked on %s."), reply.c_str(), ci->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << reply;
|
||||
if (!reply.empty())
|
||||
{
|
||||
source.Reply(_("%s locked on %s."), reply.c_str(), ci->name.c_str());
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << reply;
|
||||
}
|
||||
|
||||
if (ci->c)
|
||||
ci->c->CheckModes();
|
||||
|
||||
@@ -23,6 +23,13 @@ class MyForbidService : public ForbidService
|
||||
public:
|
||||
MyForbidService(Module *m) : ForbidService(m), forbid_data("ForbidData") { }
|
||||
|
||||
~MyForbidService()
|
||||
{
|
||||
std::vector<ForbidData *> f = GetForbids();
|
||||
for (unsigned i = 0; i < f.size(); ++i)
|
||||
delete f[i];
|
||||
}
|
||||
|
||||
void AddForbid(ForbidData *d) anope_override
|
||||
{
|
||||
this->forbids(d->type).push_back(d);
|
||||
@@ -154,6 +161,58 @@ class CommandOSForbid : public Command
|
||||
|
||||
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).c_str() : "never");
|
||||
|
||||
/* apply forbid */
|
||||
switch (ftype)
|
||||
{
|
||||
case FT_NICK:
|
||||
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
|
||||
module->OnUserNickChange(it->second, "");
|
||||
break;
|
||||
case FT_CHAN:
|
||||
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end;)
|
||||
{
|
||||
Channel *c = it->second;
|
||||
++it;
|
||||
|
||||
d = this->fs->FindForbid(c->name, FT_CHAN);
|
||||
if (d == NULL)
|
||||
continue;
|
||||
|
||||
ServiceReference<ChanServService> chanserv("ChanServService", "ChanServ");
|
||||
BotInfo *OperServ = Config->GetClient("OperServ");
|
||||
if (IRCD->CanSQLineChannel && OperServ)
|
||||
{
|
||||
time_t inhabit = Config->GetModule("chanserv")->Get<time_t>("inhabit", "15s");
|
||||
XLine x(c->name, OperServ->nick, Anope::CurTime + inhabit, d->reason);
|
||||
IRCD->SendSQLine(NULL, &x);
|
||||
}
|
||||
else if (chanserv)
|
||||
{
|
||||
chanserv->Hold(c);
|
||||
}
|
||||
|
||||
for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end;)
|
||||
{
|
||||
User *u = cit->first;
|
||||
++cit;
|
||||
|
||||
if (u->server == Me || u->HasMode("OPER"))
|
||||
continue;
|
||||
|
||||
if (d->reason.empty())
|
||||
reason = Language::Translate(u, _("This channel has been forbidden."));
|
||||
else
|
||||
reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str());
|
||||
|
||||
c->Kick(source.service, u, "%s", reason.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if (command.equals_ci("DEL") && params.size() > 2 && ftype != FT_SIZE)
|
||||
{
|
||||
@@ -242,13 +301,13 @@ class CommandOSForbid : public Command
|
||||
|
||||
class OSForbid : public Module
|
||||
{
|
||||
Serialize::Type forbiddata_type;
|
||||
MyForbidService forbidService;
|
||||
Serialize::Type forbiddata_type;
|
||||
CommandOSForbid commandosforbid;
|
||||
|
||||
public:
|
||||
OSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
|
||||
forbiddata_type("ForbidData", ForbidData::Unserialize), forbidService(this), commandosforbid(this)
|
||||
forbidService(this), forbiddata_type("ForbidData", ForbidData::Unserialize), commandosforbid(this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
+5
-1
@@ -266,7 +266,11 @@ Serializable* ChannelInfo::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
std::vector<Anope::string> v;
|
||||
spacesepstream(slevels).GetTokens(v);
|
||||
for (unsigned i = 0; i + 1 < v.size(); i += 2)
|
||||
ci->levels[v[i]] = convertTo<int16_t>(v[i + 1]);
|
||||
try
|
||||
{
|
||||
ci->levels[v[i]] = convertTo<int16_t>(v[i + 1]);
|
||||
}
|
||||
catch (const ConvertException &) { }
|
||||
}
|
||||
BotInfo *bi = BotInfo::Find(sbi);
|
||||
if (*ci->bi != bi)
|
||||
|
||||
Reference in New Issue
Block a user