summaryrefslogtreecommitdiff
path: root/modules/protocol/inspircd20.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-12-10 16:29:49 -0500
committerAdam <Adam@anope.org>2010-12-12 19:37:04 -0500
commiteb138a02d61f0cd0a51083ea3c682e2a6b5c24fd (patch)
tree5ca0b3257557a05bcae39d7321ab5504dde8217b /modules/protocol/inspircd20.cpp
parent2a4d0e3e898f1ee2395b5e83198d68a5e646a640 (diff)
Do not validate users during netburst until after the server is done syncing
Diffstat (limited to 'modules/protocol/inspircd20.cpp')
-rw-r--r--modules/protocol/inspircd20.cpp113
1 files changed, 38 insertions, 75 deletions
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 20e622092..ff6a0688b 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -51,9 +51,6 @@ IRCDVar myIrcd[] = {
static bool has_servicesmod = false;
static bool has_svsholdmod = false;
-/* Previously introduced user during burst */
-static User *prev_u_intro = NULL;
-
/* CHGHOST */
void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
{
@@ -250,60 +247,6 @@ bool event_sethost(const Anope::string &source, const std::vector<Anope::string>
return true;
}
-/*
- * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org>
- * 0: uid
- * 1: ts
- * 2: nick
- * 3: host
- * 4: dhost
- * 5: ident
- * 6: ip
- * 7: signon
- * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
- * last: realname
- */
-
-bool event_uid(const Anope::string &source, const std::vector<Anope::string> &params)
-{
- User *user;
- Server *s = Server::Find(source);
- time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
-
- /* 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*/
- user = prev_u_intro;
- prev_u_intro = NULL;
- if (user && !user->server->IsSynced())
- {
- 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);
- }
-
- Anope::string modes = params[8];
- for (unsigned i = 9; i < params.size() - 1; ++i)
- modes += Anope::string(" ") + params[i];
- user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
- if (user)
- {
- if (!user->server->IsSynced())
- prev_u_intro = user;
- else
- validate_user(user);
- }
-
- return true;
-}
-
bool event_chghost(const Anope::string &source, const std::vector<Anope::string> &params)
{
User *u = finduser(source);
@@ -331,10 +274,13 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
else if (params[1].equals_cs("accountname"))
{
User *u = finduser(params[0]);
+ NickAlias *user_na = u ? findnick(u->nick) : NULL;
NickCore *nc = findcore(params[2]);
if (u && nc)
{
u->Login(nc);
+ if (user_na && user_na->nc == nc)
+ u->SetMode(NickServ, UMODE_REGISTERED);
}
}
@@ -362,28 +308,16 @@ bool event_metadata(const Anope::string &source, const std::vector<Anope::string
bool event_endburst(const Anope::string &source, const std::vector<Anope::string> &params)
{
- User *u = prev_u_intro;
Server *s = Server::Find(source);
if (!s)
throw CoreException("Got ENDBURST without a source");
- /* 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 && !u->server->IsSynced())
+ for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
{
- NickAlias *na = findnick(u->nick);
-
- if (!na || na->nc != u->Account())
- {
+ User *u = *it;
+ if (u->server == s && !u->IsIdentified())
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();
@@ -395,6 +329,34 @@ bool event_endburst(const Anope::string &source, const std::vector<Anope::string
class Inspircd20IRCdMessage : public InspircdIRCdMessage
{
public:
+ /*
+ * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org>
+ * 0: uid
+ * 1: ts
+ * 2: nick
+ * 3: host
+ * 4: dhost
+ * 5: ident
+ * 6: ip
+ * 7: signon
+ * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
+ * last: realname
+ */
+ bool OnUID(const Anope::string &source, const std::vector<Anope::string> &params)
+ {
+ Server *s = Server::Find(source);
+ time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
+
+ Anope::string modes = params[8];
+ for (unsigned i = 9; i < params.size() - 1; ++i)
+ modes += Anope::string(" ") + params[i];
+ User *user = do_nick("", params[2], params[5], params[3], s->GetName(), params[params.size() - 1], ts, params[6], params[4], params[0], modes);
+ if (user && user->server->IsSynced())
+ validate_user(user);
+
+ return true;
+ }
+
bool OnCapab(const Anope::string &source, const std::vector<Anope::string> &params)
{
if (params[0].equals_cs("START"))
@@ -701,6 +663,8 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage
}
IRCdMessage::OnCapab(source, params);
+
+ return true;
}
};
@@ -715,8 +679,7 @@ bool ChannelModeFlood::IsValid(const Anope::string &value) const
class ProtoInspIRCd : public Module
{
- Message message_endburst,
- message_uid, message_time,
+ Message message_endburst, message_time,
message_rsquit, message_svsmode, message_fhost,
message_chgident, message_fname, message_sethost, message_setident, message_setname, message_fjoin, message_fmode,
message_ftopic, message_opertype, message_idle, message_metadata;
@@ -725,7 +688,7 @@ class ProtoInspIRCd : public Module
Inspircd20IRCdMessage ircd_message;
public:
ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
- message_endburst("ENDBURST", event_endburst), message_uid("UID", event_uid),
+ message_endburst("ENDBURST", event_endburst),
message_time("TIME", event_time), message_rsquit("RSQUIT", event_rsquit),
message_svsmode("SVSMODE", OnMode), message_fhost("FHOST", event_chghost),
message_chgident("FIDENT", event_chgident), message_fname("FNAME", event_chgname),