summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-27 00:29:56 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-27 00:29:56 +0000
commit07e45de53335528d15ded120850d8e1b53cfc8bc (patch)
tree5c8d015b7e654e759b825d940fba0e6241c0aa15 /src/inspircd.cpp
parent5afa330604799b1a5467b7e09e53c95f3198d2e6 (diff)
Automatic SID generation based on code similar to the STL hash function and using server name and server gecos
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7849 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index e7d43edff..1d9aca35f 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -538,9 +538,19 @@ InspIRCd::InspIRCd(int argc, char** argv)
*/
int i;
- for(i = 0; i < 3; i++)
- current_uid[i] = '0';
+ /* Generate SID */
+ size_t sid = 0;
+ for (const char* x = Config->ServerName; *x; ++x)
+ sid = 5 * sid + *x;
+ for (const char* y = Config->ServerDesc; *y; ++y)
+ sid = 5 * sid + *y;
+ sid = sid % 999;
+ current_uid[0] = sid / 100 + 48;
+ current_uid[1] = sid / 10 + 48;
+ current_uid[2] = sid % 10 + 48;
+
+ /* Initialise UID */
for(i = 3; i < UUID_LENGTH - 1; i++)
current_uid[i] = 'A';