summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-03 02:30:12 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-03 02:30:12 +0000
commitf4472dd6dcdfbb5d4a2a50ddc615644c3b2c8145 (patch)
treedf27c8b3070c1fe4f285259f925de9fabe31b8a5
parentc29175d8064b3428685da1155704b6c54c116b94 (diff)
Change cmd_*.so to use the Module object API
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
-rw-r--r--.Makefile.inc7
-rw-r--r--.inspircd.inc1
-rwxr-xr-xconfigure10
-rw-r--r--include/command_parse.h55
-rw-r--r--include/commands/cmd_admin.h40
-rw-r--r--include/commands/cmd_away.h42
-rw-r--r--include/commands/cmd_clearcache.h41
-rw-r--r--include/commands/cmd_commands.h42
-rw-r--r--include/commands/cmd_connect.h42
-rw-r--r--include/commands/cmd_die.h42
-rw-r--r--include/commands/cmd_eline.h42
-rw-r--r--include/commands/cmd_gline.h42
-rw-r--r--include/commands/cmd_info.h42
-rw-r--r--include/commands/cmd_invite.h42
-rw-r--r--include/commands/cmd_ison.h42
-rw-r--r--include/commands/cmd_join.h42
-rw-r--r--include/commands/cmd_kick.h42
-rw-r--r--include/commands/cmd_kill.h42
-rw-r--r--include/commands/cmd_kline.h42
-rw-r--r--include/commands/cmd_links.h42
-rw-r--r--include/commands/cmd_list.h42
-rw-r--r--include/commands/cmd_loadmodule.h42
-rw-r--r--include/commands/cmd_lusers.h42
-rw-r--r--include/commands/cmd_map.h42
-rw-r--r--include/commands/cmd_mode.h41
-rw-r--r--include/commands/cmd_modules.h42
-rw-r--r--include/commands/cmd_motd.h45
-rw-r--r--include/commands/cmd_names.h42
-rw-r--r--include/commands/cmd_nick.h50
-rw-r--r--include/commands/cmd_notice.h42
-rw-r--r--include/commands/cmd_oper.h44
-rw-r--r--include/commands/cmd_part.h42
-rw-r--r--include/commands/cmd_pass.h45
-rw-r--r--include/commands/cmd_ping.h42
-rw-r--r--include/commands/cmd_pong.h43
-rw-r--r--include/commands/cmd_privmsg.h42
-rw-r--r--include/commands/cmd_qline.h42
-rw-r--r--include/commands/cmd_quit.h42
-rw-r--r--include/commands/cmd_rehash.h42
-rw-r--r--include/commands/cmd_reloadmodule.h42
-rw-r--r--include/commands/cmd_restart.h45
-rw-r--r--include/commands/cmd_rules.h45
-rw-r--r--include/commands/cmd_server.h42
-rw-r--r--include/commands/cmd_squit.h45
-rw-r--r--include/commands/cmd_stats.h45
-rw-r--r--include/commands/cmd_time.h42
-rw-r--r--include/commands/cmd_topic.h42
-rw-r--r--include/commands/cmd_trace.h42
-rw-r--r--include/commands/cmd_unloadmodule.h42
-rw-r--r--include/commands/cmd_user.h42
-rw-r--r--include/commands/cmd_userhost.h42
-rw-r--r--include/commands/cmd_version.h42
-rw-r--r--include/commands/cmd_wallops.h42
-rw-r--r--include/commands/cmd_who.h58
-rw-r--r--include/commands/cmd_whois.h45
-rw-r--r--include/commands/cmd_whowas.h2
-rw-r--r--include/commands/cmd_zline.h42
-rw-r--r--include/inspircd.h24
-rw-r--r--include/modules.h2
-rw-r--r--make/configure.pm1
-rw-r--r--src/command_parse.cpp158
-rw-r--r--src/commands/cmd_admin.cpp33
-rw-r--r--src/commands/cmd_away.cpp35
-rw-r--r--src/commands/cmd_clearcache.cpp34
-rw-r--r--src/commands/cmd_commands.cpp37
-rw-r--r--src/commands/cmd_connect.cpp39
-rw-r--r--src/commands/cmd_die.cpp37
-rw-r--r--src/commands/cmd_eline.cpp47
-rw-r--r--src/commands/cmd_gline.cpp47
-rw-r--r--src/commands/cmd_info.cpp35
-rw-r--r--src/commands/cmd_invite.cpp35
-rw-r--r--src/commands/cmd_ison.cpp35
-rw-r--r--src/commands/cmd_join.cpp35
-rw-r--r--src/commands/cmd_kick.cpp35
-rw-r--r--src/commands/cmd_kill.cpp35
-rw-r--r--src/commands/cmd_kline.cpp47
-rw-r--r--src/commands/cmd_links.cpp35
-rw-r--r--src/commands/cmd_list.cpp37
-rw-r--r--src/commands/cmd_loadmodule.cpp35
-rw-r--r--src/commands/cmd_lusers.cpp35
-rw-r--r--src/commands/cmd_map.cpp35
-rw-r--r--src/commands/cmd_mode.cpp34
-rw-r--r--src/commands/cmd_modules.cpp35
-rw-r--r--src/commands/cmd_motd.cpp38
-rw-r--r--src/commands/cmd_names.cpp35
-rw-r--r--src/commands/cmd_nick.cpp55
-rw-r--r--src/commands/cmd_notice.cpp35
-rw-r--r--src/commands/cmd_oper.cpp41
-rw-r--r--src/commands/cmd_part.cpp35
-rw-r--r--src/commands/cmd_pass.cpp38
-rw-r--r--src/commands/cmd_ping.cpp35
-rw-r--r--src/commands/cmd_pong.cpp36
-rw-r--r--src/commands/cmd_privmsg.cpp35
-rw-r--r--src/commands/cmd_qline.cpp47
-rw-r--r--src/commands/cmd_quit.cpp35
-rw-r--r--src/commands/cmd_rehash.cpp47
-rw-r--r--src/commands/cmd_reloadmodule.cpp19
-rw-r--r--src/commands/cmd_restart.cpp38
-rw-r--r--src/commands/cmd_rules.cpp38
-rw-r--r--src/commands/cmd_server.cpp35
-rw-r--r--src/commands/cmd_squit.cpp42
-rw-r--r--src/commands/cmd_stats.cpp320
-rw-r--r--src/commands/cmd_time.cpp35
-rw-r--r--src/commands/cmd_topic.cpp35
-rw-r--r--src/commands/cmd_trace.cpp35
-rw-r--r--src/commands/cmd_unloadmodule.cpp35
-rw-r--r--src/commands/cmd_user.cpp35
-rw-r--r--src/commands/cmd_userhost.cpp35
-rw-r--r--src/commands/cmd_version.cpp35
-rw-r--r--src/commands/cmd_wallops.cpp35
-rw-r--r--src/commands/cmd_who.cpp55
-rw-r--r--src/commands/cmd_whois.cpp95
-rw-r--r--src/commands/cmd_whowas.cpp9
-rw-r--r--src/commands/cmd_zline.cpp47
-rw-r--r--src/inspircd.cpp5
-rw-r--r--src/modules.cpp26
-rw-r--r--src/modules/m_spanningtree/cachetimer.cpp2
-rw-r--r--src/modules/m_spanningtree/handshaketimer.cpp2
-rw-r--r--src/modules/m_spanningtree/hmac.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/override_admin.cpp2
-rw-r--r--src/modules/m_spanningtree/override_modules.cpp2
-rw-r--r--src/modules/m_spanningtree/override_motd.cpp2
-rw-r--r--src/modules/m_spanningtree/override_squit.cpp2
-rw-r--r--src/modules/m_spanningtree/override_stats.cpp2
-rw-r--r--src/modules/m_spanningtree/override_time.cpp2
-rw-r--r--src/modules/m_spanningtree/override_whois.cpp2
-rw-r--r--src/modules/m_spanningtree/ping.cpp2
-rw-r--r--src/modules/m_spanningtree/pong.cpp2
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp10
-rw-r--r--src/modules/m_spanningtree/precommand.cpp2
-rw-r--r--src/modules/m_spanningtree/push.cpp2
-rw-r--r--src/modules/m_spanningtree/rconnect.cpp2
-rw-r--r--src/modules/m_spanningtree/resolvers.cpp2
-rw-r--r--src/modules/m_spanningtree/resolvers.h2
-rw-r--r--src/modules/m_spanningtree/rsquit.cpp2
-rw-r--r--src/modules/m_spanningtree/save.cpp2
-rw-r--r--src/modules/m_spanningtree/server.cpp2
-rw-r--r--src/modules/m_spanningtree/stats.cpp4
-rw-r--r--src/modules/m_spanningtree/svsjoin.cpp2
-rw-r--r--src/modules/m_spanningtree/svsnick.cpp2
-rw-r--r--src/modules/m_spanningtree/svspart.cpp2
-rw-r--r--src/modules/m_spanningtree/time.cpp2
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket.h2
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/modules/m_spanningtree/version.cpp2
-rw-r--r--src/modules/m_spanningtree/whois.cpp4
-rw-r--r--src/stats.cpp310
-rw-r--r--src/whois.cpp86
152 files changed, 2175 insertions, 3122 deletions
diff --git a/.Makefile.inc b/.Makefile.inc
index 3cc18b60d..f0ea08214 100644
--- a/.Makefile.inc
+++ b/.Makefile.inc
@@ -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
diff --git a/.inspircd.inc b/.inspircd.inc
index 6181d66ec..362bdcf67 100644
--- a/.inspircd.inc
+++ b/.inspircd.inc
@@ -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@";
diff --git a/configure b/configure
index 0a9c2b6fb..dfdb43d7d 100755
--- 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;
diff --git a/include/command_parse.h b/include/command_parse.h
index f176394a7..7ee0e8a07 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -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
index b82331c39..000000000
--- a/include/commands/cmd_admin.h
+++ /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
index 9cde32f57..000000000
--- a/include/commands/cmd_away.h
+++ /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
index 00e41fce9..000000000
--- a/include/commands/cmd_clearcache.h
+++ /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
index 13c5ee075..000000000
--- a/include/commands/cmd_commands.h
+++ /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
index 208844661..000000000
--- a/include/commands/cmd_connect.h
+++ /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
index 156a1508e..000000000
--- a/include/commands/cmd_die.h
+++ /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
index 2ac9adeab..000000000
--- a/include/commands/cmd_eline.h
+++ /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
index 9548279d4..000000000
--- a/include/commands/cmd_gline.h
+++ /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
index 85d7d4c84..000000000
--- a/include/commands/cmd_info.h
+++ /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
index ce048e712..000000000
--- a/include/commands/cmd_invite.h
+++ /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
index 93f3356d8..000000000
--- a/include/commands/cmd_ison.h
+++ /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
index 2ea32de1a..000000000
--- a/include/commands/cmd_join.h
+++ /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
index be6a40b06..000000000
--- a/include/commands/cmd_kick.h
+++ /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
index 392975fab..000000000
--- a/include/commands/cmd_kill.h
+++ /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
index 5744de506..000000000
--- a/include/commands/cmd_kline.h
+++ /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
index fbfdb6201..000000000
--- a/include/commands/cmd_links.h
+++ /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
index 8801b8c39..000000000
--- a/include/commands/cmd_list.h
+++ /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
index 9d31f072b..000000000
--- a/include/commands/cmd_loadmodule.h
+++ /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
index 2c5d3d454..000000000
--- a/include/commands/cmd_lusers.h
+++ /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
index 183d59751..000000000
--- a/include/commands/cmd_map.h
+++ /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
index 83ab00bba..000000000
--- a/include/commands/cmd_mode.h
+++ /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
index 18dc76cac..000000000
--- a/include/commands/cmd_modules.h
+++ /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
index b57d851d9..000000000
--- a/include/commands/cmd_motd.h
+++ /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
index 174b6aa20..000000000
--- a/include/commands/cmd_names.h
+++ /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
index b3a8e12a8..000000000
--- a/include/commands/cmd_nick.h
+++ /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
index 580376f08..000000000
--- a/include/commands/cmd_notice.h
+++ /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
index dd0b6318d..000000000
--- a/include/commands/cmd_oper.h
+++ /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
index 01284ccbd..000000000
--- a/include/commands/cmd_part.h
+++ /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
index 21eb378ab..000000000
--- a/include/commands/cmd_pass.h
+++ /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
index 56570d24e..000000000
--- a/include/commands/cmd_ping.h
+++ /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
index 58d862a73..000000000
--- a/include/commands/cmd_pong.h
+++ /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
index 74990983c..000000000
--- a/include/commands/cmd_privmsg.h
+++ /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
index 352ebddda..000000000
--- a/include/commands/cmd_qline.h
+++ /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
index f1430e46b..000000000
--- a/include/commands/cmd_quit.h
+++ /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
index 6c294ffb0..000000000
--- a/include/commands/cmd_rehash.h
+++ /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
index d75ec568f..000000000
--- a/include/commands/cmd_reloadmodule.h
+++ /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
index cd55ed15d..000000000
--- a/include/commands/cmd_restart.h
+++ /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
index f0d6a395f..000000000
--- a/include/commands/cmd_rules.h
+++ /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
index f3469552d..000000000
--- a/include/commands/cmd_server.h
+++ /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
index 6090831be..000000000
--- a/include/commands/cmd_squit.h
+++ /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
index 8df7def88..000000000
--- a/include/commands/cmd_stats.h
+++ /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
index 688618901..000000000
--- a/include/commands/cmd_time.h
+++ /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
index dc5ce1c77..000000000
--- a/include/commands/cmd_topic.h
+++ /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
index 871d150fd..000000000
--- a/include/commands/cmd_trace.h
+++ /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
index dd60bfd79..000000000
--- a/include/commands/cmd_unloadmodule.h
+++ /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
index 9bc28b912..000000000
--- a/include/commands/cmd_user.h
+++ /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
index 1ba15f5a8..000000000
--- a/include/commands/cmd_userhost.h
+++ /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
index f093591a4..000000000
--- a/include/commands/cmd_version.h
+++ /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
index 34089cdae..000000000
--- a/include/commands/cmd_wallops.h
+++ /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
index 65adc549c..000000000
--- a/include/commands/cmd_who.h
+++ /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
index 494095e07..000000000
--- a/include/commands/cmd_whois.h
+++ /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
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index 9788b3d33..b28f44e17 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -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
index fa45ef154..000000000
--- a/include/commands/cmd_zline.h
+++ /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
diff --git a/include/inspircd.h b/include/inspircd.h
index 92e446e03..ae46569a0 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -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
diff --git a/include/modules.h b/include/modules.h
index 86f77d218..fdc6e35b2 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1922,4 +1922,6 @@ class CoreExport ModuleManager : public classbase
}
#endif
+#define COMMAND_INIT(c) MODULE_INIT(CommandModule<c>)
+
#endif
diff --git a/make/configure.pm b/make/configure.pm
index b81a1053e..7696acb85 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -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";
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 1ca4c988f..e4eb57e80 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -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();
diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp
index 95170e069..a0d99ea09 100644
--- a/src/commands/cmd_admin.cpp
+++ b/src/commands/cmd_admin.cpp
@@ -12,13 +12,36 @@
*/
#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)
diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp
index 261bdd38c..fa91342e0 100644
--- a/src/commands/cmd_away.cpp
+++ b/src/commands/cmd_away.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_clearcache.cpp b/src/commands/cmd_clearcache.cpp
index 151587f12..6303fa528 100644
--- a/src/commands/cmd_clearcache.cpp
+++ b/src/commands/cmd_clearcache.cpp
@@ -12,12 +12,36 @@
*/
#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)
diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp
index 2683f0619..5fa041b8f 100644
--- a/src/commands/cmd_commands.cpp
+++ b/src/commands/cmd_commands.cpp
@@ -12,15 +12,40 @@
*/
#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)
diff --git a/src/commands/cmd_connect.cpp b/src/commands/cmd_connect.cpp
index 073993f8c..7a391592d 100644
--- a/src/commands/cmd_connect.cpp
+++ b/src/commands/cmd_connect.cpp
@@ -12,17 +12,42 @@
*/
#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)
diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp
index b85323afc..6eb9e0336 100644
--- a/src/commands/cmd_die.cpp
+++ b/src/commands/cmd_die.cpp
@@ -12,13 +12,38 @@
*/
#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)
diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp
index d28f4c8ee..0591b9163 100644
--- a/src/commands/cmd_eline.cpp
+++ b/src/commands/cmd_eline.cpp
@@ -13,12 +13,49 @@
#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)
diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp
index 346ca98f6..9da5f7071 100644
--- a/src/commands/cmd_gline.cpp
+++ b/src/commands/cmd_gline.cpp
@@ -13,12 +13,49 @@
#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)
diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp
index 286e64f61..43f8286f2 100644
--- a/src/commands/cmd_info.cpp
+++ b/src/commands/cmd_info.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp
index 31c6f459c..73b7068e5 100644
--- a/src/commands/cmd_invite.cpp
+++ b/src/commands/cmd_invite.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_ison.cpp b/src/commands/cmd_ison.cpp
index 52fbcde4b..2f64547e6 100644
--- a/src/commands/cmd_ison.cpp
+++ b/src/commands/cmd_ison.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp
index c8d731ef5..d86516aaa 100644
--- a/src/commands/cmd_join.cpp
+++ b/src/commands/cmd_join.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_kick.cpp b/src/commands/cmd_kick.cpp
index e26ec8653..54a5bd888 100644
--- a/src/commands/cmd_kick.cpp
+++ b/src/commands/cmd_kick.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp
index 2f1a4783e..15cf58f47 100644
--- a/src/commands/cmd_kill.cpp
+++ b/src/commands/cmd_kill.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp
index 0a3e7c930..79e2e7292 100644
--- a/src/commands/cmd_kline.cpp
+++ b/src/commands/cmd_kline.cpp
@@ -13,12 +13,49 @@
#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)
diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp
index 943577cd6..5de58e90f 100644
--- a/src/commands/cmd_links.cpp
+++ b/src/commands/cmd_links.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp
index 9d65b4165..1560487c5 100644
--- a/src/commands/cmd_list.cpp
+++ b/src/commands/cmd_list.cpp
@@ -12,15 +12,40 @@
*/
#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)
diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp
index c6dbd8069..d6456d7d2 100644
--- a/src/commands/cmd_loadmodule.cpp
+++ b/src/commands/cmd_loadmodule.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp
index fb4b197c0..ea278a406 100644
--- a/src/commands/cmd_lusers.cpp
+++ b/src/commands/cmd_lusers.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_map.cpp b/src/commands/cmd_map.cpp
index 3c49ca0c0..780caf081 100644
--- a/src/commands/cmd_map.cpp
+++ b/src/commands/cmd_map.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_mode.cpp b/src/commands/cmd_mode.cpp
index 267b78326..9b80b77a4 100644
--- a/src/commands/cmd_mode.cpp
+++ b/src/commands/cmd_mode.cpp
@@ -12,12 +12,36 @@
*/
#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)
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 36e2e9109..619cf1cb6 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_motd.cpp b/src/commands/cmd_motd.cpp
index 2db6139b1..36306603c 100644
--- a/src/commands/cmd_motd.cpp
+++ b/src/commands/cmd_motd.cpp
@@ -12,12 +12,40 @@
*/
#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)
diff --git a/src/commands/cmd_names.cpp b/src/commands/cmd_names.cpp
index e6df558a6..642fafb5d 100644
--- a/src/commands/cmd_names.cpp
+++ b/src/commands/cmd_names.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index 33e0e8081..ecc254f17 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -13,12 +13,57 @@
#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)
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index e9049d7ab..c94dbc87a 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index 85af2da18..3efafca5b 100644
--- a/src/commands/cmd_oper.cpp
+++ b/src/commands/cmd_oper.cpp
@@ -12,7 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp
index 834ee2b28..e9753c456 100644
--- a/src/commands/cmd_part.cpp
+++ b/src/commands/cmd_part.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp
index e4bbf59c2..8429a494f 100644
--- a/src/commands/cmd_pass.cpp
+++ b/src/commands/cmd_pass.cpp
@@ -12,12 +12,40 @@
*/
#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)
diff --git a/src/commands/cmd_ping.cpp b/src/commands/cmd_ping.cpp
index 11e975624..feea84f59 100644
--- a/src/commands/cmd_ping.cpp
+++ b/src/commands/cmd_ping.cpp
@@ -12,15 +12,42 @@
*/
#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)
diff --git a/src/commands/cmd_pong.cpp b/src/commands/cmd_pong.cpp
index 6ceb11e93..5ca5b4cfc 100644
--- a/src/commands/cmd_pong.cpp
+++ b/src/commands/cmd_pong.cpp
@@ -12,12 +12,38 @@
*/
#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)
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index c6e74db8b..5861bd086 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_qline.cpp b/src/commands/cmd_qline.cpp
index 347771453..ebd1d6b31 100644
--- a/src/commands/cmd_qline.cpp
+++ b/src/commands/cmd_qline.cpp
@@ -13,14 +13,51 @@
#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)
diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp
index e29382e84..968374dec 100644
--- a/src/commands/cmd_quit.cpp
+++ b/src/commands/cmd_quit.cpp
@@ -12,14 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp
index 96313829f..60b1e12b6 100644
--- a/src/commands/cmd_rehash.cpp
+++ b/src/commands/cmd_rehash.cpp
@@ -13,13 +13,50 @@
#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)
diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp
index a94493455..5d84fc7d5 100644
--- a/src/commands/cmd_reloadmodule.cpp
+++ b/src/commands/cmd_reloadmodule.cpp
@@ -12,12 +12,21 @@
*/
#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)
diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp
index 964c7755f..ffd0323b7 100644
--- a/src/commands/cmd_restart.cpp
+++ b/src/commands/cmd_restart.cpp
@@ -12,12 +12,40 @@
*/
#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)
diff --git a/src/commands/cmd_rules.cpp b/src/commands/cmd_rules.cpp
index c47ff38ad..b5b5fbc15 100644
--- a/src/commands/cmd_rules.cpp
+++ b/src/commands/cmd_rules.cpp
@@ -12,15 +12,45 @@
*/
#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)
diff --git a/src/commands/cmd_server.cpp b/src/commands/cmd_server.cpp
index eced487d3..c350dd2a6 100644
--- a/src/commands/cmd_server.cpp
+++ b/src/commands/cmd_server.cpp
@@ -12,14 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_squit.cpp b/src/commands/cmd_squit.cpp
index 46c56c8f5..ada5655d1 100644
--- a/src/commands/cmd_squit.cpp
+++ b/src/commands/cmd_squit.cpp
@@ -12,20 +12,50 @@
*/
#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)
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index ecd19a71e..e3961a906 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -25,14 +25,26 @@
#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)
diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp
index 002750dfa..4fdcb8aa6 100644
--- a/src/commands/cmd_time.cpp
+++ b/src/commands/cmd_time.cpp
@@ -12,14 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp
index 00b588179..97321460e 100644
--- a/src/commands/cmd_topic.cpp
+++ b/src/commands/cmd_topic.cpp
@@ -12,13 +12,38 @@
*/
#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)
diff --git a/src/commands/cmd_trace.cpp b/src/commands/cmd_trace.cpp
index 05597dc1b..9ac590ee1 100644
--- a/src/commands/cmd_trace.cpp
+++ b/src/commands/cmd_trace.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp
index 931dfdcbd..af51067dd 100644
--- a/src/commands/cmd_unloadmodule.cpp
+++ b/src/commands/cmd_unloadmodule.cpp
@@ -12,14 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp
index b9ef94c97..9edfb46b6 100644
--- a/src/commands/cmd_user.cpp
+++ b/src/commands/cmd_user.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp
index 83375a0fd..acb67cf1b 100644
--- a/src/commands/cmd_userhost.cpp
+++ b/src/commands/cmd_userhost.cpp
@@ -12,12 +12,37 @@
*/
#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)
diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp
index 871193c00..86be41a41 100644
--- a/src/commands/cmd_version.cpp
+++ b/src/commands/cmd_version.cpp
@@ -12,14 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_wallops.cpp b/src/commands/cmd_wallops.cpp
index 6c8468914..98b3d3f34 100644
--- a/src/commands/cmd_wallops.cpp
+++ b/src/commands/cmd_wallops.cpp
@@ -12,14 +12,39 @@
*/
#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)
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index a85e00fa3..1e7c7d6aa 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -12,7 +12,53 @@
*/
#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)
diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp
index b2f322351..9b64d5e8b 100644
--- a/src/commands/cmd_whois.cpp
+++ b/src/commands/cmd_whois.cpp
@@ -12,85 +12,28 @@
*/
#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)
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index 1109b4d8b..5e77671a6 100644
--- a/src/commands/cmd_whowas.cpp
+++ b/src/commands/cmd_whowas.cpp
@@ -16,12 +16,7 @@
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)
diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp
index 93ad7f893..81476a032 100644
--- a/src/commands/cmd_zline.cpp
+++ b/src/commands/cmd_zline.cpp
@@ -13,14 +13,51 @@
#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)
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 94dd41da0..810c477f8 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -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);
diff --git a/src/modules.cpp b/src/modules.cpp
index f0ff37726..cec146f76 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -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);
diff --git a/src/modules/m_spanningtree/cachetimer.cpp b/src/modules/m_spanningtree/cachetimer.cpp
index 7168e9eed..ae26f3600 100644
--- a/src/modules/m_spanningtree/cachetimer.cpp
+++ b/src/modules/m_spanningtree/cachetimer.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp
index 1ccd466ad..56f34283b 100644
--- a/src/modules/m_spanningtree/handshaketimer.cpp
+++ b/src/modules/m_spanningtree/handshaketimer.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/hmac.cpp b/src/modules/m_spanningtree/hmac.cpp
index e1d46d0d9..332e47585 100644
--- a/src/modules/m_spanningtree/hmac.cpp
+++ b/src/modules/m_spanningtree/hmac.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 7f152a0f5..e074f71ef 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp
index c63b8dc4d..2a5cfcdab 100644
--- a/src/modules/m_spanningtree/override_admin.cpp
+++ b/src/modules/m_spanningtree/override_admin.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp
index 10d46bbc3..6854bc31c 100644
--- a/src/modules/m_spanningtree/override_modules.cpp
+++ b/src/modules/m_spanningtree/override_modules.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp
index fe229d5cc..270608062 100644
--- a/src/modules/m_spanningtree/override_motd.cpp
+++ b/src/modules/m_spanningtree/override_motd.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_squit.cpp b/src/modules/m_spanningtree/override_squit.cpp
index a13385cd1..5360f176c 100644
--- a/src/modules/m_spanningtree/override_squit.cpp
+++ b/src/modules/m_spanningtree/override_squit.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp
index ecffcf05e..aa4834303 100644
--- a/src/modules/m_spanningtree/override_stats.cpp
+++ b/src/modules/m_spanningtree/override_stats.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp
index bd9727498..54a2870bd 100644
--- a/src/modules/m_spanningtree/override_time.cpp
+++ b/src/modules/m_spanningtree/override_time.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp
index 2d7199571..84bf8ce77 100644
--- a/src/modules/m_spanningtree/override_whois.cpp
+++ b/src/modules/m_spanningtree/override_whois.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/ping.cpp b/src/modules/m_spanningtree/ping.cpp
index 044d6e50c..1318b60a0 100644
--- a/src/modules/m_spanningtree/ping.cpp
+++ b/src/modules/m_spanningtree/ping.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/pong.cpp b/src/modules/m_spanningtree/pong.cpp
index 6d9cd4193..b551ef6d2 100644
--- a/src/modules/m_spanningtree/pong.cpp
+++ b/src/modules/m_spanningtree/pong.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index d2cea154a..2cf4fa3ad 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -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;
diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp
index 94f98faf1..6564dd95b 100644
--- a/src/modules/m_spanningtree/precommand.cpp
+++ b/src/modules/m_spanningtree/precommand.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/push.cpp b/src/modules/m_spanningtree/push.cpp
index e0545f01e..88c6b55bd 100644
--- a/src/modules/m_spanningtree/push.cpp
+++ b/src/modules/m_spanningtree/push.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp
index 3e084dc19..1811d73a1 100644
--- a/src/modules/m_spanningtree/rconnect.cpp
+++ b/src/modules/m_spanningtree/rconnect.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp
index 51197cb11..fc3011bc2 100644
--- a/src/modules/m_spanningtree/resolvers.cpp
+++ b/src/modules/m_spanningtree/resolvers.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/resolvers.h b/src/modules/m_spanningtree/resolvers.h
index 0b82bfd99..fc85cd049 100644
--- a/src/modules/m_spanningtree/resolvers.h
+++ b/src/modules/m_spanningtree/resolvers.h
@@ -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"
diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp
index e9c69a1d4..2afe8d4f8 100644
--- a/src/modules/m_spanningtree/rsquit.cpp
+++ b/src/modules/m_spanningtree/rsquit.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp
index 25f811267..9969fdca7 100644
--- a/src/modules/m_spanningtree/save.cpp
+++ b/src/modules/m_spanningtree/save.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp
index 6351c93b5..c275f3490 100644
--- a/src/modules/m_spanningtree/server.cpp
+++ b/src/modules/m_spanningtree/server.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/stats.cpp b/src/modules/m_spanningtree/stats.cpp
index 810b6dc77..d67c5a3af 100644
--- a/src/modules/m_spanningtree/stats.cpp
+++ b/src/modules/m_spanningtree/stats.cpp
@@ -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];
diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp
index dbdcce718..b6246e2f4 100644
--- a/src/modules/m_spanningtree/svsjoin.cpp
+++ b/src/modules/m_spanningtree/svsjoin.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/svsnick.cpp b/src/modules/m_spanningtree/svsnick.cpp
index 48e0c638a..3af6961d0 100644
--- a/src/modules/m_spanningtree/svsnick.cpp
+++ b/src/modules/m_spanningtree/svsnick.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/svspart.cpp b/src/modules/m_spanningtree/svspart.cpp
index 1649b32b6..83e329b4e 100644
--- a/src/modules/m_spanningtree/svspart.cpp
+++ b/src/modules/m_spanningtree/svspart.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp
index d2c8f7989..82a7fe62e 100644
--- a/src/modules/m_spanningtree/time.cpp
+++ b/src/modules/m_spanningtree/time.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index c9f4cfdfa..a07d540bc 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 34d042432..37cfbbd9e 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -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"
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index f31685c01..6703021a8 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 922e6f784..dac0216aa 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 13a4cc760..30b9cad3c 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/version.cpp b/src/modules/m_spanningtree/version.cpp
index abf61611a..6cec7baf9 100644
--- a/src/modules/m_spanningtree/version.cpp
+++ b/src/modules/m_spanningtree/version.cpp
@@ -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"
diff --git a/src/modules/m_spanningtree/whois.cpp b/src/modules/m_spanningtree/whois.cpp
index 796713182..f12a7f109 100644
--- a/src/modules/m_spanningtree/whois.cpp
+++ b/src/modules/m_spanningtree/whois.cpp
@@ -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
index 000000000..d385112c2
--- /dev/null
+++ b/src/stats.cpp
@@ -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
index 000000000..341c8389f
--- /dev/null
+++ b/src/whois.cpp
@@ -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());
+}
+
+
+