diff options
author | Adam <Adam@anope.org> | 2010-08-19 16:27:38 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-08-19 16:27:38 -0400 |
commit | 931b0777fbd961a4ca961ddfa763af92dcce946c (patch) | |
tree | b49fd2d5ee2d2299e933a3561be6e81ffcb3664e /modules/protocol/unreal32.cpp | |
parent | b180d5f975b3fd9a096a712adf9589c360831f72 (diff) |
Changed the svid system back to using user timestamps for IRCds limited to just usermode +d. This allows us to keep people logged in once again when Anope is restarted.
Diffstat (limited to 'modules/protocol/unreal32.cpp')
-rw-r--r-- | modules/protocol/unreal32.cpp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp index ed840aa3e..1e18e92f9 100644 --- a/modules/protocol/unreal32.cpp +++ b/modules/protocol/unreal32.cpp @@ -384,19 +384,11 @@ class UnrealIRCdProto : public IRCDProto void SetAutoIdentificationToken(User *u) { - if (!u->Account()) return; - srand(time(NULL)); - Anope::string svidbuf = stringify(rand()); - - u->Account()->Shrink("authenticationtoken"); - u->Account()->Extend("authenticationtoken", new ExtensibleItemRegular<Anope::string>(svidbuf)); - - BotInfo *bi = NickServ; - u->SetMode(bi, UMODE_REGISTERED); - ircdproto->SendMode(bi, u, "+d %s", svidbuf.c_str()); + u->SetMode(NickServ, UMODE_REGISTERED); + ircdproto->SendMode(NickServ, u, "+d %d", u->timestamp); } void SendUnregisteredNick(const User *u) @@ -874,12 +866,17 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) user = do_nick(source, av[0], av[3], av[4], av[5], av[10], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, ntohl(decode_ip(av[9])), av[8], ""); 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]); - UserSetInternalModes(user, 1, &av[7]); + + NickAlias *na = findnick(user->nick); + + if (na && user->timestamp == convertTo<time_t>(av[6])) + { + user->Login(na->nc); + user->SetMode(NickServ, UMODE_REGISTERED); + } + else + validate_user(user); } } else @@ -888,12 +885,17 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) user = do_nick(source, av[0], av[3], av[4], av[5], av[9], Anope::string(av[2]).is_number_only() ? convertTo<time_t>(av[2]) : 0, 0, av[8], ""); 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]); - UserSetInternalModes(user, 1, &av[7]); + + NickAlias *na = findnick(user->nick); + + if (na && user->timestamp == convertTo<time_t>(av[6])) + { + user->Login(na->nc); + user->SetMode(NickServ, UMODE_REGISTERED); + } + else + validate_user(user); } } } |