summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-03-01 16:17:14 +0100
committerAttila Molnar <attilamolnar@hush.com>2016-03-01 16:17:14 +0100
commitd6eb4a1fc5b86bfb5467108d89923c7b64f27aed (patch)
treed86df061f5b8b519eb89b100d502e046b07fecc9
parent49e2df0307b41f76529f26da2fa26456c179cdb2 (diff)
Send NOTICEs that can go to both local and remote users with User::WriteRemoteNotice()
-rw-r--r--src/configreader.cpp5
-rw-r--r--src/modules/m_alltime.cpp4
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp8
-rw-r--r--src/modules/m_spanningtree/rconnect.cpp2
-rw-r--r--src/modules/m_spanningtree/rsquit.cpp4
6 files changed, 12 insertions, 13 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 1ac6b445a..e607c6e7d 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -612,7 +612,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
std::cout << line << std::endl;
// If a user is rehashing, tell them directly
if (user)
- user->SendText(":%s NOTICE %s :*** %s", ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), line.c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** %s", line.c_str()));
// Also tell opers
ServerInstance->SNO->WriteGlobalSno('a', line);
}
@@ -652,8 +652,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
ApplyModules(user);
if (user)
- user->SendText(":%s NOTICE %s :*** Successfully rehashed server.",
- ServerInstance->Config->ServerName.c_str(), user->nick.c_str());
+ user->WriteRemoteNotice("*** Successfully rehashed server.");
ServerInstance->SNO->WriteGlobalSno('a', "*** Successfully rehashed server.");
}
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index 075064c62..73c0fa994 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -33,9 +33,9 @@ class CommandAlltime : public Command
{
const std::string fmtdate = InspIRCd::TimeString(ServerInstance->Time(), "%Y-%m-%d %H:%M:%S", true);
- std::string msg = ":" + ServerInstance->Config->ServerName + " NOTICE " + user->nick + " :System time is " + fmtdate + " (" + ConvToStr(ServerInstance->Time()) + ") on " + ServerInstance->Config->ServerName;
+ std::string msg = "System time is " + fmtdate + " (" + ConvToStr(ServerInstance->Time()) + ") on " + ServerInstance->Config->ServerName;
- user->SendText(msg);
+ user->WriteRemoteNotice(msg);
/* we want this routed out! */
return CMD_SUCCESS;
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 9696b08a1..cc97c7308 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -66,7 +66,7 @@ class CommandSajoin : public Command
Channel* chan = ServerInstance->FindChan(channel);
if ((chan) && (chan->HasUser(dest)))
{
- user->SendText(":" + user->server->GetName() + " NOTICE " + user->nick + " :*** " + dest->nick + " is already on " + channel);
+ user->WriteRemoteNotice("*** " + dest->nick + " is already on " + channel);
return CMD_FAILURE;
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index ade8359ba..a401bba66 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -334,25 +334,25 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& para
{
if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
{
- RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str()));
return MOD_RES_DENY;
}
TreeServer* CheckDupe = Utils->FindServer(x->Name.c_str());
if (!CheckDupe)
{
- RemoteMessage(user, "*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
+ user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Connecting to server: \002%s\002 (%s:%d)", x->Name.c_str(), (x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()), x->Port));
ConnectServer(x);
return MOD_RES_DENY;
}
else
{
- RemoteMessage(user, "*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002", x->Name.c_str(), CheckDupe->GetParent()->GetName().c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002", x->Name.c_str(), CheckDupe->GetParent()->GetName().c_str()));
return MOD_RES_DENY;
}
}
}
- RemoteMessage(user, "*** CONNECT: No server matching \002%s\002 could be found in the config file.",parameters[0].c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: No server matching \002%s\002 could be found in the config file.", parameters[0].c_str()));
return MOD_RES_DENY;
}
diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp
index c5d3a5b52..8b8757a07 100644
--- a/src/modules/m_spanningtree/rconnect.cpp
+++ b/src/modules/m_spanningtree/rconnect.cpp
@@ -36,7 +36,7 @@ CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, U
/* First see if the server which is being asked to connect to another server in fact exists */
if (!Utils->FindServerMask(parameters[0]))
{
- ((ModuleSpanningTree*)(Module*)creator)->RemoteMessage(user, "*** RCONNECT: Server \002%s\002 isn't connected to the network!", parameters[0].c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** RCONNECT: Server \002%s\002 isn't connected to the network!", parameters[0].c_str()));
return CMD_FAILURE;
}
diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp
index 45413c33f..487db2826 100644
--- a/src/modules/m_spanningtree/rsquit.cpp
+++ b/src/modules/m_spanningtree/rsquit.cpp
@@ -39,13 +39,13 @@ CmdResult CommandRSQuit::Handle (const std::vector<std::string>& parameters, Use
server_target = Utils->FindServerMask(parameters[0]);
if (!server_target)
{
- ((ModuleSpanningTree*)(Module*)creator)->RemoteMessage(user, "*** RSQUIT: Server \002%s\002 isn't connected to the network!", parameters[0].c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** RSQUIT: Server \002%s\002 isn't connected to the network!", parameters[0].c_str()));
return CMD_FAILURE;
}
if (server_target->IsRoot())
{
- ((ModuleSpanningTree*)(Module*)creator)->RemoteMessage(user, "*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)", parameters[0].c_str());
+ user->WriteRemoteNotice(InspIRCd::Format("*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)", parameters[0].c_str()));
return CMD_FAILURE;
}