]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove dead code from the InspIRCd and CommandParser classes and typedefs.h
authorattilamolnar <attilamolnar@hush.com>
Tue, 18 Jun 2013 19:25:43 +0000 (21:25 +0200)
committerattilamolnar <attilamolnar@hush.com>
Tue, 18 Jun 2013 19:25:43 +0000 (21:25 +0200)
Removed functions:

InspIRCd:
- Restart() - unused
- DoSocketTimeouts() - no implementation exists
- AddCommand() - useless wrapper around ModuleManager::AddService()

CommandParser:
- IsValidCommand() - unused
- ProcessParameters() - no implementation exists

include/command_parse.h
include/inspircd.h
include/typedefs.h
src/command_parse.cpp
src/inspircd.cpp
src/modmanager_static.cpp

index 48015161261934ca3201cb4b04df9d9bf8c74bca..b39bf31c01e6fe0884c9e3e0f7bbcff2fb86b0fb 100644 (file)
 class CoreExport CommandParser
 {
  private:
-       /** Process a parameter string into a list of items
-        * @param command_p The output list of items
-        * @param parameters The input string
-        * @return The number of parameters parsed into command_p
-        */
-       int ProcessParameters(std::vector<std::string>& command_p, char* parameters);
-
        /** Process a command from a user.
         * @param user The user to parse the command for
         * @param cmd The command string to process
@@ -70,16 +63,6 @@ class CoreExport CommandParser
         */
        Command* GetHandler(const std::string &commandname);
 
-       /** This function returns true if a command is valid with the given number of parameters and user.
-        * @param commandname The command name to check
-        * @param pcnt The parameter count
-        * @param user The user to check against
-        * @return If the user given has permission to execute the command, and the parameter count is
-        * equal to or greater than the minimum number of parameters to the given command, then this
-        * function will return true, otherwise it will return false.
-        */
-       bool IsValidCommand(const std::string &commandname, unsigned int pcnt, User * user);
-
        /** LoopCall is used to call a command handler repeatedly based on the contents of a comma seperated list.
         * There are two ways to call this method, either with one potential list or with two potential lists.
         * We need to handle two potential lists for JOIN, because a JOIN may contain two lists of items at once:
index 4845a777ef483a5c9b7ee7a43a9f76d867b67b58..a25466647563e3047b7d84cbe2e18ed33e7dc181 100644 (file)
@@ -265,11 +265,6 @@ class CoreExport InspIRCd
         */
        bool DaemonSeed();
 
-       /** Iterate the list of BufferedSocket objects, removing ones which have timed out
-        * @param TIME the current time
-        */
-       void DoSocketTimeouts(time_t TIME);
-
        /** The current time, updated in the mainloop
         */
        struct timespec TIME;
@@ -544,15 +539,6 @@ class CoreExport InspIRCd
         */
        caller1<bool, const std::string&> IsIdent;
 
-       /** Add a command to this server's command parser
-        * @param f A Command command handler object to add
-        * @throw ModuleException Will throw ModuleExcption if the command already exists
-        */
-       inline void AddCommand(Command *f)
-       {
-               Modules->AddService(*f);
-       }
-
        /** Match two strings using pattern matching, optionally, with a map
         * to check case against (may be NULL). If map is null, match will be case insensitive.
         * @param str The literal string to match against
@@ -694,14 +680,6 @@ class CoreExport InspIRCd
         */
        caller3<ModResult, User*, Channel*, const std::string&> OnCheckExemption;
 
-       /** Restart the server.
-        * This function will not return. If an error occurs,
-        * it will throw an instance of CoreException.
-        * @param reason The restart reason to show to all clients
-        * @throw CoreException An instance of CoreException indicating the error from execv().
-        */
-       void Restart(const std::string &reason);
-
        /** Prepare the ircd for restart or shutdown.
         * This function unloads all modules which can be unloaded,
         * closes all open sockets, and closes the logfile.
index 404175ddb456a59a2a48607056c3f33a08ced212..c38f89d4d353b952ab901cf87875a92e4bd3930d 100644 (file)
 #pragma once
 
 class BanCacheManager;
-class BanItem;
 class BufferedSocket;
 class Channel;
 class Command;
-class ConfigReader;
 class ConfigTag;
 class Extensible;
 class FakeUser;
@@ -77,10 +75,6 @@ typedef std::set<Channel*> UserChanList;
  */
 typedef UserChanList::iterator UCListIter;
 
-/** Holds a complete ban list
- */
-typedef std::vector<BanItem> BanList;
-
 /** A list of custom modes parameters on a channel
  */
 typedef std::map<char,std::string> CustomModeList;
index 31e61d161c8ef98ab7a66a75f41c2a8e325de2ad..457934d2b1a6a480af48bf6be98160ba2688c1be 100644 (file)
@@ -108,30 +108,6 @@ bool CommandParser::LoopCall(User* user, Command* handler, const std::vector<std
        return true;
 }
 
-bool CommandParser::IsValidCommand(const std::string &commandname, unsigned int pcnt, User * user)
-{
-       Commandtable::iterator n = cmdlist.find(commandname);
-
-       if (n != cmdlist.end())
-       {
-               if ((pcnt >= n->second->min_params))
-               {
-                       if (IS_LOCAL(user) && n->second->flags_needed)
-                       {
-                               if (user->IsModeSet(n->second->flags_needed))
-                               {
-                                       return (user->HasPermission(commandname));
-                               }
-                       }
-                       else
-                       {
-                               return true;
-                       }
-               }
-       }
-       return false;
-}
-
 Command* CommandParser::GetHandler(const std::string &commandname)
 {
        Commandtable::iterator n = cmdlist.find(commandname);
index a469de640b4ef122844510a7c8f3d4550c26ce47..29156973c0cd47767beb1b79e6b68809571c720a 100644 (file)
@@ -140,35 +140,6 @@ void InspIRCd::Cleanup()
        DeleteZero(this->Logs);
 }
 
-void InspIRCd::Restart(const std::string &reason)
-{
-       /* SendError flushes each client's queue,
-        * regardless of writeability state
-        */
-       this->SendError(reason);
-
-       /* Figure out our filename (if theyve renamed it, we're boned) */
-       std::string me;
-
-       char** argv = Config->cmdline.argv;
-
-#ifdef _WIN32
-       char module[MAX_PATH];
-       if (GetModuleFileNameA(NULL, module, MAX_PATH))
-               me = module;
-#else
-       me = argv[0];
-#endif
-
-       this->Cleanup();
-
-       if (execv(me.c_str(), argv) == -1)
-       {
-               /* Will raise a SIGABRT if not trapped */
-               throw CoreException(std::string("Failed to execv()! error: ") + strerror(errno));
-       }
-}
-
 void InspIRCd::SetSignals()
 {
 #ifndef _WIN32
index c82ee3f7ae3e901f38e7c01249d695741bc7f666..44c36919bbb606dd16f031fd9a97a237d2af19ba 100644 (file)
@@ -58,7 +58,7 @@ class AllModule : public Module
                        {
                                Command* c = (*i)(this);
                                cmds.push_back(c);
-                               ServerInstance->AddCommand(c);
+                               ServerInstance->Modules->AddService(*c);
                        }
                }
                catch (...)