diff options
author | Adam <Adam@anope.org> | 2010-09-19 16:06:22 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-09-19 16:06:22 -0400 |
commit | aa9ab7c6db2268ea62d05a9169f9c072def13a79 (patch) | |
tree | 5817191a13c12ed07727f8744704f61cd56d2475 | |
parent | 22f2b25f97ac2f96d8e7a5a9731f28483e4d0a1f (diff) |
Keep users +r on InspIRCd if their account name matches their login name
-rw-r--r-- | modules/protocol/inspircd12.cpp | 39 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 39 |
2 files changed, 48 insertions, 30 deletions
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 592fc9e1a..574fa7791 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -716,7 +716,6 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) int anope_event_uid(const Anope::string &source, int ac, const char **av) { User *user; - NickAlias *na; Server *s = Server::Find(source); int ts = strtoul(av[1], NULL, 10); @@ -724,15 +723,20 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av) * If not, validate the user. ~ Viper*/ user = prev_u_intro; prev_u_intro = NULL; - if (user) - na = findnick(user->nick); - if (user && !user->server->IsSynced() && (!na || na->nc != user->Account())) + if (user && !user->server->IsSynced()) { - validate_user(user); - if (user->HasMode(UMODE_REGISTERED)) - user->RemoveMode(NickServ, UMODE_REGISTERED); + NickAlias *na = findnick(user->nick); + + if (!na || na->nc != user->Account()) + { + validate_user(user); + if (user->HasMode(UMODE_REGISTERED)) + user->RemoveMode(NickServ, UMODE_REGISTERED); + } + else + /* Set them +r (to negate a possible -r on the stack) */ + user->SetMode(NickServ, UMODE_REGISTERED); } - user = NULL; user = do_nick("", av[2], av[5], av[3], s->GetName(), av[ac - 1], ts, av[6], av[4], av[0]); if (user) @@ -1150,7 +1154,6 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av) int anope_event_endburst(const Anope::string &source, int ac, const char **av) { - NickAlias *na; User *u = prev_u_intro; Server *s = Server::Find(source); @@ -1160,13 +1163,19 @@ int anope_event_endburst(const Anope::string &source, int ac, const char **av) /* Check if the previously introduced user was Id'd for the nickgroup of the nick he s currently using. * If not, validate the user. ~ Viper*/ prev_u_intro = NULL; - if (u) - na = findnick(u->nick); - if (u && !u->server->IsSynced() && (!na || na->nc != u->Account())) + if (u && !u->server->IsSynced()) { - validate_user(u); - if (u->HasMode(UMODE_REGISTERED)) - u->RemoveMode(NickServ, UMODE_REGISTERED); + NickAlias *na = findnick(u->nick); + + if (!na || na->nc != u->Account()) + { + validate_user(u); + if (u->HasMode(UMODE_REGISTERED)) + u->RemoveMode(NickServ, UMODE_REGISTERED); + } + else + /* Set them +r (to negate a possible -r on the stack) */ + u->SetMode(NickServ, UMODE_REGISTERED); } Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName(); diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 5d0f9436e..4ebd9711c 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -713,7 +713,6 @@ int anope_event_nick(const Anope::string &source, int ac, const char **av) int anope_event_uid(const Anope::string &source, int ac, const char **av) { User *user; - NickAlias *na; Server *s = Server::Find(source); time_t ts = Anope::string(av[1]).is_pos_number_only() ? convertTo<time_t>(av[1]) : 0; @@ -721,15 +720,20 @@ int anope_event_uid(const Anope::string &source, int ac, const char **av) * If not, validate the user. ~ Viper*/ user = prev_u_intro; prev_u_intro = NULL; - if (user) - na = findnick(user->nick); - if (user && !user->server->IsSynced() && (!na || na->nc != user->Account())) + if (user && !user->server->IsSynced()) { - validate_user(user); - if (user->HasMode(UMODE_REGISTERED)) - user->RemoveMode(NickServ, UMODE_REGISTERED); + NickAlias *na = findnick(user->nick); + + if (!na || na->nc != user->Account()) + { + validate_user(user); + if (user->HasMode(UMODE_REGISTERED)) + user->RemoveMode(NickServ, UMODE_REGISTERED); + } + else + /* Set them +r (to negate a possible -r on the stack) */ + user->SetMode(NickServ, UMODE_REGISTERED); } - user = NULL; user = do_nick("", av[2], av[5], av[3], s->GetName(), av[ac - 1], ts, av[6], av[4], av[0]); if (user) @@ -1123,7 +1127,6 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av) int anope_event_endburst(const Anope::string &source, int ac, const char **av) { - NickAlias *na; User *u = prev_u_intro; Server *s = Server::Find(source); @@ -1133,13 +1136,19 @@ int anope_event_endburst(const Anope::string &source, int ac, const char **av) /* Check if the previously introduced user was Id'd for the nickgroup of the nick he s currently using. * If not, validate the user. ~ Viper*/ prev_u_intro = NULL; - if (u) - na = findnick(u->nick); - if (u && !u->server->IsSynced() && (!na || na->nc != u->Account())) + if (u && !u->server->IsSynced()) { - validate_user(u); - if (u->HasMode(UMODE_REGISTERED)) - u->RemoveMode(NickServ, UMODE_REGISTERED); + NickAlias *na = findnick(u->nick); + + if (!na || na->nc != u->Account()) + { + validate_user(u); + if (u->HasMode(UMODE_REGISTERED)) + u->RemoveMode(NickServ, UMODE_REGISTERED); + } + else + /* Set them +r (to negate a possible -r on the stack) */ + u->SetMode(NickServ, UMODE_REGISTERED); } Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName(); |