summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-03 15:46:53 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-03 15:46:53 +0000
commitabdb186046bcdd83aefbc4171a00bd1ad7ec963c (patch)
tree8fad649a8a767a12e19c0eef85d78d5f4ef04618 /include
parent8a1923c253a798f0823cc87d3cfdef012c533871 (diff)
Added support for module-defined chanmodes with no parameters
Fixed minor typo in example conf Added new stylesheet and docs git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@362 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/channels.h4
-rw-r--r--include/inspircd.h4
-rw-r--r--include/modules.h35
3 files changed, 37 insertions, 6 deletions
diff --git a/include/channels.h b/include/channels.h
index b60ee6cad..9f97c3b8b 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -132,12 +132,12 @@ class chanrec : public classbase
/** The list of all bans set on the channel.
*/
BanList bans;
-
+
/** Sets or unsets a custom mode in the channels info
*/
void SetCustomMode(char mode,bool mode_on);
- /** Sets or unsets the parameterrs for a custom mode in a channels info
+ /** Sets or unsets the parameters for a custom mode in a channels info
*/
void SetCustomModeParam(char mode,char* parameter,bool mode_on);
diff --git a/include/inspircd.h b/include/inspircd.h
index e1d75f712..9bd570c92 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -80,5 +80,5 @@ std::string getadminemail();
std::string getadminnick();
void readfile(file_cache &F, const char* fname);
bool ModeDefined(char c, int i);
-bool ModeDefinedOn(char c, int i);
-bool ModeDefinedOff(char c, int i);
+int ModeDefinedOn(char c, int i);
+int ModeDefinedOff(char c, int i);
diff --git a/include/modules.h b/include/modules.h
index e9f750693..74d7800d3 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -35,6 +35,24 @@ typedef file_cache string_list;
#define FOREACH_MOD for (int i = 0; i <= MODCOUNT; i++) modules[i]->
+// This define is similar to the one above but returns a result in MOD_RESULT.
+// The first module to return a nonzero result is the value to be accepted,
+// and any modules after are ignored.
+
+// *********************************************************************************************
+
+#define FOREACH_RESULT(x) { MOD_RESULT = 0; \
+ for (int i = 0; i <= MODCOUNT; i++) { \
+ int res = modules[i]->x ; \
+ if (res) { \
+ MOD_RESULT = res; \
+ break; \
+ } \
+ } \
+ }
+
+// *********************************************************************************************
+
extern void createcommand(char* cmd, handlerfunc f, char flags, int minparams);
extern void server_mode(char **parameters, int pcnt, userrec *user);
@@ -117,7 +135,7 @@ class Module : public classbase
* digital signatures and anything else you may want to add. This should be regarded as a pre-processor
* and will be called before ANY other operations within the ircd core program.
*/
- virtual void Module::OnPacketTransmit(char *p);
+ virtual void OnPacketTransmit(char *p);
/** Called after a packet is received from another irc server.
* The packet is represented as a char*, as it should be regarded as a buffer, and not a string.
@@ -126,7 +144,7 @@ class Module : public classbase
* and will be called immediately after the packet is received but before any other operations with the
* core of the ircd.
*/
- virtual void Module::OnPacketReceive(char *p);
+ virtual void OnPacketReceive(char *p);
/** Called on rehash.
* This method is called prior to a /REHASH or when a SIGHUP is received from the operating
@@ -153,6 +171,19 @@ class Module : public classbase
*/
virtual bool OnExtendedMode(userrec* user, chanrec* chan, char modechar, int type, bool mode_on, string_list &params);
+ /** Called whenever a user is about to join a channel, before any processing is done.
+ * Returning any nonzero value from this function stops the process immediately, causing no
+ * output to be sent to the user by the core. If you do this you must produce your own numerics,
+ * notices etc. This is useful for modules which may want to mimic +b, +k, +l etc.
+ *
+ * IMPORTANT NOTE!
+ *
+ * If the user joins a NEW channel which does not exist yet, OnUserPreJoin will be called BEFORE the channel
+ * record is created. This will cause chanrec* chan to be NULL. There is very little you can do in form of
+ * processing on the actual channel record at this point, however the channel NAME will still be passed in
+ * char* cname, so that you could for example implement a channel blacklist or whitelist, etc.
+ */
+ virtual int Module::OnUserPreJoin(userrec* user, chanrec* chan, char* cname);
};