-/**
- * This is the maximum length of a UUID (unique user identifier).
- * This length is set in compliance with TS6 protocol, and really should not be changed. Ever.
- * It allows for a lot of clients as-is. -- w00t.
- */
-#define UUID_LENGTH 10
+class CoreExport UIDGenerator
+{
+ private:
+ /** Holds the current UID. Used to generate the next one.
+ */
+ std::string current_uid;
+
+ /** Increments the current UID by one.
+ */
+ void IncrementUID(unsigned int pos);
+
+ public:
+ /**
+ * This is the maximum length of a UUID (unique user identifier).
+ * It allows up to 12,960 servers and 2,176,782,336 users per server.
+ */
+ static const unsigned int UUID_LENGTH = 9;
+
+ /** Initializes this UID generator with the given SID
+ * @param sid SID that conforms to InspIRCd::IsSID()
+ */
+ void init(const std::string& sid);
+
+ /** Returns the next available UID for this server.
+ */
+ std::string GetUID();