diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-06 19:22:11 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-06 19:22:11 +0000 |
commit | 05e460e96cdd03f94587c0e0c5792c75d3dfa440 (patch) | |
tree | f62fee5c6107de87d3062eeff778ac28b27af345 /include | |
parent | 32aa3afffaee0aabfd2aa295ae029af8cddba472 (diff) |
Added OnUserPreMessage and OnUserPreNotice events (not tested yet)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@407 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/inspircd.h | 5 | ||||
-rw-r--r-- | include/modules.h | 22 |
2 files changed, 26 insertions, 1 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 7d7971532..f38ee47be 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -64,6 +64,11 @@ #define WM_AND 1 #define WM_OR 2 +// flags for use with OnUserPreMessage and OnUserPreNotice + +#define TYPE_USER 1 +#define TYPE_CHANNEL 2 + typedef std::deque<std::string> file_cache; /* prototypes */ diff --git a/include/modules.h b/include/modules.h index d2c578b04..d0195bd1b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -207,7 +207,27 @@ class Module : public classbase * The source parameter contains the details of the user who issued the WHOIS command, and * the dest parameter contains the information of the user they are whoising. */ - void Module::OnWhois(userrec* source, userrec* dest); + virtual void Module::OnWhois(userrec* source, userrec* dest); + + /** Called whenever a user is about to PRIVMSG A user or 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 filter or redirect messages. + * target_type can be one of TYPE_USER or TYPE_CHANNEL. If the target_type value is a user, + * you must cast dest to a userrec* otherwise you must cast it to a chanrec*, this is the details + * of where the message is destined to be sent. + */ + virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::String text); + + /** Called whenever a user is about to NOTICE A user or 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 filter or redirect messages. + * target_type can be one of TYPE_USER or TYPE_CHANNEL. If the target_type value is a user, + * you must cast dest to a userrec* otherwise you must cast it to a chanrec*, this is the details + * of where the message is destined to be sent. + */ + virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::String text); }; |