31 |
|
#include "channel_mode.h" |
32 |
|
#include "client.h" |
33 |
|
#include "hash.h" |
34 |
+ |
#include "id.h" |
35 |
|
#include "irc_string.h" |
36 |
|
#include "ircd.h" |
37 |
|
#include "listener.h" |
50 |
|
#include "watch.h" |
51 |
|
|
52 |
|
static char umode_buffer[IRCD_BUFSIZE]; |
52 |
– |
static const char *uid_get(void); |
53 |
|
|
54 |
|
/* Used for building up the isupport string, |
55 |
|
* used with init_isupport, add_isupport, delete_isupport |
918 |
|
sendto_one_numeric(source_p, &me, RPL_YOUREOPER); |
919 |
|
} |
920 |
|
|
921 |
– |
static char new_uid[TOTALSIDUID + 1]; /* Allow for \0 */ |
922 |
– |
|
923 |
– |
int |
924 |
– |
valid_sid(const char *sid) |
925 |
– |
{ |
926 |
– |
if (strlen(sid) == IRC_MAXSID) |
927 |
– |
if (IsDigit(*sid)) |
928 |
– |
if (IsAlNum(*(sid + 1)) && IsAlNum(*(sid + 2))) |
929 |
– |
return 1; |
930 |
– |
|
931 |
– |
return 0; |
932 |
– |
} |
933 |
– |
|
934 |
– |
/* |
935 |
– |
* init_uid() |
936 |
– |
* |
937 |
– |
* inputs - NONE |
938 |
– |
* output - NONE |
939 |
– |
* side effects - new_uid is filled in with server id portion (sid) |
940 |
– |
* (first 3 bytes). Rest is filled in with '9'. |
941 |
– |
* |
942 |
– |
*/ |
943 |
– |
void |
944 |
– |
init_uid(void) |
945 |
– |
{ |
946 |
– |
snprintf(new_uid, sizeof(new_uid), "%s999999", me.id); |
947 |
– |
} |
948 |
– |
|
949 |
– |
/* |
950 |
– |
* add_one_to_uid |
951 |
– |
* |
952 |
– |
* inputs - index number into new_uid |
953 |
– |
* output - NONE |
954 |
– |
* side effects - new_uid is incremented by one |
955 |
– |
* note this is a recursive function |
956 |
– |
*/ |
957 |
– |
static void |
958 |
– |
add_one_to_uid(unsigned int i) |
959 |
– |
{ |
960 |
– |
if (i < IRC_MAXSID) |
961 |
– |
return; |
962 |
– |
|
963 |
– |
if (new_uid[i] == 'Z') |
964 |
– |
new_uid[i] = '0'; |
965 |
– |
else if (new_uid[i] == '9') |
966 |
– |
{ |
967 |
– |
new_uid[i] = 'A'; |
968 |
– |
add_one_to_uid(i - 1); |
969 |
– |
} |
970 |
– |
else |
971 |
– |
++new_uid[i]; |
972 |
– |
} |
973 |
– |
|
974 |
– |
/* |
975 |
– |
* uid_get |
976 |
– |
* |
977 |
– |
* inputs - struct Client * |
978 |
– |
* output - new UID is returned to caller |
979 |
– |
* side effects - new_uid is incremented by one. |
980 |
– |
*/ |
981 |
– |
static const char * |
982 |
– |
uid_get(void) |
983 |
– |
{ |
984 |
– |
add_one_to_uid(TOTALSIDUID - 1); /* Index from 0 */ |
985 |
– |
return new_uid; |
986 |
– |
} |
987 |
– |
|
921 |
|
/* |
922 |
|
* init_isupport() |
923 |
|
* |