summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-01-29 11:44:50 +0000
committerSadie Powell <sadie@witchery.services>2020-01-29 12:00:32 +0000
commit6597fe5d4fd2c1cc474fa35a0db21fec480ff47f (patch)
tree1ad5986e40cb8e7dc392af21cd5d0e5e119196c2
parent64df216836aa1027aa7d6b7242264a982dc540bc (diff)
Add Channel::WriteRemoteNotice and revert WriteNotice changes.
This is a partial reversion of 687778b72e. See also: #1749.
-rw-r--r--include/channels.h1
-rw-r--r--src/channels.cpp5
-rw-r--r--src/modules/m_knock.cpp2
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_override.cpp2
-rw-r--r--src/modules/m_remove.cpp2
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp8
-rw-r--r--src/modules/m_timedbans.cpp4
-rw-r--r--src/modules/m_uninvite.cpp2
9 files changed, 16 insertions, 12 deletions
diff --git a/include/channels.h b/include/channels.h
index c3bdc160b..07e1091b0 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -289,6 +289,7 @@ class CoreExport Channel : public Extensible
* @param status The minimum status rank to send this message to.
*/
void WriteNotice(const std::string& text, char status = 0);
+ void WriteRemoteNotice(const std::string& text, char status = 0);
};
inline bool Channel::HasUser(User* user)
diff --git a/src/channels.cpp b/src/channels.cpp
index 320fcab78..75c6ab1e6 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -479,6 +479,11 @@ void Channel::WriteNotice(const std::string& text, char status)
{
ClientProtocol::Messages::Privmsg privmsg(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, this, text, MSG_NOTICE, status);
Write(ServerInstance->GetRFCEvents().privmsg, privmsg);
+}
+
+void Channel::WriteRemoteNotice(const std::string& text, char status)
+{
+ WriteNotice(text, status);
ServerInstance->PI->SendMessage(this, status, text, MSG_NOTICE);
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index afe12bf0d..e9e40c710 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -84,7 +84,7 @@ class CommandKnock : public Command
}
if (sendnotice)
- c->WriteNotice(InspIRCd::Format("User %s is KNOCKing on %s (%s)", user->nick.c_str(), c->name.c_str(), parameters[1].c_str()));
+ c->WriteRemoteNotice(InspIRCd::Format("User %s is KNOCKing on %s (%s)", user->nick.c_str(), c->name.c_str(), parameters[1].c_str()));
if (sendnumeric)
{
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 0e924295c..467f8c5c6 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -60,7 +60,7 @@ class CommandOjoin : public SplitCommand
ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used OJOIN to join "+channel->name);
if (notice)
- channel->WriteNotice(user->nick + " joined on official network business.");
+ channel->WriteRemoteNotice(user->nick + " joined on official network business.");
}
else
{
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index fff58b035..827e6dee8 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -76,7 +76,7 @@ class ModuleOverride : public Module
}
if (NoisyOverride)
- chan->WriteNotice(InspIRCd::Format("%s used oper override to bypass %s", user->nick.c_str(), bypasswhat));
+ chan->WriteRemoteNotice(InspIRCd::Format("%s used oper override to bypass %s", user->nick.c_str(), bypasswhat));
ServerInstance->SNO->WriteGlobalSno('v', user->nick+" used oper override to bypass " + mode + " on " + chan->name);
return MOD_RES_ALLOW;
}
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 1061a964f..10209af78 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -141,7 +141,7 @@ class RemoveBase : public Command
/* Build up the part reason string. */
reason = "Removed by " + user->nick + ": " + reasonparam;
- channel->WriteNotice(InspIRCd::Format("%s removed %s from the channel", user->nick.c_str(), target->nick.c_str()));
+ channel->WriteRemoteNotice(InspIRCd::Format("%s removed %s from the channel", user->nick.c_str(), target->nick.c_str()));
target->WriteNotice("*** " + user->nick + " removed you from " + channel->name + " with the message: " + reasonparam);
channel->PartUser(target, reason);
diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp
index 750c33d42..4ca09da5e 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -279,11 +279,9 @@ void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname)
{
if (Utils->AnnounceTSChange)
{
- // WriteNotice is not used here because the message only needs to go to the local server.
- const std::string tsmessage = InspIRCd::Format("Creation time of %s changed from %s to %s", newname.c_str(),
- InspIRCd::TimeString(chan->age).c_str(), InspIRCd::TimeString(TS).c_str());
- ClientProtocol::Messages::Privmsg privmsg(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, chan, tsmessage, MSG_NOTICE);
- chan->Write(ServerInstance->GetRFCEvents().privmsg, privmsg);
+ // WriteRemoteNotice is not used here because the message only needs to go to the local server.
+ chan->WriteNotice(InspIRCd::Format("Creation time of %s changed from %s to %s", newname.c_str(),
+ InspIRCd::TimeString(chan->age).c_str(), InspIRCd::TimeString(TS).c_str()));
}
// While the name is equal in case-insensitive compare, it might differ in case; use the remote version
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index cbdea1179..8b449f768 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -137,7 +137,7 @@ class CommandTban : public Command
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
- channel->WriteNotice(message, pfxchar);
+ channel->WriteRemoteNotice(message, pfxchar);
return CMD_SUCCESS;
}
@@ -228,7 +228,7 @@ class ModuleTimedBans : public Module
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
- cr->WriteNotice(message, pfxchar);
+ cr->WriteRemoteNotice(message, pfxchar);
Modes::ChangeList setban;
setban.push_remove(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask);
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index b74314fe8..566ba8806 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -104,7 +104,7 @@ class CommandUninvite : public Command
user->WriteRemoteNumeric(n);
lu->WriteNumeric(RPL_UNINVITED, InspIRCd::Format("You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str()));
- c->WriteNotice(InspIRCd::Format("*** %s uninvited %s.", user->nick.c_str(), u->nick.c_str()));
+ c->WriteRemoteNotice(InspIRCd::Format("*** %s uninvited %s.", user->nick.c_str(), u->nick.c_str()));
}
return CMD_SUCCESS;