]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Support for /invite <user> <channel> <timeout> - if the user doesn't partake in ...
[user/henk/code/inspircd.git] / include / modules.h
index eab968e7ac844975fbd2d595a49a7191fdaa8569..09b1f954b0e45fbccb696710f0525906bcffe8e9 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -394,14 +394,14 @@ enum Implementation
        I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode,
        I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData,
        I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddLine,
-       I_OnDelLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule,
+       I_OnDelLine, I_OnExpireLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule,
        I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, I_OnRawMode,
        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_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan,
        I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister,
-       I_OnOperCompare, I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList,
+       I_OnChannelPreDelete, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList,
        I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed,
-       I_OnText, I_OnReadConfig, I_OnDownloadFile,
+       I_OnText, I_OnReadConfig, I_OnDownloadFile, I_OnPassCompare,
        I_END
 };
 
@@ -626,9 +626,10 @@ class CoreExport Module : public Extensible
         * @param source The user who is issuing the INVITE
         * @param dest The user being invited
         * @param channel The channel the user is being invited to
+        * @param timeout The time the invite will expire (0 == never)
         * @return 1 to deny the invite, 0 to allow
         */
-       virtual int OnUserPreInvite(User* source,User* dest,Channel* channel);
+       virtual int OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout);
        
        /** Called after a user has been successfully invited to a channel.
         * You cannot prevent the invite from occuring using this function, to do that,
@@ -636,8 +637,9 @@ class CoreExport Module : public Extensible
         * @param source The user who is issuing the INVITE
         * @param dest The user being invited
         * @param channel The channel the user is being invited to
+        * @param timeout The time the invite will expire (0 == never)
         */
-       virtual void OnUserInvite(User* source,User* dest,Channel* channel);
+       virtual void OnUserInvite(User* source,User* dest,Channel* channel, time_t timeout);
        
        /** 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
@@ -899,13 +901,19 @@ class CoreExport Module : public Extensible
         */
        virtual void OnAddLine(User* source, XLine* line);
 
-       /** Called whenever an xline is deleted.
+       /** Called whenever an xline is deleted MANUALLY. See OnExpireLine for expiry.
         * This method is triggered after the line is deleted.
         * @param source The user removing the line or NULL for local server
         * @param line the line being deleted
         */
        virtual void OnDelLine(User* source, XLine* line);
 
+       /** Called whenever an xline expires.
+        * This method is triggered after the line is deleted.
+        * @param line The line being deleted.
+        */
+       virtual void OnExpireLine(XLine *line);
+
        /** Called before your module is unloaded to clean up Extensibles.
         * This method is called once for every user and channel on the network,
         * so that when your module unloads it may clear up any remaining data
@@ -1095,7 +1103,7 @@ class CoreExport Module : public Extensible
         * @param pcnt The parameter count for the mode (0 or 1)
         * @return 1 to deny the mode, 0 to allow
         */
-       virtual int OnRawMode(User* user, Channel* chan, char mode, const std::string &param, bool adding, int pcnt);
+       virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string &param, bool adding, int pcnt);
 
        /** Called whenever a user joins a channel, to determine if key checks should go ahead or not.
         * This method will always be called for each join, wether or not the channel is actually +k, and
@@ -1189,17 +1197,17 @@ class CoreExport Module : public Extensible
         */
        virtual char* OnRequest(Request* request);
 
-       /** Called whenever an oper password is to be compared to what a user has input.
+       /** Called whenever a password check is to be made. Replaces the old OldOperCompare API.
         * The password field (from the config file) is in 'password' and is to be compared against
-        * 'input'. This method allows for encryption of oper passwords and much more besides.
-        * You should return a nonzero value if you want to allow the comparison or zero if you wish
-        * to do nothing.
-        * @param password The oper's password
-        * @param input The password entered
-        * @param tagnumber The tag number (from the configuration file) of this oper's tag
-        * @return 1 to match the passwords, 0 to do nothing. -1 to not match, and not continue.
+        * 'input'. This method allows for encryption of passwords (oper, connect:allow, die/restart, etc).
+        * You should return a nonzero value to override the normal comparison, or zero to pass it on.
+        * @param ex The object that's causing the authentication (User* for <oper> <connect:allow> etc, Server* for <link>).
+        * @param password The password from the configuration file (the password="" value).
+        * @param input The password entered by the user or whoever.
+        * @param hashtype The hash value from the config
+        * @return 0 to do nothing (pass on to next module/default), 1 == password is OK, -1 == password is not OK
         */
-       virtual int OnOperCompare(const std::string &password, const std::string &input, int tagnumber);
+       virtual int OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype);
 
        /** Called whenever a user is given usermode +o, anywhere on the network.
         * You cannot override this and prevent it from happening as it is already happened and
@@ -1818,6 +1826,14 @@ class CoreExport ModuleManager : public classbase
         */
        modulelist* FindInterface(const std::string &InterfaceName);
 
+       /** Determine if a module has published the named interface.
+        * This could be used in, for example, OnLoadModule to pick up other modules that can be used.
+        * @param mod The module to check.
+        * @param InterfaceName the interface you want to check for
+        * @return True if the module provides the interface, false otherwise.
+        */
+       bool ModuleHasInterface(Module* mod, const std::string& InterfaceName);
+
        /** Given a pointer to a Module, return its filename
         * @param m The module pointer to identify
         * @return The module name or an empty string