]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Change cmd_*.so to use the Module object API
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 3 Sep 2009 02:30:12 +0000 (02:30 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 3 Sep 2009 02:30:12 +0000 (02:30 +0000)
Create Module* objects for each command, and load them like modules.
This unifies the external API for modules.

Library directory is now deprecated: all modules are located in a
single module directory.

Header files for each command are no longer needed; remove.

This also fixes two potential segfaults in m_spanningtree.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11668 e03df62e-2008-0410-955e-edbf42e46eb7

152 files changed:
.Makefile.inc
.inspircd.inc
configure
include/command_parse.h
include/commands/cmd_admin.h [deleted file]
include/commands/cmd_away.h [deleted file]
include/commands/cmd_clearcache.h [deleted file]
include/commands/cmd_commands.h [deleted file]
include/commands/cmd_connect.h [deleted file]
include/commands/cmd_die.h [deleted file]
include/commands/cmd_eline.h [deleted file]
include/commands/cmd_gline.h [deleted file]
include/commands/cmd_info.h [deleted file]
include/commands/cmd_invite.h [deleted file]
include/commands/cmd_ison.h [deleted file]
include/commands/cmd_join.h [deleted file]
include/commands/cmd_kick.h [deleted file]
include/commands/cmd_kill.h [deleted file]
include/commands/cmd_kline.h [deleted file]
include/commands/cmd_links.h [deleted file]
include/commands/cmd_list.h [deleted file]
include/commands/cmd_loadmodule.h [deleted file]
include/commands/cmd_lusers.h [deleted file]
include/commands/cmd_map.h [deleted file]
include/commands/cmd_mode.h [deleted file]
include/commands/cmd_modules.h [deleted file]
include/commands/cmd_motd.h [deleted file]
include/commands/cmd_names.h [deleted file]
include/commands/cmd_nick.h [deleted file]
include/commands/cmd_notice.h [deleted file]
include/commands/cmd_oper.h [deleted file]
include/commands/cmd_part.h [deleted file]
include/commands/cmd_pass.h [deleted file]
include/commands/cmd_ping.h [deleted file]
include/commands/cmd_pong.h [deleted file]
include/commands/cmd_privmsg.h [deleted file]
include/commands/cmd_qline.h [deleted file]
include/commands/cmd_quit.h [deleted file]
include/commands/cmd_rehash.h [deleted file]
include/commands/cmd_reloadmodule.h [deleted file]
include/commands/cmd_restart.h [deleted file]
include/commands/cmd_rules.h [deleted file]
include/commands/cmd_server.h [deleted file]
include/commands/cmd_squit.h [deleted file]
include/commands/cmd_stats.h [deleted file]
include/commands/cmd_time.h [deleted file]
include/commands/cmd_topic.h [deleted file]
include/commands/cmd_trace.h [deleted file]
include/commands/cmd_unloadmodule.h [deleted file]
include/commands/cmd_user.h [deleted file]
include/commands/cmd_userhost.h [deleted file]
include/commands/cmd_version.h [deleted file]
include/commands/cmd_wallops.h [deleted file]
include/commands/cmd_who.h [deleted file]
include/commands/cmd_whois.h [deleted file]
include/commands/cmd_whowas.h
include/commands/cmd_zline.h [deleted file]
include/inspircd.h
include/modules.h
make/configure.pm
src/command_parse.cpp
src/commands/cmd_admin.cpp
src/commands/cmd_away.cpp
src/commands/cmd_clearcache.cpp
src/commands/cmd_commands.cpp
src/commands/cmd_connect.cpp
src/commands/cmd_die.cpp
src/commands/cmd_eline.cpp
src/commands/cmd_gline.cpp
src/commands/cmd_info.cpp
src/commands/cmd_invite.cpp
src/commands/cmd_ison.cpp
src/commands/cmd_join.cpp
src/commands/cmd_kick.cpp
src/commands/cmd_kill.cpp
src/commands/cmd_kline.cpp
src/commands/cmd_links.cpp
src/commands/cmd_list.cpp
src/commands/cmd_loadmodule.cpp
src/commands/cmd_lusers.cpp
src/commands/cmd_map.cpp
src/commands/cmd_mode.cpp
src/commands/cmd_modules.cpp
src/commands/cmd_motd.cpp
src/commands/cmd_names.cpp
src/commands/cmd_nick.cpp
src/commands/cmd_notice.cpp
src/commands/cmd_oper.cpp
src/commands/cmd_part.cpp
src/commands/cmd_pass.cpp
src/commands/cmd_ping.cpp
src/commands/cmd_pong.cpp
src/commands/cmd_privmsg.cpp
src/commands/cmd_qline.cpp
src/commands/cmd_quit.cpp
src/commands/cmd_rehash.cpp
src/commands/cmd_reloadmodule.cpp
src/commands/cmd_restart.cpp
src/commands/cmd_rules.cpp
src/commands/cmd_server.cpp
src/commands/cmd_squit.cpp
src/commands/cmd_stats.cpp
src/commands/cmd_time.cpp
src/commands/cmd_topic.cpp
src/commands/cmd_trace.cpp
src/commands/cmd_unloadmodule.cpp
src/commands/cmd_user.cpp
src/commands/cmd_userhost.cpp
src/commands/cmd_version.cpp
src/commands/cmd_wallops.cpp
src/commands/cmd_who.cpp
src/commands/cmd_whois.cpp
src/commands/cmd_whowas.cpp
src/commands/cmd_zline.cpp
src/inspircd.cpp
src/modules.cpp
src/modules/m_spanningtree/cachetimer.cpp
src/modules/m_spanningtree/handshaketimer.cpp
src/modules/m_spanningtree/hmac.cpp
src/modules/m_spanningtree/main.cpp
src/modules/m_spanningtree/override_admin.cpp
src/modules/m_spanningtree/override_modules.cpp
src/modules/m_spanningtree/override_motd.cpp
src/modules/m_spanningtree/override_squit.cpp
src/modules/m_spanningtree/override_stats.cpp
src/modules/m_spanningtree/override_time.cpp
src/modules/m_spanningtree/override_whois.cpp
src/modules/m_spanningtree/ping.cpp
src/modules/m_spanningtree/pong.cpp
src/modules/m_spanningtree/postcommand.cpp
src/modules/m_spanningtree/precommand.cpp
src/modules/m_spanningtree/push.cpp
src/modules/m_spanningtree/rconnect.cpp
src/modules/m_spanningtree/resolvers.cpp
src/modules/m_spanningtree/resolvers.h
src/modules/m_spanningtree/rsquit.cpp
src/modules/m_spanningtree/save.cpp
src/modules/m_spanningtree/server.cpp
src/modules/m_spanningtree/stats.cpp
src/modules/m_spanningtree/svsjoin.cpp
src/modules/m_spanningtree/svsnick.cpp
src/modules/m_spanningtree/svspart.cpp
src/modules/m_spanningtree/time.cpp
src/modules/m_spanningtree/treeserver.cpp
src/modules/m_spanningtree/treesocket.h
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/treesocket2.cpp
src/modules/m_spanningtree/utils.cpp
src/modules/m_spanningtree/version.cpp
src/modules/m_spanningtree/whois.cpp
src/stats.cpp [new file with mode: 0644]
src/whois.cpp [new file with mode: 0644]

index 3cc18b60de1df2f038dba15c5acb5c09c7149656..f0ea08214272f9d4c1b0e65233ee7aaaf1319201 100644 (file)
@@ -20,7 +20,6 @@ CONPATH = "@CONFIG_DIR@"
 MODPATH = "@MODULE_DIR@"
 BINPATH = "@BINARY_DIR@"
 LAUNCHDPATH = "/System/Library/LaunchDaemons"
-LIBPATH = "@LIBRARY_DIR@"
 INSTMODE = 0755
 
 @IFEQ $(CC) icc
@@ -66,7 +65,7 @@ CXXFLAGS += -I../include
 @ENDIF
 
 @DO_EXPORT RUNCC CXXFLAGS CC LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS
-@DO_EXPORT BASE CONPATH MODPATH BINPATH LIBPATH
+@DO_EXPORT BASE CONPATH MODPATH BINPATH
 
 # Default target
 TARGET = all
@@ -135,11 +134,10 @@ finishmessage: target
 
 install: target@EXTRA_DIR@
        @-install -d -m $(INSTMODE) $(BASE)
-       @-install -d -m $(INSTMODE) $(LIBPATH)
        @-install -d -m $(INSTMODE) $(BINPATH)
        @-install -d -m $(INSTMODE) $(CONPATH)
        @-install -d -m $(INSTMODE) $(MODPATH)
-       -install -m $(INSTMODE) src/commands/*.so $(LIBPATH)
+       -install -m $(INSTMODE) src/commands/*.so $(MODPATH)
        -install -m $(INSTMODE) src/modules/*.so $(MODPATH)
        -install -m $(INSTMODE) @STARTSCRIPT@ $(@DESTINATION@) 2>/dev/null
        -install -m $(INSTMODE) src/inspircd $(BINPATH)
@@ -164,7 +162,6 @@ clean:
 
 deinstall:
        -rm $(BINPATH)/inspircd
-       -rm $(LIBPATH)/*.so
        -rm $(MODPATH)/*.so
        @make/install-extras.pl deinstall
 
index 6181d66ec523852caae5b293998076d020d805fc..362bdcf67ffcbb2d20055ed9edce987513548d98 100644 (file)
@@ -18,7 +18,6 @@ use Fcntl;
 my $basepath   =       "@BASE_DIR@";
 my $confpath   =       "@CONFIG_DIR@/";
 my $binpath    =       "@BINARY_DIR@";
-my $libpath    =       "@LIBRARY_DIR@";
 my $valgrindlogpath    =       "$basepath/valgrindlogs";
 my $executable =       "@EXECUTABLE@";
 my $version    =       "@VERSION@";
index 0a9c2b6fbfac9b7abcc59510931fc0fecf6f6fda..dfdb43d7d98823164d6cb0c38aeed9024533894e 100755 (executable)
--- a/configure
+++ b/configure
@@ -139,7 +139,6 @@ if (defined $opt_base_dir)
 $config{CONFIG_DIR}     = resolve_directory($config{BASE_DIR}."/conf");        # Configuration Directory
 $config{MODULE_DIR}     = resolve_directory($config{BASE_DIR}."/modules");     # Modules Directory
 $config{BINARY_DIR}     = resolve_directory($config{BASE_DIR}."/bin");         # Binary Directory
-$config{LIBRARY_DIR}   = resolve_directory($config{BASE_DIR}."/lib");          # Library Directory
 
 if (defined $opt_config_dir)
 {
@@ -153,10 +152,6 @@ if (defined $opt_binary_dir)
 {
        $config{BINARY_DIR} = $opt_binary_dir;
 }
-if (defined $opt_library_dir)
-{
-       $config{LIBRARY_DIR} = $opt_library_dir;
-}
 chomp($config{HAS_GNUTLS}   = `pkg-config --modversion gnutls 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
 
 if (defined $opt_freebsd_port)
@@ -611,13 +606,11 @@ should NOT be used. You should probably specify a newer compiler.\n\n";
                $config{CONFIG_DIR}      = resolve_directory($config{BASE_DIR}."/conf");           # Configuration Dir
                $config{MODULE_DIR}      = resolve_directory($config{BASE_DIR}."/modules");     # Modules Directory
                $config{BINARY_DIR}      = resolve_directory($config{BASE_DIR}."/bin");     # Binary Directory
-               $config{LIBRARY_DIR}    = resolve_directory($config{BASE_DIR}."/lib");      # Library Directory
        }
 
        dir_check("are the configuration files", "CONFIG_DIR");
        dir_check("are the modules to be compiled to", "MODULE_DIR");
        dir_check("is the IRCd binary to be placed", "BINARY_DIR");
-       dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
 
        my $chose_hiperf = 0;
        if ($has_kqueue) {
@@ -936,7 +929,6 @@ sub writefiles {
 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
 #define MOD_PATH "$config{MODULE_DIR}"
 #define SOMAXCONN_S "$config{_SOMAXCONN}"
-#define LIBRARYDIR "$config{LIBRARY_DIR}"
 #define ENTRYPOINT int main(int argc, char** argv)
 
 EOF
@@ -1084,7 +1076,7 @@ EOF
 
                        print "Writing \e[1;32m$file\e[0m ...\n";
                        for my $var (qw(
-                               CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR
+                               CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR
                                STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE CORE_FLAGS
                        )) {
                                s/\@$var\@/$config{$var}/g;
index f176394a7526e784b1b23e0c3c7f9822cc8895ae..7ee0e8a079ba4a79f9744f933b273c5798b4b896 100644 (file)
@@ -47,24 +47,6 @@ class CoreExport CommandParser : public classbase
         */
        bool ProcessCommand(User *user, std::string &cmd);
 
-       /** Finds the init_command symbol in a .so file
-        * @param v A function pointer to be initialized
-        * @param h A valid shared object handle
-        * @param name The filename being loaded, used for error reporting
-        * @return True if the symbol could be found
-        */
-       bool FindSym(void** v, void* h, const std::string &name);
-
-       /** A list of core-implemented modes and their shared object handles
-        */
-       SharedObjectList RFCCommands;
-
-       /** Load a command from a shared object on disk.
-        * @param name The shared object to load (without path)
-        * @return NULL on success, pointer to dlerrr() error message on failure
-        */
-       const char* LoadCommand(const char* name);
-
        /** Removes a command if the sources match. Used as a helper for
         *  safe hash_map delete while iter in RemoveCommands(const char* source).
         */
@@ -76,16 +58,6 @@ class CoreExport CommandParser : public classbase
         */
        Commandtable cmdlist;
 
-       /** Reload a core command.
-        * This will only reload commands implemented by the core,
-        * to reload a modular command, you must reload that module.
-        * @param cmd The command to reload. This will cause the shared
-        * object which implements this command to be closed, and then reloaded.
-        * @return True if the command was reloaded, false if it could not be found
-        * or another error occured
-        */
-       bool ReloadCommand(std::string cmd, User* user);
-
        /** Default constructor.
         * @param Instance The creator of this class
         */
@@ -182,22 +154,11 @@ class CoreExport CommandParser : public classbase
         */
        void RemoveCommands(Module* source);
 
-       /** Remove all core commands and unload their shared objects
-        */
-       void RemoveRFCCommands();
-
        /** Add a new command to the commands hash
         * @param f The new Command to add to the list
-        * @param so_handle The handle to the shared object where the command can be found.
-        * Only core commands loaded via cmd_*.so files should set this parameter to anything
-        * meaningful. Module authors should leave this parameter at its default of NULL.
         * @return True if the command was added
         */
-       bool CreateCommand(Command *f, void* so_handle = NULL);
-
-       /** Insert the default RFC1459 commands into the command hash.
-        */
-       void SetupCommandTable();
+       bool CreateCommand(Command *f);
 
        /** Translate nicknames in a string into UIDs, based on the TranslationType given.
         * @param to The translation type to use for the process.
@@ -218,20 +179,6 @@ class CoreExport CommandParser : public classbase
        int TranslateUIDs(const std::vector<TranslateType> to, const std::vector<std::string> &source, std::string &dest, bool prefix_final = false, Command* custom_translator = NULL);
 };
 
-/** Command handler class for the RELOAD command.
- * A command cant really reload itself, so this has to be in here.
- */
-class CommandReload : public Command
-{
- public:
-       /** Standard constructor
-        */
-       CommandReload (InspIRCd* Instance) : Command(Instance,NULL,"RELOAD","o",1) { syntax = "<core-command>"; }
-       /** Handle RELOAD
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
 /** A lookup table of values for multiplier characters used by
  * InspIRCd::Duration(). In this lookup table, the indexes for
  * the ascii values 'm' and 'M' have the value '60', the indexes
diff --git a/include/commands/cmd_admin.h b/include/commands/cmd_admin.h
deleted file mode 100644 (file)
index b82331c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_ADMIN_H__
-#define __CMD_ADMIN_H__
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /ADMIN. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandAdmin : public Command
-{
- public:
-       /** Constructor for admin.
-        */
-       CommandAdmin (InspIRCd* Instance) : Command(Instance,NULL,"ADMIN",0,0) { syntax = "[<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_away.h b/include/commands/cmd_away.h
deleted file mode 100644 (file)
index 9cde32f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_AWAY_H__
-#define __CMD_AWAY_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /AWAY. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandAway : public Command
-{
- public:
-       /** Constructor for away.
-        */
-       CommandAway (InspIRCd* Instance) : Command(Instance,NULL,"AWAY",0,0) { syntax = "[<message>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_clearcache.h b/include/commands/cmd_clearcache.h
deleted file mode 100644 (file)
index 00e41fc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_ADMIN_H__
-#define __CMD_ADMIN_H__
-
-#include "users.h"
-#include "channels.h"
-#include "ctables.h"
-
-/** Handle /ADMIN. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandClearcache : public Command
-{
- public:
-       /** Constructor for clearcache.
-        */
-       CommandClearcache (InspIRCd* Instance) : Command(Instance,NULL,"CLEARCACHE","o",0) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_commands.h b/include/commands/cmd_commands.h
deleted file mode 100644 (file)
index 13c5ee0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_COMMANDS_H__
-#define __CMD_COMMANDS_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /COMMANDS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandCommands : public Command
-{
- public:
-       /** Constructor for commands.
-        */
-       CommandCommands (InspIRCd* Instance) : Command(Instance,NULL,"COMMANDS",0,0) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_connect.h b/include/commands/cmd_connect.h
deleted file mode 100644 (file)
index 2088446..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_CONNECT_H__
-#define __CMD_CONNECT_H__
-
-#include "users.h"
-#include "channels.h"
-#include "ctables.h"
-#include "modules.h"
-
-/** Handle /CONNECT. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandConnect : public Command
-{
- public:
-       /** Constructor for connect.
-        */
-       CommandConnect (InspIRCd* Instance) : Command(Instance,NULL,"CONNECT","o",1,false,0) { syntax = "<servername> [<remote-server>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_die.h b/include/commands/cmd_die.h
deleted file mode 100644 (file)
index 156a150..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_DIE_H__
-#define __CMD_DIE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /DIE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandDie : public Command
-{
- public:
-       /** Constructor for die.
-        */
-       CommandDie (InspIRCd* Instance) : Command(Instance,NULL,"DIE","o",1,false,0) { syntax = "<password>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_eline.h b/include/commands/cmd_eline.h
deleted file mode 100644 (file)
index 2ac9ade..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_ELINE_H__
-#define __CMD_ELINE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /ELINE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandEline : public Command
-{
- public:
-       /** Constructor for eline.
-        */
-       CommandEline (InspIRCd* Instance) : Command(Instance,NULL,"ELINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_gline.h b/include/commands/cmd_gline.h
deleted file mode 100644 (file)
index 9548279..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_GLINE_H__
-#define __CMD_GLINE_H__
-
-// include the common header file
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /GLINE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandGline : public Command
-{
- public:
-       /** Constructor for gline.
-        */
-       CommandGline (InspIRCd* Instance) : Command(Instance,NULL,"GLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_info.h b/include/commands/cmd_info.h
deleted file mode 100644 (file)
index 85d7d4c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_INFO_H__
-#define __CMD_INFO_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /INFO. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandInfo : public Command
-{
- public:
-       /** Constructor for info.
-        */
-       CommandInfo (InspIRCd* Instance) : Command(Instance,NULL,"INFO",0,0) { syntax = "[<servermask>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_invite.h b/include/commands/cmd_invite.h
deleted file mode 100644 (file)
index ce048e7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_INVITE_H__
-#define __CMD_INVITE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /INVITE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandInvite : public Command
-{
- public:
-       /** Constructor for invite.
-        */
-       CommandInvite (InspIRCd* Instance) : Command(Instance,NULL,"INVITE", 0, 0, false, 4) { syntax = "[<nick> <channel>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_ison.h b/include/commands/cmd_ison.h
deleted file mode 100644 (file)
index 93f3356..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_ISON_H__
-#define __CMD_ISON_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /ISON. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandIson : public Command
-{
- public:
-       /** Constructor for ison.
-        */
-       CommandIson (InspIRCd* Instance) : Command(Instance,NULL,"ISON",0,0) { syntax = "<nick> {nick}"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_join.h b/include/commands/cmd_join.h
deleted file mode 100644 (file)
index 2ea32de..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_JOIN_H__
-#define __CMD_JOIN_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /JOIN. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandJoin : public Command
-{
- public:
-       /** Constructor for join.
-        */
-       CommandJoin (InspIRCd* Instance) : Command(Instance,NULL,"JOIN", 0, 1, false, 2) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_kick.h b/include/commands/cmd_kick.h
deleted file mode 100644 (file)
index be6a40b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_KICK_H__
-#define __CMD_KICK_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /KICK. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandKick : public Command
-{
- public:
-       /** Constructor for kick.
-        */
-       CommandKick (InspIRCd* Instance) : Command(Instance,NULL,"KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_kill.h b/include/commands/cmd_kill.h
deleted file mode 100644 (file)
index 392975f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_KILL_H__
-#define __CMD_KILL_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /KILL. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandKill : public Command
-{
- public:
-       /** Constructor for kill.
-        */
-       CommandKill (InspIRCd* Instance) : Command(Instance,NULL,"KILL","o",2,false,0) { syntax = "<nickname> <reason>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_kline.h b/include/commands/cmd_kline.h
deleted file mode 100644 (file)
index 5744de5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_KLINE_H__
-#define __CMD_KLINE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /KLINE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandKline : public Command
-{
- public:
-       /** Constructor for kline.
-        */
-       CommandKline (InspIRCd* Instance) : Command(Instance,NULL,"KLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_links.h b/include/commands/cmd_links.h
deleted file mode 100644 (file)
index fbfdb62..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_LINKS_H__
-#define __CMD_LINKS_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /LINKS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandLinks : public Command
-{
- public:
-       /** Constructor for links.
-        */
-       CommandLinks (InspIRCd* Instance) : Command(Instance,NULL,"LINKS",0,0) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_list.h b/include/commands/cmd_list.h
deleted file mode 100644 (file)
index 8801b8c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_LIST_H__
-#define __CMD_LIST_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /LIST. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandList : public Command
-{
- public:
-       /** Constructor for list.
-        */
-       CommandList (InspIRCd* Instance) : Command(Instance,NULL,"LIST", 0, 0, false, 5) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_loadmodule.h b/include/commands/cmd_loadmodule.h
deleted file mode 100644 (file)
index 9d31f07..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_LOADMODULE_H__
-#define __CMD_LOADMODULE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /LOADMODULE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandLoadmodule : public Command
-{
- public:
-       /** Constructor for loadmodule.
-        */
-       CommandLoadmodule (InspIRCd* Instance) : Command(Instance,NULL,"LOADMODULE","o",1) { syntax = "<modulename>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_lusers.h b/include/commands/cmd_lusers.h
deleted file mode 100644 (file)
index 2c5d3d4..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_LUSERS_H__
-#define __CMD_LUSERS_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /LUSERS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandLusers : public Command
-{
- public:
-       /** Constructor for lusers.
-        */
-       CommandLusers (InspIRCd* Instance) : Command(Instance,NULL,"LUSERS",0,0) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_map.h b/include/commands/cmd_map.h
deleted file mode 100644 (file)
index 183d597..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_MAP_H__
-#define __CMD_MAP_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /MAP. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandMap : public Command
-{
- public:
-       /** Constructor for map.
-        */
-       CommandMap (InspIRCd* Instance) : Command(Instance,NULL,"MAP",0,0,false,2) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_mode.h b/include/commands/cmd_mode.h
deleted file mode 100644 (file)
index 83ab00b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_ADMIN_H__
-#define __CMD_ADMIN_H__
-
-#include "users.h"
-#include "channels.h"
-#include "ctables.h"
-
-/** Handle /MODE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandMode : public Command
-{
- public:
-       /** Constructor for mode.
-        */
-       CommandMode (InspIRCd* Instance) : Command(Instance,NULL,"MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_modules.h b/include/commands/cmd_modules.h
deleted file mode 100644 (file)
index 18dc76c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_MODULES_H__
-#define __CMD_MODULES_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /MODULES. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandModules : public Command
-{
- public:
-       /** Constructor for modules.
-        */
-       CommandModules (InspIRCd* Instance) : Command(Instance,NULL,"MODULES",0,0) { syntax = "[debug]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_motd.h b/include/commands/cmd_motd.h
deleted file mode 100644 (file)
index b57d851..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_MOTD_H__
-#define __CMD_MOTD_H__
-
-// include the common header files
-
-#include <string>
-#include <vector>
-#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-
-/** Handle /MOTD. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandMotd : public Command
-{
- public:
-       /** Constructor for motd.
-        */
-       CommandMotd (InspIRCd* Instance) : Command(Instance,NULL,"MOTD",0,0) { syntax = "[<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_names.h b/include/commands/cmd_names.h
deleted file mode 100644 (file)
index 174b6aa..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_NAMES_H__
-#define __CMD_NAMES_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /NAMES. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandNames : public Command
-{
- public:
-       /** Constructor for names.
-        */
-       CommandNames (InspIRCd* Instance) : Command(Instance,NULL,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_nick.h b/include/commands/cmd_nick.h
deleted file mode 100644 (file)
index b3a8e12..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_NICK_H__
-#define __CMD_NICK_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /NICK. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandNick : public Command
-{
-       bool allowinvalid;
- public:
-       /** Constructor for nick.
-        */
-       CommandNick (InspIRCd* Instance) : Command(Instance,NULL,"NICK", 0, 1, true, 3), allowinvalid(false) { syntax = "<newnick>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-
-       /** Handle internal command
-        * @param id Used to indicate if invalid nick changes are allowed.
-        * Set to 1 to allow invalid nicks and 0 to deny them.
-        * @param parameters Currently unused
-        */
-       CmdResult HandleInternal(const unsigned int id, const std::deque<classbase*> &parameters);
-};
-
-#endif
diff --git a/include/commands/cmd_notice.h b/include/commands/cmd_notice.h
deleted file mode 100644 (file)
index 580376f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_NOTICE_H__
-#define __CMD_NOTICE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /NOTICE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandNotice : public Command
-{
- public:
-       /** Constructor for notice.
-        */
-       CommandNotice (InspIRCd* Instance) : Command(Instance,NULL,"NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_oper.h b/include/commands/cmd_oper.h
deleted file mode 100644 (file)
index dd0b631..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_OPER_H__
-#define __CMD_OPER_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-bool OneOfMatches(const char* host, const char* ip, const char* hostlist);
-
-/** Handle /OPER. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandOper : public Command
-{
- public:
-       /** Constructor for oper.
-        */
-       CommandOper (InspIRCd* Instance) : Command(Instance,NULL,"OPER",0,2,false,2) { syntax = "<username> <password>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_part.h b/include/commands/cmd_part.h
deleted file mode 100644 (file)
index 01284cc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_PART_H__
-#define __CMD_PART_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /PART. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandPart : public Command
-{
- public:
-       /** Constructor for part.
-        */
-       CommandPart (InspIRCd* Instance) : Command(Instance,NULL,"PART", 0, 1, false, 5) { syntax = "<channel>{,<channel>} [<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_pass.h b/include/commands/cmd_pass.h
deleted file mode 100644 (file)
index 21eb378..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_PASS_H__
-#define __CMD_PASS_H__
-
-// include the common header files
-
-#include <string>
-#include <vector>
-#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-
-/** Handle /PASS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandPass : public Command
-{
- public:
-       /** Constructor for pass.
-        */
-       CommandPass (InspIRCd* Instance) : Command(Instance,NULL,"PASS",0,1,true,0) { syntax = "<password>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_ping.h b/include/commands/cmd_ping.h
deleted file mode 100644 (file)
index 56570d2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_PING_H__
-#define __CMD_PING_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /PING. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandPing : public Command
-{
- public:
-       /** Constructor for ping.
-        */
-       CommandPing (InspIRCd* Instance) : Command(Instance,NULL,"PING", 0, 1, false, 0) { syntax = "<servername> [:<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_pong.h b/include/commands/cmd_pong.h
deleted file mode 100644 (file)
index 58d862a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_PONG_H__
-#define __CMD_PONG_H__
-
-// include the common header files
-
-#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-
-/** Handle /PONG. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandPong : public Command
-{
- public:
-       /** Constructor for pong.
-        */
-       CommandPong (InspIRCd* Instance) : Command(Instance,NULL,"PONG", 0, 1, false, 0) { syntax = "<ping-text>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_privmsg.h b/include/commands/cmd_privmsg.h
deleted file mode 100644 (file)
index 7499098..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_PRIVMSG_H__
-#define __CMD_PRIVMSG_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /PRIVMSG. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandPrivmsg : public Command
-{
- public:
-       /** Constructor for privmsg.
-        */
-       CommandPrivmsg (InspIRCd* Instance) : Command(Instance,NULL,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_qline.h b/include/commands/cmd_qline.h
deleted file mode 100644 (file)
index 352ebdd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_QLINE_H__
-#define __CMD_QLINE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /QLINE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandQline : public Command
-{
- public:
-       /** Constructor for qline.
-        */
-       CommandQline (InspIRCd* Instance) : Command(Instance,NULL,"QLINE","o",1,3,false,0) { syntax = "<nick> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_quit.h b/include/commands/cmd_quit.h
deleted file mode 100644 (file)
index f1430e4..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_QUIT_H__
-#define __CMD_QUIT_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /QUIT. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandQuit : public Command
-{
- public:
-       /** Constructor for quit.
-        */
-       CommandQuit (InspIRCd* Instance) : Command(Instance,NULL,"QUIT",0,0,true) { syntax = "[<message>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_rehash.h b/include/commands/cmd_rehash.h
deleted file mode 100644 (file)
index 6c294ff..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_REHASH_H__
-#define __CMD_REHASH_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /REHASH. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandRehash : public Command
-{
- public:
-       /** Constructor for rehash.
-        */
-       CommandRehash (InspIRCd* Instance) : Command(Instance,NULL,"REHASH","o",0,false,3) { syntax = "[<servermask>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_reloadmodule.h b/include/commands/cmd_reloadmodule.h
deleted file mode 100644 (file)
index d75ec56..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_RELOADMODULE_H__
-#define __CMD_RELOADMODULE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /RELOADMODULE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandReloadmodule : public Command
-{
- public:
-       /** Constructor for reloadmodule.
-        */
-       CommandReloadmodule (InspIRCd* Instance) : Command(Instance,NULL,"RELOADMODULE","o",1) { syntax = "<modulename>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_restart.h b/include/commands/cmd_restart.h
deleted file mode 100644 (file)
index cd55ed1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_RESTART_H__
-#define __CMD_RESTART_H__
-
-// include the common header files
-
-#include <string>
-#include <deque>
-#include <vector>
-#include "users.h"
-#include "channels.h"
-
-/** Handle /RESTART. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandRestart : public Command
-{
- public:
-       /** Constructor for restart.
-        */
-       CommandRestart (InspIRCd* Instance) : Command(Instance,NULL,"RESTART","o",1,false,0) { syntax = "<password>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_rules.h b/include/commands/cmd_rules.h
deleted file mode 100644 (file)
index f0d6a39..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_RULES_H__
-#define __CMD_RULES_H__
-
-// include the common header files
-
-#include <string>
-#include <vector>
-#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-
-/** Handle /RULES. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandRules : public Command
-{
- public:
-       /** Constructor for rules.
-        */
-       CommandRules (InspIRCd* Instance) : Command(Instance,NULL,"RULES",0,0) { syntax = "[<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_server.h b/include/commands/cmd_server.h
deleted file mode 100644 (file)
index f346955..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_SERVER_H__
-#define __CMD_SERVER_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /SERVER. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandServer : public Command
-{
- public:
-       /** Constructor for server.
-        */
-       CommandServer (InspIRCd* Instance) : Command(Instance,NULL,"SERVER",0,0,true) { }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_squit.h b/include/commands/cmd_squit.h
deleted file mode 100644 (file)
index 6090831..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_SQUIT_H__
-#define __CMD_SQUIT_H__
-
-// include the common header files
-
-#include <string>
-#include <vector>
-#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-
-/** Handle /SQUIT. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandSquit : public Command
-{
- public:
-       /** Constructor for squit.
-        */
-       CommandSquit (InspIRCd* Instance) : Command(Instance,NULL,"SQUIT","o",1) { syntax = "<servername> [<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_stats.h b/include/commands/cmd_stats.h
deleted file mode 100644 (file)
index 8df7def..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_STATS_H__
-#define __CMD_STATS_H__
-
-// include the common header files
-
-#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-
-DllExport void DoStats(InspIRCd* Instance, char statschar, User* user, string_list &results);
-
-/** Handle /STATS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandStats : public Command
-{
- public:
-       /** Constructor for stats.
-        */
-       CommandStats (InspIRCd* Instance) : Command(Instance,NULL,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_time.h b/include/commands/cmd_time.h
deleted file mode 100644 (file)
index 6886189..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_TIME_H__
-#define __CMD_TIME_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /TIME. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandTime : public Command
-{
- public:
-       /** Constructor for time.
-        */
-       CommandTime (InspIRCd* Instance) : Command(Instance,NULL,"TIME",0,0) { syntax = "[<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_topic.h b/include/commands/cmd_topic.h
deleted file mode 100644 (file)
index dc5ce1c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_TOPIC_H__
-#define __CMD_TOPIC_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /TOPIC. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandTopic : public Command
-{
- public:
-       /** Constructor for topic.
-        */
-       CommandTopic (InspIRCd* Instance) : Command(Instance,NULL,"TOPIC",0,1,false,2) { syntax = "<channel> [<topic>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_trace.h b/include/commands/cmd_trace.h
deleted file mode 100644 (file)
index 871d150..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_TRACE_H__
-#define __CMD_TRACE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /TRACE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandTrace : public Command
-{
- public:
-       /** Constructor for trace.
-        */
-       CommandTrace (InspIRCd* Instance) : Command(Instance,NULL,"TRACE","o",0) { syntax = "[<object>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_unloadmodule.h b/include/commands/cmd_unloadmodule.h
deleted file mode 100644 (file)
index dd60bfd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_UNLOADMODULE_H__
-#define __CMD_UNLOADMODULE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /UNLOADMODULE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandUnloadmodule : public Command
-{
- public:
-       /** Constructor for unloadmodule.
-        */
-       CommandUnloadmodule (InspIRCd* Instance) : Command(Instance,NULL,"UNLOADMODULE","o",1) { syntax = "<modulename>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_user.h b/include/commands/cmd_user.h
deleted file mode 100644 (file)
index 9bc28b9..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_USER_H__
-#define __CMD_USER_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /USER. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandUser : public Command
-{
- public:
-       /** Constructor for user.
-        */
-       CommandUser (InspIRCd* Instance) : Command(Instance,NULL,"USER",0,4,true,0) { syntax = "<username> <localhost> <remotehost> <GECOS>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_userhost.h b/include/commands/cmd_userhost.h
deleted file mode 100644 (file)
index 1ba15f5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_USERHOST_H__
-#define __CMD_USERHOST_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /USERHOST. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandUserhost : public Command
-{
- public:
-       /** Constructor for userhost.
-        */
-       CommandUserhost (InspIRCd* Instance) : Command(Instance,NULL,"USERHOST",0,1) { syntax = "<nick>{,<nick>}"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_version.h b/include/commands/cmd_version.h
deleted file mode 100644 (file)
index f093591..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_VERSION_H__
-#define __CMD_VERSION_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /VERSION. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandVersion : public Command
-{
- public:
-       /** Constructor for version.
-        */
-       CommandVersion (InspIRCd* Instance) : Command(Instance,NULL,"VERSION",0,0) { syntax = "[<servername>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_wallops.h b/include/commands/cmd_wallops.h
deleted file mode 100644 (file)
index 34089cd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_WALLOPS_H__
-#define __CMD_WALLOPS_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /WALLOPS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandWallops : public Command
-{
- public:
-       /** Constructor for wallops.
-        */
-       CommandWallops (InspIRCd* Instance) : Command(Instance,NULL,"WALLOPS","o",1,1) { syntax = "<any-text>"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
diff --git a/include/commands/cmd_who.h b/include/commands/cmd_who.h
deleted file mode 100644 (file)
index 65adc54..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_WHO_H__
-#define __CMD_WHO_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /WHO. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandWho : public Command
-{
-       bool CanView(Channel* chan, User* user);
-       bool opt_viewopersonly;
-       bool opt_showrealhost;
-       bool opt_unlimit;
-       bool opt_realname;
-       bool opt_mode;
-       bool opt_ident;
-       bool opt_metadata;
-       bool opt_port;
-       bool opt_away;
-       bool opt_local;
-       bool opt_far;
-       bool opt_time;
-
- public:
-       /** Constructor for who.
-        */
-       CommandWho (InspIRCd* Instance) : Command(Instance,NULL,"WHO", 0, 1, false, 2) { syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; }
-       void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults);
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-       bool whomatch(User* user, const char* matchtext);
-};
-
-#endif
diff --git a/include/commands/cmd_whois.h b/include/commands/cmd_whois.h
deleted file mode 100644 (file)
index 494095e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_WHOIS_H__
-#define __CMD_WHOIS_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-const char* Spacify(char* n);
-DllExport void do_whois(InspIRCd* Instance, User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick);
-
-/** Handle /WHOIS. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandWhois : public Command
-{
- public:
-       /** Constructor for whois.
-        */
-       CommandWhois (InspIRCd* Instance) : Command(Instance,NULL,"WHOIS",0,1,false,2) { syntax = "<nick>{,<nick>}"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
index 9788b3d335e598b5b97ccd4a05be0f01b9ab3479..b28f44e178c09d7ceb7abf0f4352e0b88383be81 100644 (file)
@@ -72,7 +72,7 @@ class CommandWhowas : public Command
        std::string stats;
 
   public:
-       CommandWhowas(InspIRCd* Instance);
+       CommandWhowas(InspIRCd* Instance, Module* parent);
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
diff --git a/include/commands/cmd_zline.h b/include/commands/cmd_zline.h
deleted file mode 100644 (file)
index fa45ef1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
- *
- * This program is free but copyrighted software; see
- *      the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#ifndef __CMD_ZLINE_H__
-#define __CMD_ZLINE_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
-/** Handle /ZLINE. These command handlers can be reloaded by the core,
- * and handle basic RFC1459 commands. Commands within modules work
- * the same way, however, they can be fully unloaded, where these
- * may not.
- */
-class CommandZline : public Command
-{
- public:
-       /** Constructor for zline.
-        */
-       CommandZline (InspIRCd* Instance) : Command(Instance,NULL,"ZLINE","o",1,3,false,0) { syntax = "<ipmask> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
-        * @param user The user issuing the command
-        * @return A value from CmdResult to indicate command success or failure.
-        */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
-};
-
-#endif
index 92e446e033a50946677dee57ea9fa426d66a1916..ae46569a01f9314591a5a10c5c137bb9b3653793 100644 (file)
@@ -870,6 +870,14 @@ class CoreExport InspIRCd : public classbase
         */
        void SendWhoisLine(User* user, User* dest, int numeric, const char* format, ...) CUSTOM_PRINTF(5, 6);
 
+       /** Handle /STATS
+        */
+       void DoStats(char statschar, User* user, string_list &results);
+
+       /** Handle /WHOIS
+        */
+       void DoWhois(User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick);
+
        /** Quit a user for excess flood, and if they are not
         * fully registered yet, temporarily zline their IP.
         * @param current user to quit
@@ -929,4 +937,20 @@ class CoreExport InspIRCd : public classbase
 
 ENTRYPOINT;
 
+template<class Cmd>
+class CommandModule : public Module
+{
+       Cmd cmd;
+ public:
+       CommandModule(InspIRCd* me) : Module(me), cmd(me, this)
+       {
+               me->AddCommand(&cmd);
+       }
+
+       Version GetVersion()
+       {
+               return Version(cmd.command, VF_VENDOR);
+       }
+};
+
 #endif
index 86f77d2183d19914498e32218f7d42f72907b653..fdc6e35b25fe11e4cd10084642e4d0f59346a9d4 100644 (file)
@@ -1922,4 +1922,6 @@ class CoreExport ModuleManager : public classbase
        }
 #endif
 
+#define COMMAND_INIT(c) MODULE_INIT(CommandModule<c>)
+
 #endif
index b81a1053ea8a1ea0e97d5b8f597f7649113d1511..7696acb8531a6afcec4a6201233db209726b0ed5 100644 (file)
@@ -211,7 +211,6 @@ sub dumphash()
        print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n";
        print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
        print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
-       print "\e[0mLibrary path:\e[1;32m\t\t\t$main::config{LIBRARY_DIR}\e[0m\n";
        print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.$main::config{GCCMINOR}\e[0m\n";
        print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
        print "\e[0mIPv6 Support:\e[1;32m\t\t\t$main::config{IPV6}\e[0m\n";
index 1ca4c988f0a6c72bafb4c0b85edf3780fa6275d2..e4eb57e80bb10cad9d03dbc4d494a0d237e7c256 100644 (file)
@@ -161,7 +161,7 @@ bool CommandParser::IsValidCommand(const std::string &commandname, unsigned int
 
        if (n != cmdlist.end())
        {
-               if ((pcnt >= n->second->min_params) && (n->second->creator != NULL))
+               if ((pcnt >= n->second->min_params))
                {
                        if (IS_LOCAL(user) && n->second->flags_needed)
                        {
@@ -424,22 +424,6 @@ void CommandParser::RemoveCommands(Module* source)
        }
 }
 
-void CommandParser::RemoveRFCCommands()
-{
-       for(SharedObjectList::iterator c = RFCCommands.begin(); c != RFCCommands.end(); c++)
-       {
-               std::string cmd = c->first;
-               Command* cmdptr = cmdlist.find(cmd)->second;
-               cmdlist.erase(cmdlist.find(cmd));
-               delete cmdptr;
-               dlclose(c->second);
-       }
-       RFCCommands.clear();
-       // special case: reload isn't in the RFCCommands list but is allocated anyway
-       Command* reload = cmdlist.find("RELOAD")->second;
-       delete reload;
-}
-
 void CommandParser::RemoveCommand(Commandtable::iterator safei, Module* source)
 {
        Command* x = safei->second;
@@ -470,26 +454,15 @@ bool CommandParser::ProcessBuffer(std::string &buffer,User *user)
        return true;
 }
 
-bool CommandParser::CreateCommand(Command *f, void* so_handle)
+bool CommandParser::CreateCommand(Command *f)
 {
-       if (so_handle)
-       {
-               if (RFCCommands.find(f->command) == RFCCommands.end())
-                       RFCCommands[f->command] = so_handle;
-               else
-               {
-                       ServerInstance->Logs->Log("COMMAND",DEFAULT,"ERK! Somehow, we loaded a cmd_*.so file twice! Only the first instance is being recorded.");
-                       return false;
-               }
-       }
-
        /* create the command and push it onto the table */
        if (cmdlist.find(f->command) == cmdlist.end())
        {
                cmdlist[f->command] = f;
                return true;
        }
-       else return false;
+       return false;
 }
 
 CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance)
@@ -497,131 +470,6 @@ CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance)
        para.resize(128);
 }
 
-bool CommandParser::FindSym(void** v, void* h, const std::string &name)
-{
-       *v = dlsym(h, "init_command");
-       const char* err = dlerror();
-       if (err && !(*v))
-       {
-               ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s\n", name.c_str(), err);
-               return false;
-       }
-       return true;
-}
-
-bool CommandParser::ReloadCommand(std::string cmd, User* user)
-{
-       char filename[MAXBUF];
-       std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::toupper);
-
-       SharedObjectList::iterator command = RFCCommands.find(cmd);
-
-       if (command != RFCCommands.end())
-       {
-               Command* cmdptr = cmdlist.find(cmd)->second;
-               cmdlist.erase(cmdlist.find(cmd));
-
-               RFCCommands.erase(cmd);
-               delete cmdptr;
-               dlclose(command->second);
-       }
-
-       std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::tolower);
-       snprintf(filename, MAXBUF, "cmd_%s.so", cmd.c_str());
-       const char* err = this->LoadCommand(filename);
-       if (err)
-       {
-               if (user)
-                       user->WriteServ("NOTICE %s :*** Error loading '%s': %s", user->nick.c_str(), filename, err);
-               return false;
-       }
-       return true;
-}
-
-CmdResult CommandReload::Handle(const std::vector<std::string>& parameters, User *user)
-{
-       if (parameters.size() < 1)
-               return CMD_FAILURE;
-
-       user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick.c_str(), parameters[0].c_str());
-       if (ServerInstance->Parser->ReloadCommand(parameters[0], user))
-       {
-               user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick.c_str(), parameters[0].c_str());
-               ServerInstance->SNO->WriteToSnoMask('a', "RELOAD: %s reloaded the '%s' command.", user->nick.c_str(), parameters[0].c_str());
-               return CMD_SUCCESS;
-       }
-       else
-       {
-               user->WriteServ("NOTICE %s :*** Could not reload command '%s'. The command will not work until reloaded successfully.", user->nick.c_str(), parameters[0].c_str());
-               return CMD_FAILURE;
-       }
-}
-
-const char* CommandParser::LoadCommand(const char* name)
-{
-       char filename[MAXBUF];
-       void* h;
-       Command* (*cmd_factory_func)(InspIRCd*);
-
-       /* Command already exists? Succeed silently - this is needed for REHASH */
-       if (RFCCommands.find(name) != RFCCommands.end())
-       {
-               ServerInstance->Logs->Log("COMMAND",DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name);
-               return NULL;
-       }
-
-       snprintf(filename, MAXBUF, "%s/%s", LIBRARYDIR, name);
-       h = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
-
-       if (!h)
-       {
-               const char* n = dlerror();
-               ServerInstance->Logs->Log("COMMAND",SPARSE, "Error loading core command %s: %s", name, n);
-               return n;
-       }
-
-       if (this->FindSym((void **)&cmd_factory_func, h, name))
-       {
-               Command* newcommand = cmd_factory_func(ServerInstance);
-               this->CreateCommand(newcommand, h);
-       }
-       return NULL;
-}
-
-/** This is only invoked on startup
- */
-void CommandParser::SetupCommandTable()
-{
-       printf("\nLoading core commands");
-       fflush(stdout);
-
-       DIR* library = opendir(LIBRARYDIR);
-       if (library)
-       {
-               dirent* entry = NULL;
-               while (0 != (entry = readdir(library)))
-               {
-                       if (InspIRCd::Match(entry->d_name, "cmd_*.so", ascii_case_insensitive_map))
-                       {
-                               printf(".");
-                               fflush(stdout);
-
-                               const char* err = this->LoadCommand(entry->d_name);
-                               if (err)
-                               {
-                                       printf("Error loading %s: %s", entry->d_name, err);
-                                       exit(EXIT_STATUS_BADHANDLER);
-                               }
-                       }
-               }
-               closedir(library);
-               printf("\n");
-       }
-
-       if (cmdlist.find("RELOAD") == cmdlist.end())
-               this->CreateCommand(new CommandReload(ServerInstance));
-}
-
 int CommandParser::TranslateUIDs(const std::vector<TranslateType> to, const std::vector<std::string> &source, std::string &dest, bool prefix_final, Command* custom_translator)
 {
        std::vector<TranslateType>::const_iterator types = to.begin();
index 95170e06904bb914d5a2874267307db7ec540bfd..a0d99ea09be8a462c881b046cca2f6c0bbf24d74 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_admin.h"
 
+#ifndef __CMD_ADMIN_H__
+#define __CMD_ADMIN_H__
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /ADMIN. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandAdmin : public Command
 {
-       return new CommandAdmin(Instance);
-}
+ public:
+       /** Constructor for admin.
+        */
+       CommandAdmin (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ADMIN",0,0) { syntax = "[<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
 
 /** Handle /ADMIN
  */
@@ -31,3 +54,5 @@ CmdResult CommandAdmin::Handle (const std::vector<std::string>& parameters, User
        user->WriteNumeric(RPL_ADMINEMAIL, "%s :E-Mail   - %s",user->nick.c_str(),ServerInstance->Config->AdminEmail);
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandAdmin)
index 261bdd38c8f85915a9171028b3f1726823e0500d..fa91342e0b87df1e593aea9086fd6a5877936d6e 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_away.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_AWAY_H__
+#define __CMD_AWAY_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /AWAY. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandAway : public Command
 {
-       return new CommandAway(Instance);
-}
+ public:
+       /** Constructor for away.
+        */
+       CommandAway (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"AWAY",0,0) { syntax = "[<message>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /AWAY
  */
@@ -50,3 +75,5 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandAway)
index 151587f12440be4c2e0aec45c31ecb75af403e1f..6303fa52852d5c05279eadd8a1a882e06c10014f 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_clearcache.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_ADMIN_H__
+#define __CMD_ADMIN_H__
+
+#include "users.h"
+#include "channels.h"
+#include "ctables.h"
+
+/** Handle /ADMIN. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandClearcache : public Command
 {
-       return new CommandClearcache(Instance);
-}
+ public:
+       /** Constructor for clearcache.
+        */
+       CommandClearcache (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CLEARCACHE","o",0) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /CLEARCACHE
  */
@@ -27,3 +51,5 @@ CmdResult CommandClearcache::Handle (const std::vector<std::string>& parameters,
        user->WriteServ("NOTICE %s :*** Cleared DNS cache of %d items.", user->nick.c_str(), n);
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandClearcache)
index 2683f06190024d5503087e71ad34b99ac06a02f8..5fa041b8f68b54f3139085c4f5d052468e6da7de 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_commands.h"
 
-/** Handle /COMMANDS
+#ifndef __CMD_COMMANDS_H__
+#define __CMD_COMMANDS_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /COMMANDS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
  */
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+class CommandCommands : public Command
 {
-       return new CommandCommands(Instance);
-}
+ public:
+       /** Constructor for commands.
+        */
+       CommandCommands (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"COMMANDS",0,0) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
 
+#endif
+
+
+/** Handle /COMMANDS
+ */
 CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
 {
        for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
@@ -36,3 +61,5 @@ CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
        user->WriteNumeric(RPL_COMMANDSEND, "%s :End of COMMANDS list",user->nick.c_str());
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandCommands)
index 073993f8c63c861c79e49e78d5eb82c6d4217488..7a391592dfd7ae1e471c08a6aa60618b2fc8d355 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_connect.h"
+
+#ifndef __CMD_CONNECT_H__
+#define __CMD_CONNECT_H__
+
+#include "users.h"
+#include "channels.h"
+#include "ctables.h"
+#include "modules.h"
+
+/** Handle /CONNECT. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandConnect : public Command
+{
+ public:
+       /** Constructor for connect.
+        */
+       CommandConnect (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CONNECT","o",1,false,0) { syntax = "<servername> [<remote-server>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /*
  * This is handled by the server linking module, if necessary. Do not remove this stub.
  */
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
-{
-       return new CommandConnect(Instance);
-}
-
 /** Handle /CONNECT
  */
 CmdResult CommandConnect::Handle (const std::vector<std::string>&, User *user)
@@ -30,3 +55,5 @@ CmdResult CommandConnect::Handle (const std::vector<std::string>&, User *user)
        user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick.c_str());
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandConnect)
index b85323afc9fb5ebe221e7682c07332974a2ed925..6eb9e0336ba095d741571a97754a8bac244263ac 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_die.h"
-#include "exitcodes.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_DIE_H__
+#define __CMD_DIE_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /DIE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandDie : public Command
 {
-       return new CommandDie(Instance);
-}
+ public:
+       /** Constructor for die.
+        */
+       CommandDie (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"DIE","o",1,false,0) { syntax = "<password>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+#include "exitcodes.h"
 
 /** Handle /DIE
  */
@@ -45,3 +70,5 @@ CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *
        }
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandDie)
index d28f4c8ee8792f3e41ab8d2e09cec8258829406f..0591b916341a0c7915bc883ad9b0a3a2222181f7 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_eline.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_ELINE_H__
+#define __CMD_ELINE_H__
+
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /ELINE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandEline : public Command
 {
-       return new CommandEline(Instance);
-}
+ public:
+       /** Constructor for eline.
+        */
+       CommandEline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ELINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /ELINE
  */
@@ -84,3 +121,5 @@ CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandEline)
index 346ca98f62cfaba1a291f9171b709dcea449c41a..9da5f707131ce3e4e0874298ab98df59fa45dc4e 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_gline.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_GLINE_H__
+#define __CMD_GLINE_H__
+
+// include the common header file
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /GLINE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandGline : public Command
 {
-       return new CommandGline(Instance);
-}
+ public:
+       /** Constructor for gline.
+        */
+       CommandGline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"GLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /GLINE
  */
@@ -92,3 +129,5 @@ CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandGline)
index 286e64f6140ad21d734413b613e37e261f230c35..43f8286f2e3210e3c1d3dddd9130f60d4130e5eb 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_info.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_INFO_H__
+#define __CMD_INFO_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /INFO. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandInfo : public Command
 {
-       return new CommandInfo(Instance);
-}
+ public:
+       /** Constructor for info.
+        */
+       CommandInfo (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"INFO",0,0) { syntax = "[<servermask>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /INFO
  */
@@ -62,3 +87,5 @@ CmdResult CommandInfo::Handle (const std::vector<std::string>&, User *user)
        user->WriteNumeric(RPL_ENDOFINFO, "%s :End of /INFO list", user->nick.c_str());
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandInfo)
index 31c6f459c6b901d0dc807e0c6ec2a595993effe0..73b7068e55ad61d9072dbf2a652da02a480d2320 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_invite.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_INVITE_H__
+#define __CMD_INVITE_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /INVITE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandInvite : public Command
 {
-       return new CommandInvite(Instance);
-}
+ public:
+       /** Constructor for invite.
+        */
+       CommandInvite (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"INVITE", 0, 0, false, 4) { syntax = "[<nick> <channel>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /INVITE
  */
@@ -111,3 +136,5 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandInvite)
index 52fbcde4bcb089167189775317864564b052cf93..2f64547e6bf3079d77b4674174679b5788463fa5 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_ison.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_ISON_H__
+#define __CMD_ISON_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /ISON. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandIson : public Command
 {
-       return new CommandIson(Instance);
-}
+ public:
+       /** Constructor for ison.
+        */
+       CommandIson (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ISON",0,0) { syntax = "<nick> {nick}"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /ISON
  */
@@ -79,3 +104,5 @@ CmdResult CommandIson::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandIson)
index c8d731ef5cebd57b0588c1df73dea6e51c889ad5..d86516aaa6afba568758d7ac247669d03e17d860 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_join.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_JOIN_H__
+#define __CMD_JOIN_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /JOIN. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandJoin : public Command
 {
-       return new CommandJoin(Instance);
-}
+ public:
+       /** Constructor for join.
+        */
+       CommandJoin (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"JOIN", 0, 1, false, 2) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /JOIN
  */
@@ -49,3 +74,5 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
        user->WriteNumeric(ERR_NOSUCHCHANNEL, "%s %s :Invalid channel name",user->nick.c_str(), parameters[0].c_str());
        return CMD_FAILURE;
 }
+
+COMMAND_INIT(CommandJoin)
index e26ec865314a653476afedba59e3405b0205a6a6..54a5bd88834c9f604a53f0e4d6a47863d2135bf9 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_kick.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_KICK_H__
+#define __CMD_KICK_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /KICK. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandKick : public Command
 {
-       return new CommandKick(Instance);
-}
+ public:
+       /** Constructor for kick.
+        */
+       CommandKick (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /KICK
  */
@@ -57,3 +82,5 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandKick)
index 2f1a4783e4c6e02a0b71f6f447bc1c567e17db02..15cf58f47108b4b3a2a508f840d87957b6c79d7a 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_kill.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_KILL_H__
+#define __CMD_KILL_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /KILL. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandKill : public Command
 {
-       return new CommandKill(Instance);
-}
+ public:
+       /** Constructor for kill.
+        */
+       CommandKill (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"KILL","o",2,false,0) { syntax = "<nickname> <reason>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /KILL
  */
@@ -113,3 +138,5 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandKill)
index 0a3e7c9303ed3d423d755939391e3cb3914f323f..79e2e7292e8e1364d9d3b7feb4aa33e69ab9251a 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_kline.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_KLINE_H__
+#define __CMD_KLINE_H__
+
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /KLINE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandKline : public Command
 {
-       return new CommandKline(Instance);
-}
+ public:
+       /** Constructor for kline.
+        */
+       CommandKline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"KLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /KLINE
  */
@@ -91,3 +128,5 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandKline)
index 943577cd643e622255d502c557a2e171dc0eebbd..5de58e90f19a4df24fdc9dde8e662a0a0744ff5a 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_links.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_LINKS_H__
+#define __CMD_LINKS_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /LINKS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandLinks : public Command
 {
-       return new CommandLinks(Instance);
-}
+ public:
+       /** Constructor for links.
+        */
+       CommandLinks (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LINKS",0,0) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /LINKS
  */
@@ -27,3 +52,5 @@ CmdResult CommandLinks::Handle (const std::vector<std::string>&, User *user)
        user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick.c_str());
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandLinks)
index 9d65b4165392fc9022fdf515e950d21d41396d17..1560487c5d25e33b307df56f88a021e2a8c72c12 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_list.h"
 
-/** Handle /LIST
+#ifndef __CMD_LIST_H__
+#define __CMD_LIST_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /LIST. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
  */
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+class CommandList : public Command
 {
-       return new CommandList(Instance);
-}
+ public:
+       /** Constructor for list.
+        */
+       CommandList (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LIST", 0, 0, false, 5) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
 
+#endif
+
+
+/** Handle /LIST
+ */
 CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User *user)
 {
        int minusers = 0, maxusers = 0;
@@ -79,3 +104,5 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandList)
index c6dbd8069268ed391e62b089a4fab9e361d28b42..d6456d7d2c1c72be23afd09211b369dc39a3f194 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_loadmodule.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_LOADMODULE_H__
+#define __CMD_LOADMODULE_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /LOADMODULE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandLoadmodule : public Command
 {
-       return new CommandLoadmodule(Instance);
-}
+ public:
+       /** Constructor for loadmodule.
+        */
+       CommandLoadmodule (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LOADMODULE","o",1) { syntax = "<modulename>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /LOADMODULE
  */
@@ -35,3 +60,5 @@ CmdResult CommandLoadmodule::Handle (const std::vector<std::string>& parameters,
                return CMD_FAILURE;
        }
 }
+
+COMMAND_INIT(CommandLoadmodule)
index fb4b197c04b8527952846867fffcc5efd86cae36..ea278a406ab94fed699ebd04e3a57f00a32e0c3d 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_lusers.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_LUSERS_H__
+#define __CMD_LUSERS_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /LUSERS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandLusers : public Command
 {
-       return new CommandLusers(Instance);
-}
+ public:
+       /** Constructor for lusers.
+        */
+       CommandLusers (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LUSERS",0,0) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /LUSERS
  */
@@ -38,3 +63,5 @@ CmdResult CommandLusers::Handle (const std::vector<std::string>&, User *user)
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandLusers)
index 3c49ca0c0a7a30846d3d04708142ac7d74e661d9..780caf081f5808cc73e40244388d2d8a3ff8fe52 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_map.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_MAP_H__
+#define __CMD_MAP_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /MAP. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandMap : public Command
 {
-       return new CommandMap(Instance);
-}
+ public:
+       /** Constructor for map.
+        */
+       CommandMap (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MAP",0,0,false,2) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /MAP
  */
@@ -31,3 +56,5 @@ CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandMap)
index 267b783262bd0ef87bab058c1838732f8f87c77d..9b80b77a4dd6e3d324e2a9ab556714fa9ee71548 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_mode.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_ADMIN_H__
+#define __CMD_ADMIN_H__
+
+#include "users.h"
+#include "channels.h"
+#include "ctables.h"
+
+/** Handle /MODE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandMode : public Command
 {
-       return new CommandMode(Instance);
-}
+ public:
+       /** Constructor for mode.
+        */
+       CommandMode (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /MODE
  */
@@ -27,3 +51,5 @@ CmdResult CommandMode::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandMode)
index 36e2e9109f773491b2bbfce04c24bf9587f90343..619cf1cb626e5121da17fb8e593844b78e3480fd 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_modules.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_MODULES_H__
+#define __CMD_MODULES_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /MODULES. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandModules : public Command
 {
-       return new CommandModules(Instance);
-}
+ public:
+       /** Constructor for modules.
+        */
+       CommandModules (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MODULES",0,0) { syntax = "[debug]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /MODULES
  */
@@ -49,3 +74,5 @@ CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandModules)
index 2db6139b1c274d9954b06ab188c451d4cfeb31e9..36306603c7feceb9556c8476e959351f6c71fad4 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_motd.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_MOTD_H__
+#define __CMD_MOTD_H__
+
+// include the common header files
+
+#include <string>
+#include <vector>
+#include "inspircd.h"
+#include "users.h"
+#include "channels.h"
+
+/** Handle /MOTD. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandMotd : public Command
 {
-       return new CommandMotd(Instance);
-}
+ public:
+       /** Constructor for motd.
+        */
+       CommandMotd (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MOTD",0,0) { syntax = "[<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /MOTD
  */
@@ -26,3 +54,5 @@ CmdResult CommandMotd::Handle (const std::vector<std::string>&, User *user)
        user->ShowMOTD();
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandMotd)
index e6df558a63c38ccc6943c2a6aa44d063b8079837..642fafb5db109f5fc3bc0046c8101eed2b41cbe5 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_names.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_NAMES_H__
+#define __CMD_NAMES_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /NAMES. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandNames : public Command
 {
-       return new CommandNames(Instance);
-}
+ public:
+       /** Constructor for names.
+        */
+       CommandNames (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** Handle /NAMES
  */
@@ -51,3 +76,5 @@ CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandNames)
index 33e0e80819f0df48d5b04432aa583e0e4a95b660..ecc254f174a3a3d10cb53403ca819293b4e1ba73 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_nick.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_NICK_H__
+#define __CMD_NICK_H__
+
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /NICK. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandNick : public Command
 {
-       return new CommandNick(Instance);
-}
+       bool allowinvalid;
+ public:
+       /** Constructor for nick.
+        */
+       CommandNick (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"NICK", 0, 1, true, 3), allowinvalid(false) { syntax = "<newnick>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+
+       /** Handle internal command
+        * @param id Used to indicate if invalid nick changes are allowed.
+        * Set to 1 to allow invalid nicks and 0 to deny them.
+        * @param parameters Currently unused
+        */
+       CmdResult HandleInternal(const unsigned int id, const std::deque<classbase*> &parameters);
+};
+
+#endif
+
 
 /** Handle nick changes from users.
  * NOTE: If you are used to ircds based on ircd2.8, and are looking
@@ -212,3 +257,5 @@ CmdResult CommandNick::HandleInternal(const unsigned int id, const std::deque<cl
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandNick)
index e9049d7ab9ff8188b0a7bd928914870597b296d6..c94dbc87a4f7737e24006b80bca8af9ca3d60012 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_notice.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_NOTICE_H__
+#define __CMD_NOTICE_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /NOTICE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandNotice : public Command
 {
-       return new CommandNotice(Instance);
-}
+ public:
+       /** Constructor for notice.
+        */
+       CommandNotice (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -185,3 +210,5 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
        return CMD_SUCCESS;
 
 }
+
+COMMAND_INIT(CommandNotice)
index 85af2da18c0823b71b18d43cfe1724f521b75b79..3efafca5b96060ca95222d42703fb2e284d363ca 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_oper.h"
+
+#ifndef __CMD_OPER_H__
+#define __CMD_OPER_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+bool OneOfMatches(const char* host, const char* ip, const char* hostlist);
+
+/** Handle /OPER. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandOper : public Command
+{
+ public:
+       /** Constructor for oper.
+        */
+       CommandOper (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"OPER",0,2,false,2) { syntax = "<username> <password>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 #include "hashcomp.h"
 
 bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
@@ -29,11 +61,6 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
        return false;
 }
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
-{
-       return new CommandOper(Instance);
-}
-
 CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User *user)
 {
        char LoginName[MAXBUF];
@@ -150,3 +177,5 @@ CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User
        }
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandOper)
index 834ee2b287b2e77f3cf4edd665eb6f6d1ba8c5df..e9753c4563175cf76a1daa06c124a95f565f096b 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_part.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_PART_H__
+#define __CMD_PART_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /PART. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandPart : public Command
 {
-       return new CommandPart(Instance);
-}
+ public:
+       /** Constructor for part.
+        */
+       CommandPart (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PART", 0, 1, false, 5) { syntax = "<channel>{,<channel>} [<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -59,3 +84,5 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandPart)
index e4bbf59c2de113ebf741afbe87290aad5923ed85..8429a494fdd9f1ebf2bd53c497836b737ef6eff4 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_pass.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_PASS_H__
+#define __CMD_PASS_H__
+
+// include the common header files
+
+#include <string>
+#include <vector>
+#include "inspircd.h"
+#include "users.h"
+#include "channels.h"
+
+/** Handle /PASS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandPass : public Command
 {
-       return new CommandPass(Instance);
-}
+ public:
+       /** Constructor for pass.
+        */
+       CommandPass (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PASS",0,1,true,0) { syntax = "<password>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -37,3 +65,5 @@ CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandPass)
index 11e975624c9ec4881b3f6b7f7fc9513bc274fc11..feea84f59dae19cc7f7a3ac630ae9d1902200ae3 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_ping.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_PING_H__
+#define __CMD_PING_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /PING. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandPing : public Command
 {
-       return new CommandPing(Instance);
-}
+ public:
+       /** Constructor for ping.
+        */
+       CommandPing (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PING", 0, 1, false, 0) { syntax = "<servername> [:<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandPing::Handle (const std::vector<std::string>& parameters, User *user)
 {
        user->WriteServ("PONG %s :%s", ServerInstance->Config->ServerName, parameters[0].c_str());
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandPing)
index 6ceb11e933c7e18922b7178f10342e8529f3f99d..5ca5b4cfcac3c95aff629dcdd649da0281b597b0 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_pong.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_PONG_H__
+#define __CMD_PONG_H__
+
+// include the common header files
+
+#include "inspircd.h"
+#include "users.h"
+#include "channels.h"
+
+/** Handle /PONG. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandPong : public Command
 {
-       return new CommandPong(Instance);
-}
+ public:
+       /** Constructor for pong.
+        */
+       CommandPong (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PONG", 0, 1, false, 0) { syntax = "<ping-text>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandPong::Handle (const std::vector<std::string>&, User *user)
 {
@@ -25,3 +51,5 @@ CmdResult CommandPong::Handle (const std::vector<std::string>&, User *user)
        user->lastping = 1;
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandPong)
index c6e74db8b134ab32053baca2cedddd016d75f10d..5861bd08688da871eed59ccda67800e11072fbad 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_privmsg.h"
 
-extern "C" DllExport  Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_PRIVMSG_H__
+#define __CMD_PRIVMSG_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /PRIVMSG. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandPrivmsg : public Command
 {
-       return new CommandPrivmsg(Instance);
-}
+ public:
+       /** Constructor for privmsg.
+        */
+       CommandPrivmsg (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -202,3 +227,5 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
        }
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandPrivmsg)
index 347771453ca6ad8b6510e0bdaad9fbea6c322b63..ebd1d6b3158662578165303235a4626e047aebe4 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_qline.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_QLINE_H__
+#define __CMD_QLINE_H__
 
+// include the common header files
 
+#include "users.h"
+#include "channels.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+/** Handle /QLINE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandQline : public Command
 {
-       return new CommandQline(Instance);
-}
+ public:
+       /** Constructor for qline.
+        */
+       CommandQline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"QLINE","o",1,3,false,0) { syntax = "<nick> [<duration> :<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -73,3 +110,5 @@ CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandQline)
index e29382e848561386dd06d7d8694fbf1814f5d24f..968374dec77dba78b5f748dee229d770c9f1038b 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_quit.h"
 
+#ifndef __CMD_QUIT_H__
+#define __CMD_QUIT_H__
 
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /QUIT. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandQuit : public Command
 {
-       return new CommandQuit(Instance);
-}
+ public:
+       /** Constructor for quit.
+        */
+       CommandQuit (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"QUIT",0,0,true) { syntax = "[<message>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -52,3 +77,5 @@ CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandQuit)
index 96313829f4c55045e0e61966b1734e95d0f6b70b..60b1e12b640d126fe15cf565315a9396e94e10db 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_rehash.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_REHASH_H__
+#define __CMD_REHASH_H__
+
+// include the common header files
 
+#include "users.h"
+#include "channels.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+/** Handle /REHASH. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandRehash : public Command
 {
-       return new CommandRehash(Instance);
-}
+ public:
+       /** Constructor for rehash.
+        */
+       CommandRehash (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"REHASH","o",0,false,3) { syntax = "[<servermask>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
 
 CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -93,3 +130,5 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use
        }
 }
 
+
+COMMAND_INIT(CommandRehash)
index a944934551f7f3260cda2a2fbf47bc8b1e178cf6..5d84fc7d5598ead7767a9f24e4477527d2907add 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_reloadmodule.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+class CommandReloadmodule : public Command
 {
-       return new CommandReloadmodule(Instance);
-}
+ public:
+       /** Constructor for reloadmodule.
+        */
+       CommandReloadmodule (InspIRCd* Instance, Module* parent) : Command(Instance, parent, "RELOADMODULE","o",1) { syntax = "<modulename>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
 
 CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -36,3 +45,5 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter
        user->WriteNumeric(975, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
        return CMD_FAILURE;
 }
+
+COMMAND_INIT(CommandReloadmodule)
index 964c7755f01407d47c12352808876c58fd34287d..ffd0323b7c23a21322227077820a8c2fb5e6c48a 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_restart.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_RESTART_H__
+#define __CMD_RESTART_H__
+
+// include the common header files
+
+#include <string>
+#include <deque>
+#include <vector>
+#include "users.h"
+#include "channels.h"
+
+/** Handle /RESTART. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandRestart : public Command
 {
-       return new CommandRestart(Instance);
-}
+ public:
+       /** Constructor for restart.
+        */
+       CommandRestart (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"RESTART","o",1,false,0) { syntax = "<password>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -45,3 +73,5 @@ CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, Us
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandRestart)
index c47ff38ad65e399a040ed6f21d41e37be9200b07..b5b5fbc1526352f97760260619e1a016fb475bfc 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_rules.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_RULES_H__
+#define __CMD_RULES_H__
+
+// include the common header files
+
+#include <string>
+#include <vector>
+#include "inspircd.h"
+#include "users.h"
+#include "channels.h"
+
+/** Handle /RULES. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandRules : public Command
 {
-       return new CommandRules(Instance);
-}
+ public:
+       /** Constructor for rules.
+        */
+       CommandRules (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"RULES",0,0) { syntax = "[<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandRules::Handle (const std::vector<std::string>& parameters, User *user)
 {
        user->ShowRULES();
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandRules)
index eced487d3e62766977542a3531458347470bb908..c350dd2a6169005b7f3538c124f3277814b5b995 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_server.h"
 
+#ifndef __CMD_SERVER_H__
+#define __CMD_SERVER_H__
 
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /SERVER. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandServer : public Command
 {
-       return new CommandServer(Instance);
-}
+ public:
+       /** Constructor for server.
+        */
+       CommandServer (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"SERVER",0,0,true) { }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandServer::Handle (const std::vector<std::string>&, User *user)
 {
@@ -33,3 +58,5 @@ CmdResult CommandServer::Handle (const std::vector<std::string>&, User *user)
        }
        return CMD_FAILURE;
 }
+
+COMMAND_INIT(CommandServer)
index 46c56c8f5fb7f6277580c10b3171f68d56cdd9e7..ada5655d1f4d80bb7082ee43ca076b8a16f836d6 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_squit.h"
+
+#ifndef __CMD_SQUIT_H__
+#define __CMD_SQUIT_H__
+
+// include the common header files
+
+#include <string>
+#include <vector>
+#include "inspircd.h"
+#include "users.h"
+#include "channels.h"
+
+/** Handle /SQUIT. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandSquit : public Command
+{
+ public:
+       /** Constructor for squit.
+        */
+       CommandSquit (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"SQUIT","o",1) { syntax = "<servername> [<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /*
  * This is handled by the server linking module, if necessary. Do not remove this stub.
  */
 
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
-{
-       return new CommandSquit(Instance);
-}
-
 CmdResult CommandSquit::Handle (const std::vector<std::string>&, User *user)
 {
        user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick.c_str());
        return CMD_FAILURE;
 }
+
+COMMAND_INIT(CommandSquit)
index ecd19a71ef61d767425c1ac25d0bbc71f75245de..e3961a9069165b8e3eb4895c6ae811075672292a 100644 (file)
 #endif
 
 #include "xline.h"
-#include "commands/cmd_stats.h"
-#include "commands/cmd_whowas.h"
 
-
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+/** Handle /STATS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandStats : public Command
 {
-       return new CommandStats(Instance);
-}
+ public:
+       /** Constructor for stats.
+        */
+       CommandStats (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
 
 CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -45,7 +57,7 @@ CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User
                        return CMD_FAILURE;
                }
                char search = parameters[0][0];
-               DoStats(this->ServerInstance, search, user, values);
+               ServerInstance->DoStats(search, user, values);
                for (size_t i = 0; i < values.size(); i++)
                        user->Write(":%s", values[i].c_str());
        }
@@ -53,296 +65,4 @@ CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
-DllExport void DoStats(InspIRCd* ServerInstance, char statschar, User* user, string_list &results)
-{
-       std::string sn(ServerInstance->Config->ServerName);
-
-       if (!user->HasPrivPermission("servers/auspex") && !strchr(ServerInstance->Config->UserStats, statschar))
-       {
-               ServerInstance->SNO->WriteToSnoMask('t',
-                               "%s '%c' denied for %s (%s@%s)",
-                               (IS_LOCAL(user) ? "Stats" : "Remote stats"),
-                               statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
-               results.push_back(sn + " 481 " + user->nick + " :Permission denied - STATS " + statschar + " requires the servers/auspex priv.");
-               return;
-       }
-
-       ModResult MOD_RESULT;
-       FIRST_MOD_RESULT(ServerInstance, OnStats, MOD_RESULT, (statschar, user, results));
-       if (MOD_RESULT == MOD_RES_DENY)
-       {
-               results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
-               ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
-                       (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
-               return;
-       }
-
-       switch (statschar)
-       {
-               /* stats p (show listening ports and registered clients on each) */
-               case 'p':
-               {
-                       for (size_t i = 0; i < ServerInstance->ports.size(); i++)
-                       {
-                               std::string ip = ServerInstance->ports[i]->GetIP();
-                               if (ip.empty())
-                                       ip.assign("*");
-
-                               results.push_back(sn+" 249 "+user->nick+" :"+ ip + ":"+ConvToStr(ServerInstance->ports[i]->GetPort())+" (client, " +
-                                               ServerInstance->ports[i]->GetDescription() + ")");
-                       }
-               }
-               break;
-
-               /* These stats symbols must be handled by a linking module */
-               case 'n':
-               case 'c':
-               break;
-
-               case 'i':
-               {
-                       int idx = 0;
-                       for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
-                       {
-                               ConnectClass* c = *i;
-                               results.push_back(sn+" 215 "+user->nick+" i NOMATCH * "+c->GetHost()+" "+ConvToStr(c->limit ? c->limit : ServerInstance->SE->GetMaxFds())+" "+ConvToStr(idx)+" "+ServerInstance->Config->ServerName+" *");
-                               idx++;
-                       }
-               }
-               break;
-
-               case 'Y':
-               {
-                       int idx = 0;
-                       for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
-                       {
-                               ConnectClass* c = *i;
-                               results.push_back(sn+" 218 "+user->nick+" Y "+ConvToStr(idx)+" "+ConvToStr(c->GetPingTime())+" 0 "+ConvToStr(c->GetSendqMax())+" :"+
-                                               ConvToStr(c->GetRecvqMax())+" "+ConvToStr(c->GetRegTimeout()));
-                               idx++;
-                       }
-               }
-               break;
-
-               case 'U':
-               {
-                       char ulined[MAXBUF];
-                       for (int i = 0; i < ServerInstance->Config->ConfValueEnum("uline"); i++)
-                       {
-                               ServerInstance->Config->ConfValue("uline","server", i, ulined, MAXBUF);
-                                       results.push_back(sn+" 248 "+user->nick+" U "+std::string(ulined));
-                       }
-               }
-               break;
-
-               case 'P':
-               {
-                       int idx = 0;
-                       for (user_hash::iterator i = ServerInstance->Users->clientlist->begin(); i != ServerInstance->Users->clientlist->end(); i++)
-                       {
-                               if (IS_OPER(i->second) && !ServerInstance->ULine(i->second->server))
-                               {
-                                       results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+
-                                                       (IS_LOCAL(i->second) ? ConvToStr(ServerInstance->Time() - i->second->idle_lastmsg) + " secs" : "unavailable"));
-                                       idx++;
-                               }
-                       }
-                       results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(idx)+" OPER(s)");
-               }
-               break;
-
-               case 'k':
-                       ServerInstance->XLines->InvokeStats("K",216,user,results);
-               break;
-               case 'g':
-                       ServerInstance->XLines->InvokeStats("G",223,user,results);
-               break;
-               case 'q':
-                       ServerInstance->XLines->InvokeStats("Q",217,user,results);
-               break;
-               case 'Z':
-                       ServerInstance->XLines->InvokeStats("Z",223,user,results);
-               break;
-               case 'e':
-                       ServerInstance->XLines->InvokeStats("E",223,user,results);
-               break;
-               case 'E':
-                       results.push_back(sn+" 249 "+user->nick+" :Total events: "+ConvToStr(ServerInstance->SE->TotalEvents));
-                       results.push_back(sn+" 249 "+user->nick+" :Read events:  "+ConvToStr(ServerInstance->SE->ReadEvents));
-                       results.push_back(sn+" 249 "+user->nick+" :Write events: "+ConvToStr(ServerInstance->SE->WriteEvents));
-                       results.push_back(sn+" 249 "+user->nick+" :Error events: "+ConvToStr(ServerInstance->SE->ErrorEvents));
-               break;
-
-               /* stats m (list number of times each command has been used, plus bytecount) */
-               case 'm':
-                       for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
-                       {
-                               if (i->second->use_count)
-                               {
-                                       /* RPL_STATSCOMMANDS */
-                                       results.push_back(sn+" 212 "+user->nick+" "+i->second->command+" "+ConvToStr(i->second->use_count)+" "+ConvToStr(i->second->total_bytes));
-                               }
-                       }
-               break;
-
-               /* stats z (debug and memory info) */
-               case 'z':
-               {
-                       results.push_back(sn+" 240 "+user->nick+" :InspIRCd: "+ConvToStr(sizeof(InspIRCd))+" bytes");
-                       results.push_back(sn+" 249 "+user->nick+" :Users: "+ConvToStr(ServerInstance->Users->clientlist->size()));
-                       results.push_back(sn+" 249 "+user->nick+" :Channels: "+ConvToStr(ServerInstance->chanlist->size()));
-                       results.push_back(sn+" 249 "+user->nick+" :Commands: "+ConvToStr(ServerInstance->Parser->cmdlist.size()));
-
-                       if (!ServerInstance->Config->WhoWasGroupSize == 0 && !ServerInstance->Config->WhoWasMaxGroups == 0)
-                       {
-                               Command* whowas_command = ServerInstance->Parser->GetHandler("WHOWAS");
-                               if (whowas_command)
-                               {
-                                       std::deque<classbase*> params;
-                                       Extensible whowas_stats;
-                                       params.push_back(&whowas_stats);
-                                       whowas_command->HandleInternal(WHOWAS_STATS, params);
-                                       if (whowas_stats.GetExt("stats"))
-                                       {
-                                               char* stats;
-                                               whowas_stats.GetExt("stats", stats);
-                                               results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(stats));
-                                       }
-                               }
-                       }
-
-                       results.push_back(sn+" 249 "+user->nick+" :MOTD "+ConvToStr(ServerInstance->Config->MOTD.size())+", RULES "+ConvToStr(ServerInstance->Config->RULES.size()));
-
-                       float kbitpersec_in, kbitpersec_out, kbitpersec_total;
-                       char kbitpersec_in_s[30], kbitpersec_out_s[30], kbitpersec_total_s[30];
-
-                       ServerInstance->SE->GetStats(kbitpersec_in, kbitpersec_out, kbitpersec_total);
-
-                       snprintf(kbitpersec_total_s, 30, "%03.5f", kbitpersec_total);
-                       snprintf(kbitpersec_out_s, 30, "%03.5f", kbitpersec_out);
-                       snprintf(kbitpersec_in_s, 30, "%03.5f", kbitpersec_in);
-
-                       results.push_back(sn+" 249 "+user->nick+" :Bandwidth total:  "+ConvToStr(kbitpersec_total_s)+" kilobits/sec");
-                       results.push_back(sn+" 249 "+user->nick+" :Bandwidth out:    "+ConvToStr(kbitpersec_out_s)+" kilobits/sec");
-                       results.push_back(sn+" 249 "+user->nick+" :Bandwidth in:     "+ConvToStr(kbitpersec_in_s)+" kilobits/sec");
-
-#ifndef WIN32
-                       /* Moved this down here so all the not-windows stuff (look w00tie, I didn't say win32!) is in one ifndef.
-                        * Also cuts out some identical code in both branches of the ifndef. -- Om
-                        */
-                       rusage R;
-
-                       /* Not sure why we were doing '0' with a RUSAGE_SELF comment rather than just using RUSAGE_SELF -- Om */
-                       if (!getrusage(RUSAGE_SELF,&R)) /* RUSAGE_SELF */
-                       {
-                               results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr(R.ru_maxrss)+"K");
-                               results.push_back(sn+" 249 "+user->nick+" :Signals:          "+ConvToStr(R.ru_nsignals));
-                               results.push_back(sn+" 249 "+user->nick+" :Page faults:      "+ConvToStr(R.ru_majflt));
-                               results.push_back(sn+" 249 "+user->nick+" :Swaps:            "+ConvToStr(R.ru_nswap));
-                               results.push_back(sn+" 249 "+user->nick+" :Context Switches: Voluntary; "+ConvToStr(R.ru_nvcsw)+" Involuntary; "+ConvToStr(R.ru_nivcsw));
-
-                               timeval tv;
-                               char percent[30];
-                               gettimeofday(&tv, NULL);
-
-                               float n_elapsed = ((tv.tv_sec - ServerInstance->stats->LastSampled.tv_sec) * 1000000 + tv.tv_usec - ServerInstance->stats->LastSampled.tv_usec);
-                               float n_eaten = ((R.ru_utime.tv_sec - ServerInstance->stats->LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - ServerInstance->stats->LastCPU.tv_usec);
-                               float per = (n_eaten / n_elapsed) * 100;
-
-                               snprintf(percent, 30, "%03.5f%%", per);
-                               results.push_back(sn+" 249 "+user->nick+" :CPU Usage: "+percent);
-                       }
-#else
-                       PROCESS_MEMORY_COUNTERS MemCounters;
-                       if (GetProcessMemoryInfo(GetCurrentProcess(), &MemCounters, sizeof(MemCounters)))
-                       {
-                               results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr((MemCounters.WorkingSetSize + MemCounters.PagefileUsage) / 1024)+"K");
-                               results.push_back(sn+" 249 "+user->nick+" :Pagefile usage:   "+ConvToStr(MemCounters.PagefileUsage / 1024)+"K");
-                               results.push_back(sn+" 249 "+user->nick+" :Page faults:      "+ConvToStr(MemCounters.PageFaultCount));
-                               results.push_back(sn+" 249 "+user->nick+" :CPU Usage: " + ConvToStr(getcpu()) + "%");
-                       }
-#endif
-               }
-               break;
-
-               case 'T':
-               {
-                       char buffer[MAXBUF];
-                       results.push_back(sn+" 249 "+user->nick+" :accepts "+ConvToStr(ServerInstance->stats->statsAccept)+" refused "+ConvToStr(ServerInstance->stats->statsRefused));
-                       results.push_back(sn+" 249 "+user->nick+" :unknown commands "+ConvToStr(ServerInstance->stats->statsUnknown));
-                       results.push_back(sn+" 249 "+user->nick+" :nick collisions "+ConvToStr(ServerInstance->stats->statsCollisions));
-                       results.push_back(sn+" 249 "+user->nick+" :dns requests "+ConvToStr(ServerInstance->stats->statsDnsGood+ServerInstance->stats->statsDnsBad)+" succeeded "+ConvToStr(ServerInstance->stats->statsDnsGood)+" failed "+ConvToStr(ServerInstance->stats->statsDnsBad));
-                       results.push_back(sn+" 249 "+user->nick+" :connection count "+ConvToStr(ServerInstance->stats->statsConnects));
-                       snprintf(buffer,MAXBUF," 249 %s :bytes sent %5.2fK recv %5.2fK",user->nick.c_str(),ServerInstance->stats->statsSent / 1024,ServerInstance->stats->statsRecv / 1024);
-                       results.push_back(sn+buffer);
-               }
-               break;
-
-               /* stats o */
-               case 'o':
-                       for (int i = 0; i < ServerInstance->Config->ConfValueEnum("oper"); i++)
-                       {
-                               char LoginName[MAXBUF];
-                               char HostName[MAXBUF];
-                               char OperType[MAXBUF];
-                               ServerInstance->Config->ConfValue("oper","name", i, LoginName, MAXBUF);
-                               ServerInstance->Config->ConfValue("oper","host", i, HostName, MAXBUF);
-                               ServerInstance->Config->ConfValue("oper","type", i, OperType, MAXBUF);
-                               results.push_back(sn+" 243 "+user->nick+" O "+HostName+" * "+LoginName+" "+OperType+" 0");
-                       }
-               break;
-
-               /* stats l (show user I/O stats) */
-               case 'l':
-                       results.push_back(sn+" 211 "+user->nick+" :nick[ident@host] sendq cmds_out bytes_out cmds_in bytes_in time_open");
-                       for (std::vector<User*>::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
-                       {
-                               User* i = *n;
-                               results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
-                       }
-               break;
-
-       /* stats L (show user I/O stats with IP addresses) */
-               case 'L':
-                       results.push_back(sn+" 211 "+user->nick+" :nick[ident@ip] sendq cmds_out bytes_out cmds_in bytes_in time_open");
-                       for (std::vector<User*>::iterator n = ServerInstance->Users->local_users.begin(); n != ServerInstance->Users->local_users.end(); n++)
-                       {
-                               User* i = *n;
-                               results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
-                       }
-               break;
-
-               /* stats u (show server uptime) */
-               case 'u':
-               {
-                       time_t current_time = 0;
-                       current_time = ServerInstance->Time();
-                       time_t server_uptime = current_time - ServerInstance->startup_time;
-                       struct tm* stime;
-                       stime = gmtime(&server_uptime);
-                       /* i dont know who the hell would have an ircd running for over a year nonstop, but
-                        * Craig suggested this, and it seemed a good idea so in it went */
-                       if (stime->tm_year > 70)
-                       {
-                               char buffer[MAXBUF];
-                               snprintf(buffer,MAXBUF," 242 %s :Server up %d years, %d days, %.2d:%.2d:%.2d",user->nick.c_str(),(stime->tm_year-70),stime->tm_yday,stime->tm_hour,stime->tm_min,stime->tm_sec);
-                               results.push_back(sn+buffer);
-                       }
-                       else
-                       {
-                               char buffer[MAXBUF];
-                               snprintf(buffer,MAXBUF," 242 %s :Server up %d days, %.2d:%.2d:%.2d",user->nick.c_str(),stime->tm_yday,stime->tm_hour,stime->tm_min,stime->tm_sec);
-                               results.push_back(sn+buffer);
-                       }
-               }
-               break;
-
-               default:
-               break;
-       }
-
-       results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
-       ServerInstance->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
-               (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
-       return;
-}
+COMMAND_INIT(CommandStats)
index 002750dfab7e6c1e4df222424505bd5bc96ae21e..4fdcb8aa69d8717f4a4e4b7f0dda682971e63dfd 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_time.h"
 
+#ifndef __CMD_TIME_H__
+#define __CMD_TIME_H__
 
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /TIME. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandTime : public Command
 {
-       return new CommandTime(Instance);
-}
+ public:
+       /** Constructor for time.
+        */
+       CommandTime (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"TIME",0,0) { syntax = "[<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandTime::Handle (const std::vector<std::string>&, User *user)
 {
@@ -36,3 +61,5 @@ CmdResult CommandTime::Handle (const std::vector<std::string>&, User *user)
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandTime)
index 00b58817954078a2c79133977b535d8c40c33770..97321460e470f4dabbb07b6b1907108339972a54 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_topic.h"
 
+#ifndef __CMD_TOPIC_H__
+#define __CMD_TOPIC_H__
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /TOPIC. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandTopic : public Command
 {
-       return new CommandTopic(Instance);
-}
+ public:
+       /** Constructor for topic.
+        */
+       CommandTopic (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"TOPIC",0,1,false,2) { syntax = "<channel> [<topic>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
 
 CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -62,3 +87,5 @@ CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandTopic)
index 05597dc1badd138becd0823dfb0ec9eb657a4abb..9ac590ee132ce4e330695483fbf038460a4c60e2 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_trace.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_TRACE_H__
+#define __CMD_TRACE_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /TRACE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandTrace : public Command
 {
-       return new CommandTrace(Instance);
-}
+ public:
+       /** Constructor for trace.
+        */
+       CommandTrace (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"TRACE","o",0) { syntax = "[<object>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 /** XXX: This is crap. someone fix this when you have time, to be more useful.
  */
@@ -43,3 +68,5 @@ CmdResult CommandTrace::Handle (const std::vector<std::string>&, User *user)
        }*/
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandTrace)
index 931dfdcbdeae6d8bb54aee0ac93af0ea3532cdc4..af51067dd70fc5047702084575b5a9fcb127d6e7 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_unloadmodule.h"
 
+#ifndef __CMD_UNLOADMODULE_H__
+#define __CMD_UNLOADMODULE_H__
 
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /UNLOADMODULE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandUnloadmodule : public Command
 {
-       return new CommandUnloadmodule(Instance);
-}
+ public:
+       /** Constructor for unloadmodule.
+        */
+       CommandUnloadmodule (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"UNLOADMODULE","o",1) { syntax = "<modulename>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -36,3 +61,5 @@ CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameter
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandUnloadmodule)
index b9ef94c97aecb6bcbc0e33f72a944c497c1f0f32..9edfb46b6131ec48de738e437ceaf0abdbab4228 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_user.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_USER_H__
+#define __CMD_USER_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /USER. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandUser : public Command
 {
-       return new CommandUser(Instance);
-}
+ public:
+       /** Constructor for user.
+        */
+       CommandUser (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"USER",0,4,true,0) { syntax = "<username> <localhost> <remotehost> <GECOS>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -65,3 +90,5 @@ CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandUser)
index 83375a0fd4f926f6d7af784b13787522fc46d359..acb67cf1b75f69a023ee552a178b18f7f4594379 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_userhost.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_USERHOST_H__
+#define __CMD_USERHOST_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /USERHOST. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandUserhost : public Command
 {
-       return new CommandUserhost(Instance);
-}
+ public:
+       /** Constructor for userhost.
+        */
+       CommandUserhost (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"USERHOST",0,1) { syntax = "<nick>{,<nick>}"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
 
 CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -64,3 +89,5 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandUserhost)
index 871193c000593e3157f6b5fc48fbb31c3b8793b0..86be41a41f9ff7e02bb7a57d738e7d56f3787c0d 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_version.h"
 
+#ifndef __CMD_VERSION_H__
+#define __CMD_VERSION_H__
 
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /VERSION. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandVersion : public Command
 {
-       return new CommandVersion(Instance);
-}
+ public:
+       /** Constructor for version.
+        */
+       CommandVersion (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"VERSION",0,0) { syntax = "[<servername>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandVersion::Handle (const std::vector<std::string>&, User *user)
 {
@@ -27,3 +52,5 @@ CmdResult CommandVersion::Handle (const std::vector<std::string>&, User *user)
        ServerInstance->Config->Send005(user);
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandVersion)
index 6c846891481c11b048fe780d8a5c5b4da904745d..98b3d3f349a707c620ca159d1d2757f03daf044c 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_wallops.h"
 
+#ifndef __CMD_WALLOPS_H__
+#define __CMD_WALLOPS_H__
 
+// include the common header files
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#include "users.h"
+#include "channels.h"
+
+/** Handle /WALLOPS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandWallops : public Command
 {
-       return new CommandWallops(Instance);
-}
+ public:
+       /** Constructor for wallops.
+        */
+       CommandWallops (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"WALLOPS","o",1,1) { syntax = "<any-text>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandWallops::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -27,3 +52,5 @@ CmdResult CommandWallops::Handle (const std::vector<std::string>& parameters, Us
        FOREACH_MOD(I_OnWallops,OnWallops(user,parameters[0]));
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandWallops)
index a85e00fa3295456922ad36073cfe22aeed099637..1e7c7d6aa064a5c9747b4c8e5e92573c32ffd376 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_who.h"
+
+#ifndef __CMD_WHO_H__
+#define __CMD_WHO_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /WHO. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandWho : public Command
+{
+       bool CanView(Channel* chan, User* user);
+       bool opt_viewopersonly;
+       bool opt_showrealhost;
+       bool opt_unlimit;
+       bool opt_realname;
+       bool opt_mode;
+       bool opt_ident;
+       bool opt_metadata;
+       bool opt_port;
+       bool opt_away;
+       bool opt_local;
+       bool opt_far;
+       bool opt_time;
+
+ public:
+       /** Constructor for who.
+        */
+       CommandWho (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"WHO", 0, 1, false, 2) { syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; }
+       void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults);
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+       bool whomatch(User* user, const char* matchtext);
+};
+
+#endif
+
 
 static const std::string star = "*";
 
@@ -120,11 +166,6 @@ bool CommandWho::whomatch(User* user, const char* matchtext)
 
 
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
-{
-       return new CommandWho(Instance);
-}
-
 bool CommandWho::CanView(Channel* chan, User* user)
 {
        if (!user || !chan)
@@ -367,3 +408,5 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
                return CMD_FAILURE;
        }
 }
+
+COMMAND_INIT(CommandWho)
index b2f3223514aa5d1b0e17347f68894c163375676f..9b64d5e8b10371788cec2f80d9c3265957371b84 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "hashcomp.h"
 
-void do_whois(InspIRCd* ServerInstance, User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick)
+/** Handle /WHOIS. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandWhois : public Command
 {
-       ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str());
-       if (user == dest || user->HasPrivPermission("users/auspex"))
-       {
-               ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString());
-       }
-
-       std::string cl = dest->ChannelList(user);
-
-       if (cl.length())
-       {
-               if (cl.length() > 400)
-               {
-                       user->SplitChanList(dest,cl);
-               }
-               else
-               {
-                       ServerInstance->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), cl.c_str());
-               }
-       }
-       if (user != dest && *ServerInstance->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex"))
-       {
-               ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), ServerInstance->Config->HideWhoisServer, ServerInstance->Config->Network);
-       }
-       else
-       {
-               ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->server, ServerInstance->GetServerDescription(dest->server).c_str());
-       }
-
-       if (IS_AWAY(dest))
-       {
-               ServerInstance->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
-       }
-
-       if (IS_OPER(dest))
-       {
-               if (ServerInstance->Config->GenericOper)
-                       ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is an IRC operator",user->nick.c_str(), dest->nick.c_str());
-               else
-                       ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is %s %s on %s",user->nick.c_str(), dest->nick.c_str(), (strchr("AEIOUaeiou",dest->oper[0]) ? "an" : "a"),irc::Spacify(dest->oper.c_str()), ServerInstance->Config->Network);
-       }
-
-       if (user == dest || user->HasPrivPermission("users/auspex"))
-       {
-               if (dest->IsModeSet('s') != 0)
-               {
-                       ServerInstance->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s +%s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes(), dest->FormatNoticeMasks());
-               }
-               else
-               {
-                       ServerInstance->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes());
-               }
-       }
-
-       FOREACH_MOD(I_OnWhois,OnWhois(user,dest));
-
-       /*
-        * We only send these if we've been provided them. That is, if hidewhois is turned off, and user is local, or
-        * if remote whois is queried, too. This is to keep the user hidden, and also since you can't reliably tell remote time. -- w00t
+ public:
+       /** Constructor for whois.
         */
-       if ((idle) || (signon))
-       {
-               ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %lu %lu :seconds idle, signon time",user->nick.c_str(), dest->nick.c_str(), idle, signon);
-       }
-
-       ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick.c_str(), dest->nick.c_str());
-}
-
+       CommandWhois (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"WHOIS",0,1,false,2) { syntax = "<nick>{,<nick>}"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
 
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
-{
-       return new CommandWhois(Instance);
-}
-
 CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User *user)
 {
        User *dest;
@@ -129,7 +72,7 @@ CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User
                        signon = dest->signon;
                }
 
-               do_whois(this->ServerInstance, user,dest,signon,idle,parameters[userindex].c_str());
+               ServerInstance->DoWhois(user,dest,signon,idle,parameters[userindex].c_str());
        }
        else
        {
@@ -143,3 +86,5 @@ CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User
 }
 
 
+
+COMMAND_INIT(CommandWhois)
index 1109b4d8ba63f6dfc88310781b45ce05d623a191..5e77671a67d14508cdc0add761d4321af063cdc6 100644 (file)
 
 WhoWasMaintainTimer * timer;
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
-{
-       return new CommandWhowas(Instance);
-}
-
-CommandWhowas::CommandWhowas(InspIRCd* Instance) : Command(Instance, NULL, "WHOWAS", 0, 1, false, 2)
+CommandWhowas::CommandWhowas(InspIRCd* Instance, Module* parent) : Command(Instance,parent, "WHOWAS", 0, 1, false, 2)
 {
        syntax = "<nick>{,<nick>}";
        timer = new WhoWasMaintainTimer(Instance, 3600);
@@ -335,3 +330,5 @@ void WhoWasMaintainTimer::Tick(time_t)
                whowas_command->HandleInternal(WHOWAS_MAINTAIN, params);
        }
 }
+
+COMMAND_INIT(CommandWhowas)
index 93ad7f8936bcfe4d0ee59dfa06ebb736a15f1fc9..81476a032f961be3c77824a563b25b8df9b5e3d2 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_zline.h"
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *      the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#ifndef __CMD_ZLINE_H__
+#define __CMD_ZLINE_H__
 
+// include the common header files
 
+#include "users.h"
+#include "channels.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+/** Handle /ZLINE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandZline : public Command
 {
-       return new CommandZline(Instance);
-}
+ public:
+       /** Constructor for zline.
+        */
+       CommandZline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ZLINE","o",1,3,false,0) { syntax = "<ipmask> [<duration> :<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
+#endif
+
+
+
 
 CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -91,3 +128,5 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandZline)
index 94dd41da0a0c21a5094d9c020f44cdfa0699eaf7..810c477f8e8ab721d6fc96c895674a87efdf8dbf 100644 (file)
@@ -126,8 +126,6 @@ void InspIRCd::Cleanup()
                        this->Modules->Unload(k->c_str());
                }
        }
-       /* Remove core commands */
-       Parser->RemoveRFCCommands();
 
        /* Cleanup Server Names */
        for(servernamelist::iterator itr = servernames.begin(); itr != servernames.end(); ++itr)
@@ -571,9 +569,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        this->Config->Apply(NULL, "");
        Logs->OpenFileLogs();
 
-       /** Note: This is safe, the method checks for user == NULL */
-       this->Parser->SetupCommandTable();
-
        this->Res = new DNS(this);
 
        this->AddServerName(Config->ServerName);
index f0ff37726af55febf70ef6be96a3e76920bfe659..cec146f76a7eb791bbcb25fbb27e68254d2786d9 100644 (file)
@@ -580,6 +580,32 @@ void ModuleManager::LoadAll()
        char configToken[MAXBUF];
        ModCount = -1;
 
+       printf("\nLoading core commands");
+       fflush(stdout);
+
+       DIR* library = opendir(Instance->Config->ModPath.c_str());
+       if (library)
+       {
+               dirent* entry = NULL;
+               while (0 != (entry = readdir(library)))
+               {
+                       if (InspIRCd::Match(entry->d_name, "cmd_*.so", ascii_case_insensitive_map))
+                       {
+                               printf(".");
+                               fflush(stdout);
+
+                               if (!Load(entry->d_name))
+                               {
+                                       Instance->Logs->Log("MODULE", DEFAULT, this->LastError());
+                                       printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str());
+                                       Instance->Exit(EXIT_STATUS_MODULE);
+                               }
+                       }
+               }
+               closedir(library);
+               printf("\n");
+       }
+
        for(int count = 0; count < Instance->Config->ConfValueEnum("module"); count++)
        {
                Instance->Config->ConfValue("module", "name", count, configToken, MAXBUF);
index 7168e9eed9f1c085cfe48208e9ecd695f8c1dc7f..ae26f3600d91f217e6c41da82c7c8569689e24a5 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 1ccd466ad405afc9232b09cbb9e5dd96f0f29f72..56f34283b72bdd5bc33ee4bf4b0892922e533bcd 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index e1d46d0d974da1ce9d33f6d5999f98d88b1fc219..332e475858c9980d0834b62b9ff80862ad309290 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 7f152a0f504fbb1a5755597234f0a1c0c5122918..e074f71ef73aa21eabf41793359ba160c97ee510 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index c63b8dc4d1ec0f73b73b096ef7a375aeeabfb0d4..2a5cfcdabd035e48fa63fc5d68a473cc5cadfb2a 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 10d46bbc3cafbc30bd517f822523d1e286e940d9..6854bc31c7b90a63983267a9149ea702dc165410 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index fe229d5cc20e7c812fbcbe7663a96c34c79e8966..270608062618b493b2f58e6cc0513cb5b14de7db 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index a13385cd1260485389e4664c5dff785a74a2d5a1..5360f176cf9d3a8218e3cc2d63c290b3812785d1 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index ecffcf05e3d08eddde331bdcade8e1c197fcc5c4..aa4834303c82bc4fa139e4898286ec2e8c64d1d5 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index bd97274984abd45b43aef371619386bde5a9ecf2..54a2870bdf72e2cb9313fb31ef5f174e633df46b 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 2d7199571531544e64660c3639fd54fedb11c3a8..84bf8ce779e90805f61a4e6a5faf66fa720d112b 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 044d6e50cc78b18b68ac1fee2b1b6e556ff75110..1318b60a0975e2a714258dc836c5f7180ed892bf 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 6d9cd419374f733d09f939a472d792b3fc30c9fb..b551ef6d2e89f8c436d7c0ca56e1917cb055c6f6 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index d2cea154a2c00e792ae1dd8d082adca235e87361..2cf4fa3ad58860fb4de074f39a845c433a592f92 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
@@ -68,8 +66,14 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const std::ve
        else
        {
                Module* srcmodule = thiscmd->creator;
+               Version ver = srcmodule->GetVersion();
 
-               if (srcmodule && !(srcmodule->GetVersion().Flags & VF_COMMON)) {
+               // XXX Temporary check to avoid routing cmd_* entries while they default to global routing
+               if (srcmodule->ModuleSourceFile[0] == 'c')
+                       return;
+
+               if (!(ver.Flags & VF_COMMON))
+               {
                        ServerInstance->Logs->Log("m_spanningtree",ERROR,"Routed command %s from non-VF_COMMON module %s",
                                command.c_str(), srcmodule->ModuleSourceFile.c_str());
                        return;
index 94f98faf1bb240123edf59edf84804379487c910..6564dd95b1c8a978310799302448cac1169a2f28 100644 (file)
@@ -14,8 +14,6 @@
 /* $ModDesc: Provides a spanning tree server link protocol */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index e0545f01e74c420a278c0b62450ceb15f6a86bc1..88c6b55bdb13d52fe71774451c1b0b34e6570dbe 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 3e084dc19bf6fc314e7209f283c4680ade131e26..1811d73a1f3a0c5cbf9e304f65d8e41924e3660f 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 51197cb11f908eb193f784c657ce5a14a9c7dbfe..fc3011bc2b63dee77ec00060156b0600ad8556e1 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 0b82bfd99c1c85c108f9b5932d55b88e68112cca..fc85cd0497cc1f82270d4e3fa193f2631ed0982d 100644 (file)
@@ -14,8 +14,6 @@
 #ifndef __RESOLVERS__H__
 #define __RESOLVERS__H__
 
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "inspircd.h"
 #include "xline.h"
index e9c69a1d44ab7e7b812f26ead40dc2c6eba2ef9c..2afe8d4f897c8b88422025a5002f16b983809def 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 25f811267515fe15f10845816b968df66f8630e6..9969fdca713bcfc85b253b2311e55cc2135064a3 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 6351c93b54a48c919e454f97c9fce7c285ca23d4..c275f349007e9ae6cfc68cb1ebe3e7816164417d 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 810b6dc7723d301f949f8e926d612991840d6089..d67c5a3af55e0f8e920b1fed771508e5988d8889 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
@@ -44,7 +42,7 @@ bool TreeSocket::Stats(const std::string &prefix, parameterlist &params)
                                parameterlist par;
                                par.push_back(prefix);
                                par.push_back("");
-                               DoStats(this->ServerInstance, *(params[0].c_str()), source, results);
+                               ServerInstance->DoStats(params[0][0], source, results);
                                for (size_t i = 0; i < results.size(); i++)
                                {
                                        par[1] = "::" + results[i];
index dbdcce718c79517c7759d7377cd966adbfa21fa0..b6246e2f4040637270c036c080332d283f2c7e09 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 48e0c638a765f0dda19f0dd5b648314de780151e..3af6961d07493c096e44450db18ee487e8b91205 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 1649b32b6bca090a0782584c500d5cf4d976d8a4..83e329b4e46fef0b0a1cd6ce093320df92f29f43 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index d2c8f79897275fcf255eba9e10e0a04a5e0c2766..82a7fe62e33249b19f0da1ee2c28540ef23149f2 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index c9f4cfdfa7fcf1e11cfe219ac97e610eb762f3fd..a07d540bc1076b9eda38f2dddfb9994dd14d2d30 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 34d042432a015bb127a0608d01910f76de18725e..37cfbbd9ee95bac74453768de41233d66f2ea14e 100644 (file)
@@ -14,8 +14,6 @@
 #ifndef __TREESOCKET_H__
 #define __TREESOCKET_H__
 
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "inspircd.h"
 #include "xline.h"
index f31685c01e39563c203ff8a6c858c4c686728a3d..6703021a8f5f2b7d59b4d59e042ef3dbe0f97d92 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 922e6f78404403808804e8584f11232b179c59e7..dac0216aa0ffda87fcbf56a1295f4693ae1a0cec 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 13a4cc760fd27e88a4a2d4118031f814f6316979..30b9cad3c1ef23897dfbed28bd5c16676a2ad746 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index abf61611a857cc3dcdff9583653179fe168fdff6..6cec7baf9d31820c6a12d244ae907da54a4a3563 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
index 7967131826a9db98f9f9667183d57054515db0ae..f12a7f1090500c6e947a8d437f4b215a2ee915bc 100644 (file)
@@ -12,8 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "commands/cmd_whois.h"
-#include "commands/cmd_stats.h"
 #include "socket.h"
 #include "xline.h"
 #include "../transport.h"
@@ -69,7 +67,7 @@ bool TreeSocket::Whois(const std::string &prefix, parameterlist &params)
                                unsigned long idle = atoi(params[2].c_str());
                                if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
                                {
-                                       do_whois(this->ServerInstance, who_to_send_to, u, signon, idle, nick_whoised.c_str());
+                                       ServerInstance->DoWhois(who_to_send_to, u, signon, idle, nick_whoised.c_str());
                                }
                        }
                        else
diff --git a/src/stats.cpp b/src/stats.cpp
new file mode 100644 (file)
index 0000000..d385112
--- /dev/null
@@ -0,0 +1,310 @@
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *         the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include "inspircd.h"
+#include "xline.h"
+#include "commands/cmd_whowas.h"
+
+void InspIRCd::DoStats(char statschar, User* user, string_list &results)
+{
+       std::string sn(this->Config->ServerName);
+
+       if (!user->HasPrivPermission("servers/auspex") && !strchr(this->Config->UserStats, statschar))
+       {
+               this->SNO->WriteToSnoMask('t',
+                               "%s '%c' denied for %s (%s@%s)",
+                               (IS_LOCAL(user) ? "Stats" : "Remote stats"),
+                               statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+               results.push_back(sn + " 481 " + user->nick + " :Permission denied - STATS " + statschar + " requires the servers/auspex priv.");
+               return;
+       }
+
+       ModResult MOD_RESULT;
+       FIRST_MOD_RESULT(this, OnStats, MOD_RESULT, (statschar, user, results));
+       if (MOD_RESULT == MOD_RES_DENY)
+       {
+               results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
+               this->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
+                       (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+               return;
+       }
+
+       switch (statschar)
+       {
+               /* stats p (show listening ports and registered clients on each) */
+               case 'p':
+               {
+                       for (size_t i = 0; i < this->ports.size(); i++)
+                       {
+                               std::string ip = this->ports[i]->GetIP();
+                               if (ip.empty())
+                                       ip.assign("*");
+
+                               results.push_back(sn+" 249 "+user->nick+" :"+ ip + ":"+ConvToStr(this->ports[i]->GetPort())+" (client, " +
+                                               this->ports[i]->GetDescription() + ")");
+                       }
+               }
+               break;
+
+               /* These stats symbols must be handled by a linking module */
+               case 'n':
+               case 'c':
+               break;
+
+               case 'i':
+               {
+                       int idx = 0;
+                       for (ClassVector::iterator i = this->Config->Classes.begin(); i != this->Config->Classes.end(); i++)
+                       {
+                               ConnectClass* c = *i;
+                               results.push_back(sn+" 215 "+user->nick+" i NOMATCH * "+c->GetHost()+" "+ConvToStr(c->limit ? c->limit : this->SE->GetMaxFds())+" "+ConvToStr(idx)+" "+this->Config->ServerName+" *");
+                               idx++;
+                       }
+               }
+               break;
+
+               case 'Y':
+               {
+                       int idx = 0;
+                       for (ClassVector::iterator i = this->Config->Classes.begin(); i != this->Config->Classes.end(); i++)
+                       {
+                               ConnectClass* c = *i;
+                               results.push_back(sn+" 218 "+user->nick+" Y "+ConvToStr(idx)+" "+ConvToStr(c->GetPingTime())+" 0 "+ConvToStr(c->GetSendqMax())+" :"+
+                                               ConvToStr(c->GetRecvqMax())+" "+ConvToStr(c->GetRegTimeout()));
+                               idx++;
+                       }
+               }
+               break;
+
+               case 'U':
+               {
+                       char ulined[MAXBUF];
+                       for (int i = 0; i < this->Config->ConfValueEnum("uline"); i++)
+                       {
+                               this->Config->ConfValue("uline","server", i, ulined, MAXBUF);
+                                       results.push_back(sn+" 248 "+user->nick+" U "+std::string(ulined));
+                       }
+               }
+               break;
+
+               case 'P':
+               {
+                       int idx = 0;
+                       for (user_hash::iterator i = this->Users->clientlist->begin(); i != this->Users->clientlist->end(); i++)
+                       {
+                               if (IS_OPER(i->second) && !this->ULine(i->second->server))
+                               {
+                                       results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+
+                                                       (IS_LOCAL(i->second) ? ConvToStr(this->Time() - i->second->idle_lastmsg) + " secs" : "unavailable"));
+                                       idx++;
+                               }
+                       }
+                       results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(idx)+" OPER(s)");
+               }
+               break;
+
+               case 'k':
+                       this->XLines->InvokeStats("K",216,user,results);
+               break;
+               case 'g':
+                       this->XLines->InvokeStats("G",223,user,results);
+               break;
+               case 'q':
+                       this->XLines->InvokeStats("Q",217,user,results);
+               break;
+               case 'Z':
+                       this->XLines->InvokeStats("Z",223,user,results);
+               break;
+               case 'e':
+                       this->XLines->InvokeStats("E",223,user,results);
+               break;
+               case 'E':
+                       results.push_back(sn+" 249 "+user->nick+" :Total events: "+ConvToStr(this->SE->TotalEvents));
+                       results.push_back(sn+" 249 "+user->nick+" :Read events:  "+ConvToStr(this->SE->ReadEvents));
+                       results.push_back(sn+" 249 "+user->nick+" :Write events: "+ConvToStr(this->SE->WriteEvents));
+                       results.push_back(sn+" 249 "+user->nick+" :Error events: "+ConvToStr(this->SE->ErrorEvents));
+               break;
+
+               /* stats m (list number of times each command has been used, plus bytecount) */
+               case 'm':
+                       for (Commandtable::iterator i = this->Parser->cmdlist.begin(); i != this->Parser->cmdlist.end(); i++)
+                       {
+                               if (i->second->use_count)
+                               {
+                                       /* RPL_STATSCOMMANDS */
+                                       results.push_back(sn+" 212 "+user->nick+" "+i->second->command+" "+ConvToStr(i->second->use_count)+" "+ConvToStr(i->second->total_bytes));
+                               }
+                       }
+               break;
+
+               /* stats z (debug and memory info) */
+               case 'z':
+               {
+                       results.push_back(sn+" 240 "+user->nick+" :InspIRCd: "+ConvToStr(sizeof(InspIRCd))+" bytes");
+                       results.push_back(sn+" 249 "+user->nick+" :Users: "+ConvToStr(this->Users->clientlist->size()));
+                       results.push_back(sn+" 249 "+user->nick+" :Channels: "+ConvToStr(this->chanlist->size()));
+                       results.push_back(sn+" 249 "+user->nick+" :Commands: "+ConvToStr(this->Parser->cmdlist.size()));
+
+                       if (!this->Config->WhoWasGroupSize == 0 && !this->Config->WhoWasMaxGroups == 0)
+                       {
+                               Command* whowas_command = this->Parser->GetHandler("WHOWAS");
+                               if (whowas_command)
+                               {
+                                       std::deque<classbase*> params;
+                                       Extensible whowas_stats;
+                                       params.push_back(&whowas_stats);
+                                       whowas_command->HandleInternal(WHOWAS_STATS, params);
+                                       if (whowas_stats.GetExt("stats"))
+                                       {
+                                               char* statc;
+                                               whowas_stats.GetExt("stats", statc);
+                                               results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(statc));
+                                       }
+                               }
+                       }
+
+                       results.push_back(sn+" 249 "+user->nick+" :MOTD "+ConvToStr(this->Config->MOTD.size())+", RULES "+ConvToStr(this->Config->RULES.size()));
+
+                       float kbitpersec_in, kbitpersec_out, kbitpersec_total;
+                       char kbitpersec_in_s[30], kbitpersec_out_s[30], kbitpersec_total_s[30];
+
+                       this->SE->GetStats(kbitpersec_in, kbitpersec_out, kbitpersec_total);
+
+                       snprintf(kbitpersec_total_s, 30, "%03.5f", kbitpersec_total);
+                       snprintf(kbitpersec_out_s, 30, "%03.5f", kbitpersec_out);
+                       snprintf(kbitpersec_in_s, 30, "%03.5f", kbitpersec_in);
+
+                       results.push_back(sn+" 249 "+user->nick+" :Bandwidth total:  "+ConvToStr(kbitpersec_total_s)+" kilobits/sec");
+                       results.push_back(sn+" 249 "+user->nick+" :Bandwidth out:    "+ConvToStr(kbitpersec_out_s)+" kilobits/sec");
+                       results.push_back(sn+" 249 "+user->nick+" :Bandwidth in:     "+ConvToStr(kbitpersec_in_s)+" kilobits/sec");
+
+#ifndef WIN32
+                       /* Moved this down here so all the not-windows stuff (look w00tie, I didn't say win32!) is in one ifndef.
+                        * Also cuts out some identical code in both branches of the ifndef. -- Om
+                        */
+                       rusage R;
+
+                       /* Not sure why we were doing '0' with a RUSAGE_SELF comment rather than just using RUSAGE_SELF -- Om */
+                       if (!getrusage(RUSAGE_SELF,&R)) /* RUSAGE_SELF */
+                       {
+                               results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr(R.ru_maxrss)+"K");
+                               results.push_back(sn+" 249 "+user->nick+" :Signals:          "+ConvToStr(R.ru_nsignals));
+                               results.push_back(sn+" 249 "+user->nick+" :Page faults:      "+ConvToStr(R.ru_majflt));
+                               results.push_back(sn+" 249 "+user->nick+" :Swaps:            "+ConvToStr(R.ru_nswap));
+                               results.push_back(sn+" 249 "+user->nick+" :Context Switches: Voluntary; "+ConvToStr(R.ru_nvcsw)+" Involuntary; "+ConvToStr(R.ru_nivcsw));
+
+                               timeval tv;
+                               char percent[30];
+                               gettimeofday(&tv, NULL);
+
+                               float n_elapsed = ((tv.tv_sec - this->stats->LastSampled.tv_sec) * 1000000 + tv.tv_usec - this->stats->LastSampled.tv_usec);
+                               float n_eaten = ((R.ru_utime.tv_sec - this->stats->LastCPU.tv_sec) * 1000000 + R.ru_utime.tv_usec - this->stats->LastCPU.tv_usec);
+                               float per = (n_eaten / n_elapsed) * 100;
+
+                               snprintf(percent, 30, "%03.5f%%", per);
+                               results.push_back(sn+" 249 "+user->nick+" :CPU Usage: "+percent);
+                       }
+#else
+                       PROCESS_MEMORY_COUNTERS MemCounters;
+                       if (GetProcessMemoryInfo(GetCurrentProcess(), &MemCounters, sizeof(MemCounters)))
+                       {
+                               results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr((MemCounters.WorkingSetSize + MemCounters.PagefileUsage) / 1024)+"K");
+                               results.push_back(sn+" 249 "+user->nick+" :Pagefile usage:   "+ConvToStr(MemCounters.PagefileUsage / 1024)+"K");
+                               results.push_back(sn+" 249 "+user->nick+" :Page faults:      "+ConvToStr(MemCounters.PageFaultCount));
+                               results.push_back(sn+" 249 "+user->nick+" :CPU Usage: " + ConvToStr(getcpu()) + "%");
+                       }
+#endif
+               }
+               break;
+
+               case 'T':
+               {
+                       char buffer[MAXBUF];
+                       results.push_back(sn+" 249 "+user->nick+" :accepts "+ConvToStr(this->stats->statsAccept)+" refused "+ConvToStr(this->stats->statsRefused));
+                       results.push_back(sn+" 249 "+user->nick+" :unknown commands "+ConvToStr(this->stats->statsUnknown));
+                       results.push_back(sn+" 249 "+user->nick+" :nick collisions "+ConvToStr(this->stats->statsCollisions));
+                       results.push_back(sn+" 249 "+user->nick+" :dns requests "+ConvToStr(this->stats->statsDnsGood+this->stats->statsDnsBad)+" succeeded "+ConvToStr(this->stats->statsDnsGood)+" failed "+ConvToStr(this->stats->statsDnsBad));
+                       results.push_back(sn+" 249 "+user->nick+" :connection count "+ConvToStr(this->stats->statsConnects));
+                       snprintf(buffer,MAXBUF," 249 %s :bytes sent %5.2fK recv %5.2fK",user->nick.c_str(),this->stats->statsSent / 1024,this->stats->statsRecv / 1024);
+                       results.push_back(sn+buffer);
+               }
+               break;
+
+               /* stats o */
+               case 'o':
+                       for (int i = 0; i < this->Config->ConfValueEnum("oper"); i++)
+                       {
+                               char LoginName[MAXBUF];
+                               char HostName[MAXBUF];
+                               char OperType[MAXBUF];
+                               this->Config->ConfValue("oper","name", i, LoginName, MAXBUF);
+                               this->Config->ConfValue("oper","host", i, HostName, MAXBUF);
+                               this->Config->ConfValue("oper","type", i, OperType, MAXBUF);
+                               results.push_back(sn+" 243 "+user->nick+" O "+HostName+" * "+LoginName+" "+OperType+" 0");
+                       }
+               break;
+
+               /* stats l (show user I/O stats) */
+               case 'l':
+                       results.push_back(sn+" 211 "+user->nick+" :nick[ident@host] sendq cmds_out bytes_out cmds_in bytes_in time_open");
+                       for (std::vector<User*>::iterator n = this->Users->local_users.begin(); n != this->Users->local_users.end(); n++)
+                       {
+                               User* i = *n;
+                               results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(this->Time() - i->age));
+                       }
+               break;
+
+       /* stats L (show user I/O stats with IP addresses) */
+               case 'L':
+                       results.push_back(sn+" 211 "+user->nick+" :nick[ident@ip] sendq cmds_out bytes_out cmds_in bytes_in time_open");
+                       for (std::vector<User*>::iterator n = this->Users->local_users.begin(); n != this->Users->local_users.end(); n++)
+                       {
+                               User* i = *n;
+                               results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(this->Time() - i->age));
+                       }
+               break;
+
+               /* stats u (show server uptime) */
+               case 'u':
+               {
+                       time_t current_time = 0;
+                       current_time = this->Time();
+                       time_t server_uptime = current_time - this->startup_time;
+                       struct tm* stime;
+                       stime = gmtime(&server_uptime);
+                       /* i dont know who the hell would have an ircd running for over a year nonstop, but
+                        * Craig suggested this, and it seemed a good idea so in it went */
+                       if (stime->tm_year > 70)
+                       {
+                               char buffer[MAXBUF];
+                               snprintf(buffer,MAXBUF," 242 %s :Server up %d years, %d days, %.2d:%.2d:%.2d",user->nick.c_str(),(stime->tm_year-70),stime->tm_yday,stime->tm_hour,stime->tm_min,stime->tm_sec);
+                               results.push_back(sn+buffer);
+                       }
+                       else
+                       {
+                               char buffer[MAXBUF];
+                               snprintf(buffer,MAXBUF," 242 %s :Server up %d days, %.2d:%.2d:%.2d",user->nick.c_str(),stime->tm_yday,stime->tm_hour,stime->tm_min,stime->tm_sec);
+                               results.push_back(sn+buffer);
+                       }
+               }
+               break;
+
+               default:
+               break;
+       }
+
+       results.push_back(sn+" 219 "+user->nick+" "+statschar+" :End of /STATS report");
+       this->SNO->WriteToSnoMask('t',"%s '%c' requested by %s (%s@%s)",
+               (IS_LOCAL(user) ? "Stats" : "Remote stats"), statschar, user->nick.c_str(), user->ident.c_str(), user->host.c_str());
+       return;
+}
diff --git a/src/whois.cpp b/src/whois.cpp
new file mode 100644 (file)
index 0000000..341c838
--- /dev/null
@@ -0,0 +1,86 @@
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
+ *
+ * This program is free but copyrighted software; see
+ *         the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
+
+#include "inspircd.h"
+
+void InspIRCd::DoWhois(User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick)
+{
+       this->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str());
+       if (user == dest || user->HasPrivPermission("users/auspex"))
+       {
+               this->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString());
+       }
+
+       std::string cl = dest->ChannelList(user);
+
+       if (cl.length())
+       {
+               if (cl.length() > 400)
+               {
+                       user->SplitChanList(dest,cl);
+               }
+               else
+               {
+                       this->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), cl.c_str());
+               }
+       }
+       if (user != dest && *this->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex"))
+       {
+               this->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), this->Config->HideWhoisServer, this->Config->Network);
+       }
+       else
+       {
+               this->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->server, this->GetServerDescription(dest->server).c_str());
+       }
+
+       if (IS_AWAY(dest))
+       {
+               this->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
+       }
+
+       if (IS_OPER(dest))
+       {
+               if (this->Config->GenericOper)
+                       this->SendWhoisLine(user, dest, 313, "%s %s :is an IRC operator",user->nick.c_str(), dest->nick.c_str());
+               else
+                       this->SendWhoisLine(user, dest, 313, "%s %s :is %s %s on %s",user->nick.c_str(), dest->nick.c_str(), (strchr("AEIOUaeiou",dest->oper[0]) ? "an" : "a"),irc::Spacify(dest->oper.c_str()), this->Config->Network);
+       }
+
+       if (user == dest || user->HasPrivPermission("users/auspex"))
+       {
+               if (dest->IsModeSet('s') != 0)
+               {
+                       this->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s +%s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes(), dest->FormatNoticeMasks());
+               }
+               else
+               {
+                       this->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes());
+               }
+       }
+
+       FOREACH_MOD_I(this, I_OnWhois,OnWhois(user,dest));
+
+       /*
+        * We only send these if we've been provided them. That is, if hidewhois is turned off, and user is local, or
+        * if remote whois is queried, too. This is to keep the user hidden, and also since you can't reliably tell remote time. -- w00t
+        */
+       if ((idle) || (signon))
+       {
+               this->SendWhoisLine(user, dest, 317, "%s %s %lu %lu :seconds idle, signon time",user->nick.c_str(), dest->nick.c_str(), idle, signon);
+       }
+
+       this->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick.c_str(), dest->nick.c_str());
+}
+
+
+