]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules/ircv3_replies.h
Sync helpop chmodes s and p with docs
[user/henk/code/inspircd.git] / include / modules / ircv3_replies.h
index 3ff462ad7d81299d4216f385c3aa9cef5ec27c41..a974773681d8ac006439264755dfb84151687e2a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2019-2021 Sadie Powell <sadie@witchery.services>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -66,7 +66,10 @@ class IRCv3::Replies::Reply
 
        void SendNoticeInternal(LocalUser* user, Command* command, const std::string& description)
        {
-               user->WriteNotice(InspIRCd::Format("*** %s: %s", command->name.c_str(), description.c_str()));
+               if (command)
+                       user->WriteNotice(InspIRCd::Format("*** %s: %s", command->name.c_str(), description.c_str()));
+               else
+                       user->WriteNotice(InspIRCd::Format("*** %s", description.c_str()));
        }
 
  protected:
@@ -90,8 +93,11 @@ class IRCv3::Replies::Reply
         */
        void Send(LocalUser* user, Command* command, const std::string& code, const std::string& description)
        {
-               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
-               msg.PushParamRef(command->name);
+               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
+               if (command)
+                       msg.PushParamRef(command->name);
+               else
+                       msg.PushParam("*");
                msg.PushParam(code);
                msg.PushParam(description);
                SendInternal(user, msg);
@@ -100,8 +106,11 @@ class IRCv3::Replies::Reply
        template<typename T1>
        void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const std::string& description)
        {
-               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
-               msg.PushParamRef(command->name);
+               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
+               if (command)
+                       msg.PushParamRef(command->name);
+               else
+                       msg.PushParam("*");
                msg.PushParam(code);
                msg.PushParam(ConvToStr(p1));
                msg.PushParam(description);
@@ -112,8 +121,11 @@ class IRCv3::Replies::Reply
        void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
                const std::string& description)
        {
-               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
-               msg.PushParamRef(command->name);
+               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
+               if (command)
+                       msg.PushParamRef(command->name);
+               else
+                       msg.PushParam("*");
                msg.PushParam(code);
                msg.PushParam(ConvToStr(p1));
                msg.PushParam(ConvToStr(p2));
@@ -125,8 +137,11 @@ class IRCv3::Replies::Reply
        void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
                const T3& p3, const std::string& description)
        {
-               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
-               msg.PushParamRef(command->name);
+               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
+               if (command)
+                       msg.PushParamRef(command->name);
+               else
+                       msg.PushParam("*");
                msg.PushParam(code);
                msg.PushParam(ConvToStr(p1));
                msg.PushParam(ConvToStr(p2));
@@ -139,8 +154,11 @@ class IRCv3::Replies::Reply
        void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
                const T3& p3, const T4& p4, const std::string& description)
        {
-               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
-               msg.PushParamRef(command->name);
+               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
+               if (command)
+                       msg.PushParamRef(command->name);
+               else
+                       msg.PushParam("*");
                msg.PushParam(code);
                msg.PushParam(ConvToStr(p1));
                msg.PushParam(ConvToStr(p2));
@@ -154,7 +172,7 @@ class IRCv3::Replies::Reply
        void Send(LocalUser* user, Command* command, const std::string& code, const T1& p1, const T2& p2,
                const T3& p3, const T4& p4, const T5& p5, const std::string& description)
        {
-               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->ServerName);
+               ClientProtocol::Message msg(cmd.c_str(), ServerInstance->Config->GetServerName());
                if (command)
                        msg.PushParamRef(command->name);
                else