summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/chanserv.example.conf2
-rw-r--r--docs/Changes1
-rw-r--r--modules/chanserv/cs_set_misc.cpp24
3 files changed, 26 insertions, 1 deletions
diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf
index 4701ddd88..df91f3d92 100644
--- a/data/chanserv.example.conf
+++ b/data/chanserv.example.conf
@@ -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"); }
/*
diff --git a/docs/Changes b/docs/Changes
index bc0a04cfa..5f708d3ff 100644
--- a/docs/Changes
+++ b/docs/Changes
@@ -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.
diff --git a/modules/chanserv/cs_set_misc.cpp b/modules/chanserv/cs_set_misc.cpp
index 4ad0ee7a1..f390a5890 100644
--- a/modules/chanserv/cs_set_misc.cpp
+++ b/modules/chanserv/cs_set_misc.cpp
@@ -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)