From e4839dc44353952dde32620035c07863b918eb15 Mon Sep 17 00:00:00 2001 From: peavey Date: Sun, 11 Oct 2009 18:03:17 +0000 Subject: [PATCH] Move 2 static extensibles from user class to inspircd class for global access in an attempt to further fix windows build. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11838 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/inspircd.h | 8 ++++++++ include/users.h | 3 --- src/commands/cmd_nick.cpp | 6 +++--- src/commands/cmd_quit.cpp | 2 +- src/inspircd.cpp | 7 ++++--- src/modules/m_nicklock.cpp | 2 +- src/modules/m_nonicks.cpp | 2 +- src/modules/m_spanningtree/main.cpp | 2 +- src/modules/m_spanningtree/operquit.cpp | 2 +- src/users.cpp | 11 ++++------- 10 files changed, 24 insertions(+), 21 deletions(-) diff --git a/include/inspircd.h b/include/inspircd.h index a9a64e2b0..182d33c9c 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -508,6 +508,14 @@ class CoreExport InspIRCd : public classbase */ ProtocolInterface* PI; + /** Holds extensible for user nickforced + */ + LocalIntExt NICKForced; + + /** Holds extensible for user operquit + */ + LocalStringExt OperQuit; + /** Get the current time * Because this only calls time() once every time around the mainloop, * it is much faster than calling time() directly. diff --git a/include/users.h b/include/users.h index ac3b2b459..884aaceeb 100644 --- a/include/users.h +++ b/include/users.h @@ -264,9 +264,6 @@ class CoreExport User : public StreamSocket std::bitset<64> AllowedChanModes; public: - static LocalIntExt NICKForced; - static LocalStringExt OperQuit; - /** Contains a pointer to the connect class a user is on from - this will be NULL for remote connections. */ reference MyClass; diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index bdaff8723..a6e1e88c7 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -52,16 +52,16 @@ CmdResult CommandNick::Handle (const std::vector& parameters, User if (((!ServerInstance->IsNick(parameters[0].c_str(), ServerInstance->Config->Limits.NickMax))) && (IS_LOCAL(user))) { - if (!User::NICKForced.get(user)) + if (!ServerInstance->NICKForced.get(user)) { if (parameters[0] == "0") { // Special case, Fake a /nick UIDHERE. Useful for evading "ERR: NICK IN USE" on connect etc. std::vector p2; p2.push_back(user->uuid); - User::NICKForced.set(user, 1); + ServerInstance->NICKForced.set(user, 1); this->Handle(p2, user); - User::NICKForced.set(user, 0); + ServerInstance->NICKForced.set(user, 0); return CMD_SUCCESS; } diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp index 5db7ada40..7bb84bd3b 100644 --- a/src/commands/cmd_quit.cpp +++ b/src/commands/cmd_quit.cpp @@ -51,7 +51,7 @@ CmdResult CommandQuit::Handle (const std::vector& parameters, User else quitmsg = parameters.size() ? parameters[0] : "Client exited"; - std::string* operquit = User::OperQuit.get(user); + std::string* operquit = ServerInstance->OperQuit.get(user); if (operquit) { ServerInstance->Users->QuitUser(user, quitmsg, operquit->c_str()); diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 2a6bc4e0a..857009744 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -320,13 +320,14 @@ InspIRCd::InspIRCd(int argc, char** argv) : * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods * themselves within the class. */ + NICKForced("NICKForced", NULL), + OperQuit("OperQuit", NULL), IsChannel(&HandleIsChannel), IsSID(&HandleIsSID), Rehash(&HandleRehash), IsNick(&HandleIsNick), IsIdent(&HandleIsIdent), FloodQuitUser(&HandleFloodQuitUser) - { #ifdef WIN32 // Strict, frequent checking of memory on debug builds @@ -338,8 +339,8 @@ InspIRCd::InspIRCd(int argc, char** argv) : ServerInstance = this; - Extensible::Register(&User::NICKForced); - Extensible::Register(&User::OperQuit); + Extensible::Register(&NICKForced); + Extensible::Register(&OperQuit); FailedPortList pl; int do_version = 0, do_nofork = 0, do_debug = 0, diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 755ae6da4..0ca0a9bac 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -178,7 +178,7 @@ class ModuleNickLock : public Module if (isdigit(newnick[0])) /* Allow a switch to a UID */ return MOD_RES_PASSTHRU; - if (User::NICKForced.get(user)) /* Allow forced nick changes */ + if (ServerInstance->NICKForced.get(user)) /* Allow forced nick changes */ return MOD_RES_PASSTHRU; if (locked.get(user)) diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index e811b8e67..22b0067cc 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -78,7 +78,7 @@ class ModuleNoNickChange : public Module return MOD_RES_PASSTHRU; // Allow forced nick changes. - if (User::NICKForced.get(user)) + if (ServerInstance->NICKForced.get(user)) return MOD_RES_PASSTHRU; for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index e71e55ae8..9c0997d7c 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -743,7 +743,7 @@ void ModuleSpanningTree::OnRemoteKill(User* source, User* dest, const std::strin if (!IS_LOCAL(source)) return; // Only start routing if we're origin. - User::OperQuit.set(dest, operreason); + ServerInstance->OperQuit.set(dest, operreason); parameterlist params; params.push_back(":"+operreason); Utils->DoOneToMany(dest->uuid,"OPERQUIT",params); diff --git a/src/modules/m_spanningtree/operquit.cpp b/src/modules/m_spanningtree/operquit.cpp index 9128baa0f..faf150be7 100644 --- a/src/modules/m_spanningtree/operquit.cpp +++ b/src/modules/m_spanningtree/operquit.cpp @@ -30,7 +30,7 @@ bool TreeSocket::OperQuit(const std::string &prefix, parameterlist ¶ms) if (u) { - User::OperQuit.set(u, params[0]); + ServerInstance->OperQuit.set(u, params[0]); params[0] = ":" + params[0]; Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix); } diff --git a/src/users.cpp b/src/users.cpp index 647619ae8..ba3b9bec8 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -24,9 +24,6 @@ static unsigned long uniq_id = 1; static unsigned long* already_sent = NULL; -LocalIntExt User::NICKForced("NICKForced", NULL); -LocalStringExt User::OperQuit("OperQuit", NULL); - void InitializeAlreadySent(SocketEngine* SE) { already_sent = new unsigned long[SE->GetMaxFds()]; @@ -914,9 +911,9 @@ bool User::ForceNickChange(const char* newnick) this->InvalidateCache(); - NICKForced.set(this, 1); + ServerInstance->NICKForced.set(this, 1); FIRST_MOD_RESULT(OnUserPreNick, MOD_RESULT, (this, newnick)); - NICKForced.set(this, 0); + ServerInstance->NICKForced.set(this, 0); if (MOD_RESULT == MOD_RES_DENY) { @@ -930,9 +927,9 @@ bool User::ForceNickChange(const char* newnick) { std::vector parameters; parameters.push_back(newnick); - NICKForced.set(this, 1); + ServerInstance->NICKForced.set(this, 1); bool result = (ServerInstance->Parser->CallHandler("NICK", parameters, this) == CMD_SUCCESS); - NICKForced.set(this, 0); + ServerInstance->NICKForced.set(this, 0); return result; } -- 2.39.5