]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Add more features to modestacker so that we can stack +, -, and parameterless modes
[user/henk/code/inspircd.git] / include / modules.h
index 95dbd764ee20c1e3815a4930a5fbe9961acb659d..df9497fd2db64b1b49a52f99bda2477de2ce2aa3 100644 (file)
@@ -68,9 +68,14 @@ enum TargetTypeFlags {
 #include "mode.h"
 #include "dns.h"
 
+/** If you change the module API, change this value
+ */
+#define API_VERSION 11001
+
 class ServerConfig;
 
-// Forward-delacare module for ModuleMessage etc
+/* Forward-delacare module for ModuleMessage etc
+ */
 class Module;
 
 /** Low level definition of a FileReader classes file cache area
@@ -176,8 +181,8 @@ typedef std::map<std::string,Module*> featurelist;
 class Version : public classbase
 {
  public:
-        const int Major, Minor, Revision, Build, Flags;
-        Version(int major, int minor, int revision, int build, int flags);
+        const int Major, Minor, Revision, Build, Flags, API;
+        Version(int major, int minor, int revision, int build, int flags, int api_ver);
 };
 
 /** The ModuleMessage class is the base class of Request and Event
@@ -342,7 +347,7 @@ enum Implementation {       I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse
                        I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange,
                        I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan,
                        I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
-                       I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList, I_OnPostCommand };
+                       I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin };
 
 /** Base class for all InspIRCd modules
  *  This class is the base class for InspIRCd modules. All modules must inherit from this class,
@@ -444,6 +449,14 @@ class Module : public Extensible
         */
        virtual void OnUserJoin(userrec* user, chanrec* channel);
 
+       /** Called after a user joins a channel
+        * Identical to OnUserJoin, but called immediately afterwards, when any linking module has
+        * seen the join.
+        * @param user The user who is joining
+        * @param channel The channel being joined
+        */
+       virtual void OnPostJoin(userrec* user, chanrec* channel);
+
        /** Called when a user parts a channel.
         * The details of the leaving user are available to you in the parameter userrec *user,
         * and the details of the channel they have left is available in the variable chanrec *channel
@@ -488,10 +501,13 @@ class Module : public Extensible
         * 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.
         * @param user The user joining the channel
-        * @param cname The channel name being joined
+        * @param chan If the  channel is a new channel, this will be NULL, otherwise it will be a pointer to the channel being joined
+        * @param cname The channel name being joined. For new channels this is valid where chan is not.
+        * @param privs A string containing the users privilages when joining the channel. For new channels this will contain "@".
+        * You may alter this string to alter the user's modes on the channel.
         * @return 1 To prevent the join, 0 to allow it.
         */
-       virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname);
+       virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs);
        
        /** Called whenever a user is about to be kicked.
         * Returning a value of 1 from this function stops the process immediately, causing no
@@ -1176,6 +1192,7 @@ class Module : public Extensible
        /** Called after a user has fully connected and all modules have executed OnUserConnect
         * This event is informational only. You should not change any user information in this
         * event. To do so, use the OnUserConnect method to change the state of local users.
+        * This is called for both local and remote users.
         * @param user The user who is connecting
         */
        virtual void OnPostConnect(userrec* user);