]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add Channel::WriteRemoteNotice and revert WriteNotice changes.
authorSadie Powell <sadie@witchery.services>
Wed, 29 Jan 2020 11:44:50 +0000 (11:44 +0000)
committerSadie Powell <sadie@witchery.services>
Wed, 29 Jan 2020 12:00:32 +0000 (12:00 +0000)
This is a partial reversion of 687778b72e.

See also: #1749.

include/channels.h
src/channels.cpp
src/modules/m_knock.cpp
src/modules/m_ojoin.cpp
src/modules/m_override.cpp
src/modules/m_remove.cpp
src/modules/m_spanningtree/fjoin.cpp
src/modules/m_timedbans.cpp
src/modules/m_uninvite.cpp

index c3bdc160bc24d0d9faad9360d9f163828b360780..07e1091b051df347add563c5fad29c9e70a8d1b1 100644 (file)
@@ -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)
index 320fcab784e081bf4e9aeb773514feb20a4528c5..75c6ab1e68c540ae0527ced865a60269ab4eb688 100644 (file)
@@ -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);
 }
 
index afe12bf0de87f49985f349ca95baf71af2a35892..e9e40c710f310d7e6dfb9cfa27b52a8181c1081b 100644 (file)
@@ -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)
                {
index 0e924295c0977e7091994be4c58c94e42e1cd199..467f8c5c6cd91550fb15faa0916bba1ff3b2f408 100644 (file)
@@ -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
                {
index fff58b0357016f92c8c42bb6a5faac36ce6fff52..827e6dee8057c8218dcff24f83481cd4a2bc614f 100644 (file)
@@ -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;
        }
index 1061a964f065ee7bbe79529cde71fa944adff96c..10209af78060fe1c22b36d69c264d86e60c677c2 100644 (file)
@@ -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);
index 750c33d42d533b301b190274d0c2c524dc65ab15..4ca09da5e3ec2ba0ff6e8a800e6b1079eaddb4fe 100644 (file)
@@ -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
index cbdea11797fdf57f27b7362abb64d13732fa8eee..8b449f7681fe97513f9abcd15e21d28327e1779d 100644 (file)
@@ -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);
index b74314fe870bafc74c5641ddc0ba3f36f0621851..566ba8806f8431674e870cff58c0facb8acc7894 100644 (file)
@@ -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;