mirror of
https://github.com/anope/anope.git
synced 2026-06-26 08:36:39 +02:00
Add support for numerics associated with cs_set_misc entries.
This is mainly to allow the URL entry to use RPL_CHANNELURL.
This commit is contained in:
@@ -1256,7 +1256,7 @@ command { service = "ChanServ"; name = "SET NOEXPIRE"; command = "chanserv/saset
|
||||
* A field named misc_description may be given for use with help output.
|
||||
*/
|
||||
module { name = "cs_set_misc" }
|
||||
command { service = "ChanServ"; name = "SET URL"; command = "chanserv/set/misc"; misc_description = _("Associate a URL with the channel"); }
|
||||
command { service = "ChanServ"; name = "SET URL"; command = "chanserv/set/misc"; misc_description = _("Associate a URL with the channel"); misc_numeric = 328; }
|
||||
command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc"; misc_description = _("Associate an email address with the channel"); }
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,6 +2,7 @@ Anope Version 2.1.11-git
|
||||
------------------------
|
||||
Added support for database migrations to the mysql module.
|
||||
Added support for renicking users to their UID when enforcing nickname protection.
|
||||
Added support for sending channel URLs to joining users.
|
||||
Allowed selecting languages using a shorter version of their name.
|
||||
Changed various messages to use human-readable durations instead of seconds.
|
||||
Improved the creation of expiry and duration messages.
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
static Module *me;
|
||||
|
||||
static Anope::map<Anope::string> descriptions;
|
||||
static Anope::map<uint16_t> numerics;
|
||||
|
||||
struct CSMiscData;
|
||||
static Anope::map<ExtensibleItem<CSMiscData> *> items;
|
||||
@@ -189,6 +190,7 @@ public:
|
||||
void OnReload(Configuration::Conf *conf) override
|
||||
{
|
||||
descriptions.clear();
|
||||
numerics.clear();
|
||||
|
||||
for (int i = 0; i < conf->CountBlock("command"); ++i)
|
||||
{
|
||||
@@ -204,9 +206,31 @@ public:
|
||||
continue;
|
||||
|
||||
descriptions[cname] = desc;
|
||||
|
||||
auto numeric = block->Get<unsigned>("misc_numeric");
|
||||
if (numeric >= 1 && numeric <= 999)
|
||||
numerics["cs_set_misc:" + GetAttribute(cname)] = numeric;
|
||||
}
|
||||
}
|
||||
|
||||
void OnJoinChannel(User *user, Channel *c) override
|
||||
{
|
||||
if (!c->ci || !user->server->IsSynced() || numerics.empty())
|
||||
return;
|
||||
|
||||
for (const auto &[name, ext] : items)
|
||||
{
|
||||
auto *data = ext->Get(c->ci);
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
auto numeric = numerics.find(name);
|
||||
if (numeric != numerics.end())
|
||||
IRCD->SendNumeric(numeric->second, user->GetUID(), c->ci->name, data->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool) override
|
||||
{
|
||||
for (const auto &[_, e] : items)
|
||||
|
||||
Reference in New Issue
Block a user