summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h8
-rw-r--r--src/modules.cpp8
-rw-r--r--src/modules/m_channames.cpp3
-rw-r--r--src/modules/m_cloaking.cpp3
-rw-r--r--src/modules/m_devoice.cpp3
-rw-r--r--src/modules/m_messageflood.cpp4
-rw-r--r--src/modules/m_ojoin.cpp3
-rw-r--r--src/modules/m_opermodes.cpp3
-rw-r--r--src/modules/m_timedbans.cpp3
9 files changed, 22 insertions, 16 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 44e6abe57..25ba846bc 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -612,6 +612,14 @@ class CoreExport InspIRCd
*/
void SendMode(const std::vector<std::string>& parameters, User *user);
+ /** Send a modechange and route it to the network.
+ * The parameters provided are identical to that sent to the
+ * handler for class cmd_mode.
+ * @param parameters The mode parameters
+ * @param user The user to send error messages to
+ */
+ void SendGlobalMode(const std::vector<std::string>& parameters, User *user);
+
/** Match two strings using pattern matching, optionally, with a map
* to check case against (may be NULL). If map is null, match will be case insensitive.
* @param str The literal string to match against
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<std::string>& parameters, User *user)
this->Modes->Process(parameters, user);
}
+
+void InspIRCd::SendGlobalMode(const std::vector<std::string>& 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