summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h5
-rw-r--r--src/channels.cpp7
-rw-r--r--src/modules/m_joinflood.cpp2
-rw-r--r--src/modules/m_knock.cpp2
-rw-r--r--src/modules/m_nickflood.cpp2
-rw-r--r--src/modules/m_ojoin.cpp6
-rw-r--r--src/modules/m_override.cpp2
-rw-r--r--src/modules/m_remove.cpp2
-rw-r--r--src/modules/m_spanningtree/fjoin.cpp2
-rw-r--r--src/modules/m_uninvite.cpp2
10 files changed, 22 insertions, 10 deletions
diff --git a/include/channels.h b/include/channels.h
index 0cf477f22..0a131ddb3 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -332,6 +332,11 @@ class CoreExport Channel : public Extensible
/** Get the status of an "action" type extban
*/
ModResult GetExtBanStatus(User *u, char type);
+
+ /** Write a NOTICE to all local users on the channel
+ * @param text Text to send
+ */
+ void WriteNotice(const std::string& text);
};
inline bool Channel::HasUser(User* user)
diff --git a/src/channels.cpp b/src/channels.cpp
index a2d5c4a30..14b1ea545 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -562,6 +562,13 @@ const char* Channel::ChanModes(bool showkey)
return scratch.c_str();
}
+void Channel::WriteNotice(const std::string& text)
+{
+ std::string rawmsg = "NOTICE ";
+ rawmsg.append(this->name).append(" :").append(text);
+ WriteChannelWithServ(ServerInstance->Config->ServerName, rawmsg);
+}
+
/* returns the status character for a given user on a channel, e.g. @ for op,
* % for halfop etc. If the user has several modes set, the highest mode
* the user has must be returned.
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 56e109c1a..56131f0be 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -159,7 +159,7 @@ class ModuleJoinFlood : public Module
{
f->clear();
f->lock();
- memb->chan->WriteChannelWithServ((char*)ServerInstance->Config->ServerName.c_str(), "NOTICE %s :This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", memb->chan->name.c_str(), f->joins, f->secs);
+ memb->chan->WriteNotice(InspIRCd::Format("This channel has been closed to new users for 60 seconds because there have been more than %d joins in %d seconds.", f->joins, f->secs));
}
}
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 545c2dc14..a6352749f 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -68,7 +68,7 @@ class CommandKnock : public Command
}
if (sendnotice)
- c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name.c_str(), user->nick.c_str(), c->name.c_str(), parameters[1].c_str());
+ c->WriteNotice(InspIRCd::Format("User %s is KNOCKing on %s (%s)", user->nick.c_str(), c->name.c_str(), parameters[1].c_str()));
if (sendnumeric)
c->WriteChannelWithServ(ServerInstance->Config->ServerName, "710 %s %s %s :is KNOCKing: %s", c->name.c_str(), c->name.c_str(), user->GetFullHost().c_str(), parameters[1].c_str());
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index 0af1041f9..39e097daa 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -150,7 +150,7 @@ class ModuleNickFlood : public Module
{
f->clear();
f->lock();
- channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName.c_str(), "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %u nick changes in %u seconds.", channel->name.c_str(), f->nicks, f->secs);
+ channel->WriteNotice(InspIRCd::Format("No nick changes are allowed for 60 seconds because there have been more than %u nick changes in %u seconds.", f->nicks, f->secs));
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 88b63bef2..56cef10b4 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -58,9 +58,9 @@ class CommandOjoin : public SplitCommand
if (notice)
{
- channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s joined on official network business.",
- parameters[0].c_str(), user->nick.c_str());
- ServerInstance->PI->SendChannelNotice(channel, 0, user->nick + " joined on official network business.");
+ const std::string msg = user->nick + " joined on official network business.";
+ channel->WriteNotice(msg);
+ ServerInstance->PI->SendChannelNotice(channel, 0, msg);
}
}
else
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 8bf1d3079..9cfc3aed0 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -58,7 +58,7 @@ class ModuleOverride : public Module
}
if (NoisyOverride)
- chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s used oper override to bypass %s", chan->name.c_str(), user->nick.c_str(), bypasswhat);
+ chan->WriteNotice(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 5b0efe2a2..d643bc0cd 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -130,7 +130,7 @@ class RemoveBase : public Command
/* Build up the part reason string. */
reason = "Removed by " + user->nick + ": " + reasonparam;
- channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name.c_str(), user->nick.c_str(), target->nick.c_str());
+ channel->WriteNotice(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 0879e730a..74590adf8 100644
--- a/src/modules/m_spanningtree/fjoin.cpp
+++ b/src/modules/m_spanningtree/fjoin.cpp
@@ -266,7 +266,7 @@ void CommandFJoin::RemoveStatus(Channel* c)
void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname)
{
if (Utils->AnnounceTSChange)
- chan->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :TS for %s changed from %lu to %lu", chan->name.c_str(), newname.c_str(), (unsigned long) chan->age, (unsigned long) TS);
+ chan->WriteNotice(InspIRCd::Format("TS for %s changed from %lu to %lu", newname.c_str(), (unsigned long) chan->age, (unsigned long) TS));
// While the name is equal in case-insensitive compare, it might differ in case; use the remote version
chan->name = newname;
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index d3045eadc..19184751d 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -96,7 +96,7 @@ class CommandUninvite : public Command
lu->WriteNumeric(493, InspIRCd::Format("You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str()));
std::string msg = "*** " + user->nick + " uninvited " + u->nick + ".";
- c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE " + c->name + " :" + msg);
+ c->WriteNotice(msg);
ServerInstance->PI->SendChannelNotice(c, 0, msg);
}