]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_showfile.cpp
Make User::WriteRemoteNumeric() virtual, implement it in SpanningTree::RemoteUser
[user/henk/code/inspircd.git] / src / modules / m_showfile.cpp
index 0f5d3ed1a00c8e556239edb9ed3d12934da6abad..9973bf2b6615819f34df647b1a3caae73c8034b4 100644 (file)
@@ -48,12 +48,12 @@ class CommandShowFile : public Command
                if (method == SF_NUMERIC)
                {
                        if (!introtext.empty())
-                               user->SendText(":%s %03d %s :%s %s", sn.c_str(), intronumeric, user->nick.c_str(), sn.c_str(), introtext.c_str());
+                               user->WriteRemoteNumeric(intronumeric, introtext);
 
                        for (file_cache::const_iterator i = contents.begin(); i != contents.end(); ++i)
-                               user->SendText(":%s %03d %s :- %s", sn.c_str(), textnumeric, user->nick.c_str(), i->c_str());
+                               user->WriteRemoteNumeric(textnumeric, InspIRCd::Format("- %s", i->c_str()));
 
-                       user->SendText(":%s %03d %s :%s", sn.c_str(), endnumeric, user->nick.c_str(), endtext.c_str());
+                       user->WriteRemoteNumeric(endnumeric, endtext.c_str());
                }
                else
                {
@@ -104,7 +104,7 @@ class ModuleShowFile : public Module
                FileReader reader(file);
 
                CommandShowFile* sfcmd;
-               Command* handler = ServerInstance->Parser->GetHandler(cmdname);
+               Command* handler = ServerInstance->Parser.GetHandler(cmdname);
                if (handler)
                {
                        // Command exists, check if it is ours
@@ -113,7 +113,7 @@ class ModuleShowFile : public Module
 
                        // This is our command, make sure we don't have the same entry twice
                        sfcmd = static_cast<CommandShowFile*>(handler);
-                       if (std::find(newcmds.begin(), newcmds.end(), sfcmd) != newcmds.end())
+                       if (stdalgo::isin(newcmds, sfcmd))
                                throw ModuleException("Command " + cmdname + " is already used in a <showfile> tag");
                }
                else
@@ -127,12 +127,6 @@ class ModuleShowFile : public Module
                newcmds.push_back(sfcmd);
        }
 
-       static void DelAll(const std::vector<CommandShowFile*>& list)
-       {
-               for (std::vector<CommandShowFile*>::const_iterator i = list.begin(); i != list.end(); ++i)
-                       delete *i;
-       }
-
  public:
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
@@ -157,13 +151,13 @@ class ModuleShowFile : public Module
                std::sort(newcmds.begin(), newcmds.end());
                std::set_difference(cmds.begin(), cmds.end(), newcmds.begin(), newcmds.end(), removed.begin());
 
-               DelAll(removed);
+               stdalgo::delete_all(removed);
                cmds.swap(newcmds);
        }
 
        ~ModuleShowFile()
        {
-               DelAll(cmds);
+               stdalgo::delete_all(cmds);
        }
 
        Version GetVersion() CXX11_OVERRIDE