aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-03-23 07:42:47 +0000
committerGravatar Sadie Powell2025-03-23 07:42:47 +0000
commitfb219052c8a09bb8fa9635521756819482da2cdd (patch)
treee6d6f5fb492c588969d8ac89e1ab312454c23047 /include
parentOnly include <sstream> from files that actually use it. (diff)
Move DefaultIsNick/DefaultIsUser/IsNick/IsUser to UserManager.
Diffstat (limited to 'include')
-rw-r--r--include/inspircd.h20
-rw-r--r--include/usermanager.h20
-rw-r--r--include/users.h1
3 files changed, 20 insertions, 21 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 9da420f0e..b7d20b3da 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -242,12 +242,6 @@ public:
/** Fills a buffer with random bytes. */
std::function<void(char*, size_t)> GenRandom = &DefaultGenRandom;
- /** Determines whether a nickname is valid. */
- std::function<bool(const std::string_view&)> IsNick = &DefaultIsNick;
-
- /** Determines whether a username is valid. */
- std::function<bool(const std::string_view&)> IsUser = &DefaultIsUser;
-
/** List of the open listeners. */
std::vector<ListenSocket*> Ports;
@@ -308,20 +302,6 @@ public:
*/
static void DefaultGenRandom(char* output, size_t max);
- /** Determines whether a nickname is valid according to the RFC 1459 rules.
- * This is the default function for InspIRCd::IsNick.
- * @param nick The nickname to validate.
- * @return True if the nickname is valid according to RFC 1459 rules; otherwise, false.
- */
- static bool DefaultIsNick(const std::string_view& nick);
-
- /** Determines whether a username is valid according to the RFC 1459 rules.
- * This is the default function for InspIRCd::IsUser.
- * @param user The username to validate.
- * @return True if the username is valid according to RFC 1459 rules; otherwise, false.
- */
- static bool DefaultIsUser(const std::string_view& user);
-
/** Causes the server to exit after unloading modules and closing all open file descriptors.
* @param status The exit code to give to the operating system.
*/
diff --git a/include/usermanager.h b/include/usermanager.h
index ee9a9f603..ec333d51b 100644
--- a/include/usermanager.h
+++ b/include/usermanager.h
@@ -80,6 +80,12 @@ public:
*/
~UserManager();
+ /** Determines whether a nickname is valid. */
+ std::function<bool(const std::string_view&)> IsNick = &DefaultIsNick;
+
+ /** Determines whether a username is valid. */
+ std::function<bool(const std::string_view&)> IsUser = &DefaultIsUser;
+
/** Nickname string -> User* map. Contains all users, including partially connected ones.
*/
UserMap clientlist;
@@ -98,6 +104,20 @@ public:
/** Number of local unknown (not fully connected) users. */
size_t unknown_count = 0;
+ /** Determines whether a nickname is valid according to the RFC 1459 rules.
+ * This is the default function for UserManager::IsNick.
+ * @param nick The nickname to validate.
+ * @return True if the nickname is valid according to RFC 1459 rules; otherwise, false.
+ */
+ static bool DefaultIsNick(const std::string_view& nick);
+
+ /** Determines whether a username is valid according to the RFC 1459 rules.
+ * This is the default function for UserManager::IsUser.
+ * @param user The username to validate.
+ * @return True if the username is valid according to RFC 1459 rules; otherwise, false.
+ */
+ static bool DefaultIsUser(const std::string_view& user);
+
/** Perform background user events for all local users such as PING checks, connection timeouts,
* penalty management and recvq processing for users who have data in their recvq due to throttling.
*/
diff --git a/include/users.h b/include/users.h
index 06d97342c..9f72c5283 100644
--- a/include/users.h
+++ b/include/users.h
@@ -438,7 +438,6 @@ public:
irc::sockets::sockaddrs client_sa;
/** The users nickname.
- * Use InspIRCd::IsNick() to validate nicknames.
*/
std::string nick;