summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-03 00:09:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-03 00:09:38 +0000
commit1b7c615062a7b203c7fc3ce4c56e16eb671f7c15 (patch)
treee5b6369422834d66285e987cfb152d87d5b56943 /include
parentf5a50a0b6d89ff786c288453d58b7d8f01006954 (diff)
Auto loading of commands as shared objects via dlsym (very lightweight interface, just expects a command_t* pointer)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5118 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/command_parse.h5
-rw-r--r--include/commands/cmd_nick.h2
-rw-r--r--include/commands/cmd_pass.h2
-rw-r--r--include/commands/cmd_user.h2
-rw-r--r--include/ctables.h10
5 files changed, 17 insertions, 4 deletions
diff --git a/include/command_parse.h b/include/command_parse.h
index 908add7dd..d4c64dab4 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -52,11 +52,16 @@ class CommandParser : public classbase
/** Insert the default RFC1459 commands into the command hash.
*/
void SetupCommandTable();
+
+ void FindSym(void** v, void* h);
+
public:
/** Command list, a hash_map of command names to command_t*
*/
command_table cmdlist;
+ void LoadCommand(const char* name);
+
/** Default constructor.
* @param Instance The creator of this class
*/
diff --git a/include/commands/cmd_nick.h b/include/commands/cmd_nick.h
index 1924ce1e8..f63a6195c 100644
--- a/include/commands/cmd_nick.h
+++ b/include/commands/cmd_nick.h
@@ -25,7 +25,7 @@
class cmd_nick : public command_t
{
public:
- cmd_nick (InspIRCd* Instance) : command_t(Instance,"NICK",0,1) { syntax = "<newnick>"; }
+ cmd_nick (InspIRCd* Instance) : command_t(Instance,"NICK",0,1,true) { syntax = "<newnick>"; }
void Handle(const char** parameters, int pcnt, userrec *user);
};
diff --git a/include/commands/cmd_pass.h b/include/commands/cmd_pass.h
index 6cc48d423..922f12c02 100644
--- a/include/commands/cmd_pass.h
+++ b/include/commands/cmd_pass.h
@@ -28,7 +28,7 @@
class cmd_pass : public command_t
{
public:
- cmd_pass (InspIRCd* Instance) : command_t(Instance,"PASS",0,1) { syntax = "<password>"; }
+ cmd_pass (InspIRCd* Instance) : command_t(Instance,"PASS",0,1,true) { syntax = "<password>"; }
void Handle(const char** parameters, int pcnt, userrec *user);
};
diff --git a/include/commands/cmd_user.h b/include/commands/cmd_user.h
index 919078193..ac8a1a6c4 100644
--- a/include/commands/cmd_user.h
+++ b/include/commands/cmd_user.h
@@ -25,7 +25,7 @@
class cmd_user : public command_t
{
public:
- cmd_user (InspIRCd* Instance) : command_t(Instance,"USER",0,4) { syntax = "<username> <localhost> <remotehost> <GECOS>"; }
+ cmd_user (InspIRCd* Instance) : command_t(Instance,"USER",0,4,true) { syntax = "<username> <localhost> <remotehost> <GECOS>"; }
void Handle(const char** parameters, int pcnt, userrec *user);
};
diff --git a/include/ctables.h b/include/ctables.h
index c997cf68a..870efadac 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -55,12 +55,15 @@ class command_t : public Extensible
/** True if the command is disabled to non-opers
*/
bool disabled;
+ /** True if the command can be issued before registering
+ */
+ bool works_before_reg;
/** Syntax string for the command, displayed if non-empty string.
* This takes place of the text in the 'not enough parameters' numeric.
*/
std::string syntax;
- command_t(InspIRCd* Instance, const std::string &cmd, char flags, int minpara) : ServerInstance(Instance), command(cmd), flags_needed(flags), min_params(minpara), disabled(false)
+ command_t(InspIRCd* Instance, const std::string &cmd, char flags, int minpara, int before_reg = false) : ServerInstance(Instance), command(cmd), flags_needed(flags), min_params(minpara), disabled(false), works_before_reg(before_reg)
{
use_count = total_bytes = 0;
source = "<core>";
@@ -79,6 +82,11 @@ class command_t : public Extensible
return disabled;
}
+ bool WorksBeforeReg()
+ {
+ return works_before_reg;
+ }
+
virtual ~command_t() {}
};