From 2b3d8e3d1841425af7412b3bf25657cf334c0175 Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 28 Jan 2010 20:16:31 +0000 Subject: Fix empty FMODE being sent if SendMode mode changes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12323 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules.cpp | 8 ++++++++ src/modules/m_channames.cpp | 3 +-- src/modules/m_cloaking.cpp | 3 --- src/modules/m_devoice.cpp | 3 +-- src/modules/m_messageflood.cpp | 4 +--- src/modules/m_ojoin.cpp | 3 +-- src/modules/m_opermodes.cpp | 3 +-- src/modules/m_timedbans.cpp | 3 +-- 8 files changed, 14 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/modules.cpp b/src/modules.cpp index 529e88b07..58c27e490 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -524,6 +524,14 @@ void InspIRCd::SendMode(const std::vector& parameters, User *user) this->Modes->Process(parameters, user); } + +void InspIRCd::SendGlobalMode(const std::vector& parameters, User *user) +{ + Modes->Process(parameters, user); + if (!Modes->GetLastParse().empty()) + this->PI->SendMode(parameters[0], Modes->GetLastParseParams(), Modes->GetLastParseTranslate()); +} + bool InspIRCd::AddResolver(Resolver* r, bool cached) { if (!cached) diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index 01f176e3b..032e1104c 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -76,8 +76,7 @@ class ModuleChannelNames : public Module modes.push_back(c->name); modes.push_back("-P"); - ServerInstance->SendMode(modes, ServerInstance->FakeClient); - ServerInstance->PI->SendMode(c->name, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate()); + ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient); } const UserMembList* users = c->GetUsers(); for(UserMembCIter j = users->begin(); j != users->end(); ++j) diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 1b30f410a..0405e31dd 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -438,9 +438,6 @@ class ModuleCloaking : public Module if (cloak) return; - if (dest->host.find('.') == std::string::npos && dest->host.find(':') == std::string::npos) - return; - std::string ipstr = dest->GetIPString(); std::string chost; diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 859069648..c4387bdaa 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -41,8 +41,7 @@ class CommandDevoice : public Command modes.push_back("-v"); modes.push_back(user->nick); - ServerInstance->SendMode(modes, ServerInstance->FakeClient); - ServerInstance->PI->SendMode(c->name, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate()); + ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient); return CMD_SUCCESS; } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 16ad1f2a4..c37537249 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -215,9 +215,7 @@ class ModuleMsgFlood : public Module parameters.push_back(dest->name); parameters.push_back("+b"); parameters.push_back(user->MakeWildHost()); - ServerInstance->SendMode(parameters, ServerInstance->FakeClient); - - ServerInstance->PI->SendModeStr(dest->name, std::string("+b ") + user->MakeWildHost()); + ServerInstance->SendGlobalMode(parameters, ServerInstance->FakeClient); } char kickmessage[MAXBUF]; diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 176a0e613..6e9e36812 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -83,8 +83,7 @@ class CommandOjoin : public Command modes.push_back(parameters[0]); modes.push_back("+Y"); modes.push_back(user->nick); - ServerInstance->SendMode(modes, ServerInstance->FakeClient); - ServerInstance->PI->SendMode(parameters[0], ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate()); + ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient); } return CMD_SUCCESS; } diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 7cc4ecc86..5cd2674a3 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -73,8 +73,7 @@ class ModuleModesOnOper : public Module modes.push_back(tokens[k]); } - ServerInstance->SendMode(modes, u); - ServerInstance->PI->SendMode(u->uuid, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate()); + ServerInstance->SendGlobalMode(modes, u); } }; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 91868e46e..eaa5cd88e 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -169,8 +169,7 @@ class ModuleTimedBans : public Module cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); ServerInstance->PI->SendChannelNotice(cr, '@', expiry); - ServerInstance->SendMode(setban, ServerInstance->FakeClient); - ServerInstance->PI->SendMode(chan, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate()); + ServerInstance->SendGlobalMode(setban, ServerInstance->FakeClient); } } else -- cgit v1.2.3