summaryrefslogtreecommitdiff
path: root/modules/nickserv/ns_group.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-11-24 23:56:57 +0000
committerSadie Powell <sadie@witchery.services>2024-11-25 00:08:30 +0000
commit7019b27e591e0f5ce3727993e02198ae070885e9 (patch)
tree7752a85bb31f4bce07f63c3364a9f8d6c903daa2 /modules/nickserv/ns_group.cpp
parent70227dc8823c0f9669e35dbf63593faaeef5410d (diff)
Rework how guest nicks work.
- Use the config setting as a string template instead of as a prefix. - Allow users of IRCds that have UIDs to use that as the guest nick. - Fall back to a UID before killing if a guest nick can not be found.
Diffstat (limited to 'modules/nickserv/ns_group.cpp')
-rw-r--r--modules/nickserv/ns_group.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/modules/nickserv/ns_group.cpp b/modules/nickserv/ns_group.cpp
index f2a7f33ae..3ccba782c 100644
--- a/modules/nickserv/ns_group.cpp
+++ b/modules/nickserv/ns_group.cpp
@@ -12,6 +12,8 @@
#include "module.h"
#include "modules/ns_cert.h"
+static ServiceReference<NickServService> nickserv("NickServService", "NickServ");
+
class NSGroupRequest final
: public IdentifyRequest
{
@@ -142,7 +144,6 @@ public:
}
NickAlias *target, *na = NickAlias::Find(source.GetNick());
- const Anope::string &guestnick = Config->GetModule("nickserv")->Get<const Anope::string>("guestnickprefix", "Guest");
time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay");
unsigned maxaliases = Config->GetModule(this->owner)->Get<unsigned>("maxaliases");
if (!(target = NickAlias::Find(nick)))
@@ -165,12 +166,8 @@ public:
source.Reply(NICK_IDENTIFY_REQUIRED);
else if (maxaliases && target->nc->aliases->size() >= maxaliases && !target->nc->IsServicesOper())
source.Reply(_("There are too many nicks in your group."));
- else if (source.GetNick().length() <= guestnick.length() + 7 &&
- source.GetNick().length() >= guestnick.length() + 1 &&
- !source.GetNick().find_ci(guestnick) && !source.GetNick().substr(guestnick.length()).find_first_not_of("1234567890"))
- {
+ else if (nickserv && nickserv->IsGuestNick(source.GetNick()))
source.Reply(NICK_CANNOT_BE_REGISTERED, source.GetNick().c_str());
- }
else
{
bool ok = false;