diff options
Diffstat (limited to 'src/protocol/unreal32.c')
-rw-r--r-- | src/protocol/unreal32.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index 773717495..b47b22368 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -97,9 +97,7 @@ IRCDVar myIrcd[] = { "-q", /* Mode to unset for an owner */ "+a", /* Mode to set for channel admin */ "-a", /* Mode to unset for channel admin */ - "+rd", /* Mode On Reg */ - "-r+d", /* Mode on UnReg */ - "-r+d", /* Mode on Nick Change */ + "-r+d", /* Mode on UnReg */ 1, /* Supports SGlines */ 1, /* Supports SQlines */ 1, /* Supports SZlines */ @@ -903,6 +901,28 @@ class UnrealIRCdProto : public IRCDProto return 1; } + void SetAutoIdentificationToken(User *u) + { + int *c; + char svidbuf[15]; + + if (!u->nc) + return; + + srand(time(NULL)); + snprintf(svidbuf, sizeof(svidbuf), "%i", rand()); + + if (u->nc->GetExt("authenticationtoken", c)) + { + delete [] c; + u->nc->Shrink("authenticationtoken"); + } + + u->nc->Extend("authenticationtoken", sstrdup(svidbuf)); + + common_svsmode(u, "+rd", svidbuf); + } + } ircd_proto; @@ -1223,7 +1243,14 @@ int anope_event_nick(const char *source, int ac, const char **av) user = do_nick(source, av[0], av[3], av[4], av[5], av[10], strtoul(av[2], NULL, 10), ntohl(decode_ip(av[9])), av[8], NULL); if (user) + { + /* Check to see if the user should be identified because their + * services id matches the one in their nickcore + */ + user->CheckAuthenticationToken(av[6]); + ircdproto->ProcessUsermodes(user, 1, &av[7]); + } } else { /* NON NICKIP */ @@ -1231,7 +1258,14 @@ int anope_event_nick(const char *source, int ac, const char **av) strtoul(av[2], NULL, 10), 0, av[8], NULL); if (user) + { + /* Check to see if the user should be identified because their + * services id matches the one in their nickcore + */ + user->CheckAuthenticationToken(av[6]); + ircdproto->ProcessUsermodes(user, 1, &av[7]); + } } } else { do_nick(source, av[0], NULL, NULL, NULL, NULL, @@ -1446,7 +1480,21 @@ class ProtoUnreal : public Module pmodule_ircd_proto(&ircd_proto); moduleAddIRCDMsgs(); + + ModuleManager::Attach(I_OnDelCore, this); + } + + void OnDelCore(NickCore *nc) + { + char *c; + + if (nc->GetExt("authenticationtoken", c)) + { + delete [] c; + nc->Shrink("authenticationtoken"); + } } + }; MODULE_INIT("unreal32", ProtoUnreal) |