+ * More documentation to follow soon. Please see src/modules/m_swhois.cpp for example of
+ * how to use this function.
+ * @param opaque An opaque pointer set by the protocol module, should not be modified!
+ * @param target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL
+ * @param target The Channel* or User* that metadata should be sent for
+ * @param extname The extension name to send metadata for
+ * @param extdata Encoded data for this extension name, which will be encoded at the oppsite end by an identical module using OnDecodeMetaData
+ */
+ virtual void ProtoSendMetaData(void* opaque, TargetTypeFlags target_type, void* target, const std::string &extname, const std::string &extdata);
+
+ /** Called after every WALLOPS command.
+ * @param user The user sending the WALLOPS
+ * @param text The content of the WALLOPS message
+ */
+ virtual void OnWallops(User* user, const std::string &text);
+
+ /** Called whenever a user's hostname is changed.
+ * This event triggers after the host has been set.
+ * @param user The user whos host is being changed
+ * @param newhost The new hostname being set
+ */
+ virtual void OnChangeHost(User* user, const std::string &newhost);
+
+ /** Called whenever a user's GECOS (realname) is changed.
+ * This event triggers after the name has been set.
+ * @param user The user who's GECOS is being changed
+ * @param gecos The new GECOS being set on the user
+ */
+ virtual void OnChangeName(User* user, const std::string &gecos);
+
+ /** Called whenever an xline is added by a local user.
+ * This method is triggered after the line is added.
+ * @param source The sender of the line or NULL for local server
+ * @param line The xline being added
+ */
+ virtual void OnAddLine(User* source, XLine* line);
+
+ /** 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
+ * in the form of Extensibles added using Extensible::Extend().
+ * If the target_type variable is TYPE_USER, then void* item refers to
+ * a User*, otherwise it refers to a Channel*.
+ * @param target_type The type of item being cleaned
+ * @param item A pointer to the item's class
+ */
+ virtual void OnCleanup(int target_type, void* item);
+
+ /** Called after any nickchange, local or remote. This can be used to track users after nickchanges
+ * have been applied. Please note that although you can see remote nickchanges through this function, you should
+ * NOT make any changes to the User if the user is a remote user as this may cause a desnyc.
+ * check user->server before taking any action (including returning nonzero from the method).
+ * Because this method is called after the nickchange is taken place, no return values are possible
+ * to indicate forbidding of the nick change. Use OnUserPreNick for this.
+ * @param user The user changing their nick
+ * @param oldnick The old nickname of the user before the nickchange
+ */
+ virtual void OnUserPostNick(User* user, const std::string &oldnick);
+
+ /** Called before an action which requires a channel privilage check.
+ * This function is called before many functions which check a users status on a channel, for example
+ * before opping a user, deopping a user, kicking a user, etc.
+ * There are several values for access_type which indicate for what reason access is being checked.
+ * These are:<br><br>
+ * AC_KICK - A user is being kicked<br>
+ * AC_DEOP - a user is being deopped<br>
+ * AC_OP - a user is being opped<br>
+ * AC_VOICE - a user is being voiced<br>
+ * AC_DEVOICE - a user is being devoiced<br>
+ * AC_HALFOP - a user is being halfopped<br>
+ * AC_DEHALFOP - a user is being dehalfopped<br>
+ * AC_INVITE - a user is being invited<br>
+ * AC_GENERAL_MODE - a user channel mode is being changed<br><br>
+ * Upon returning from your function you must return either ACR_DEFAULT, to indicate the module wishes
+ * to do nothing, or ACR_DENY where approprate to deny the action, and ACR_ALLOW where appropriate to allow
+ * the action. Please note that in the case of some access checks (such as AC_GENERAL_MODE) access may be
+ * denied 'upstream' causing other checks such as AC_DEOP to not be reached. Be very careful with use of the
+ * AC_GENERAL_MODE type, as it may inadvertently override the behaviour of other modules. When the access_type
+ * is AC_GENERAL_MODE, the destination of the mode will be NULL (as it has not yet been determined).
+ * @param source The source of the access check
+ * @param dest The destination of the access check
+ * @param channel The channel which is being checked
+ * @param access_type See above
+ */
+ virtual int OnAccessCheck(User* source,User* dest,Channel* channel,int access_type);
+
+ /** Called when a 005 numeric is about to be output.
+ * The module should modify the 005 numeric if needed to indicate its features.
+ * @param output The 005 string to be modified if neccessary.
+ */
+ virtual void On005Numeric(std::string &output);
+
+ /** Called when a client is disconnected by KILL.
+ * If a client is killed by a server, e.g. a nickname collision or protocol error,
+ * source is NULL.
+ * Return 1 from this function to prevent the kill, and 0 from this function to allow
+ * it as normal. If you prevent the kill no output will be sent to the client, it is
+ * down to your module to generate this information.
+ * NOTE: It is NOT advisable to stop kills which originate from servers or remote users.
+ * If you do so youre risking race conditions, desyncs and worse!
+ * @param source The user sending the KILL
+ * @param dest The user being killed
+ * @param reason The kill reason
+ * @return 1 to prevent the kill, 0 to allow
+ */
+ virtual int OnKill(User* source, User* dest, const std::string &reason);
+
+ /** Called when an oper wants to disconnect a remote user via KILL
+ * @param source The user sending the KILL
+ * @param dest The user being killed
+ * @param reason The kill reason
+ */
+ virtual void OnRemoteKill(User* source, User* dest, const std::string &reason, const std::string &operreason);
+
+ /** Called whenever a module is loaded.
+ * mod will contain a pointer to the module, and string will contain its name,
+ * for example m_widgets.so. This function is primary for dependency checking,
+ * your module may decide to enable some extra features if it sees that you have
+ * for example loaded "m_killwidgets.so" with "m_makewidgets.so". It is highly
+ * recommended that modules do *NOT* bail if they cannot satisfy dependencies,
+ * but instead operate under reduced functionality, unless the dependency is
+ * absolutely neccessary (e.g. a module that extends the features of another
+ * module).
+ * @param mod A pointer to the new module
+ * @param name The new module's filename
+ */
+ virtual void OnLoadModule(Module* mod,const std::string &name);
+
+ /** Called whenever a module is unloaded.
+ * mod will contain a pointer to the module, and string will contain its name,
+ * for example m_widgets.so. This function is primary for dependency checking,
+ * your module may decide to enable some extra features if it sees that you have
+ * for example loaded "m_killwidgets.so" with "m_makewidgets.so". It is highly
+ * recommended that modules do *NOT* bail if they cannot satisfy dependencies,
+ * but instead operate under reduced functionality, unless the dependency is
+ * absolutely neccessary (e.g. a module that extends the features of another
+ * module).
+ * @param mod Pointer to the module being unloaded (still valid)
+ * @param name The filename of the module being unloaded
+ */
+ virtual void OnUnloadModule(Module* mod,const std::string &name);
+
+ /** Called once every five seconds for background processing.
+ * This timer can be used to control timed features. Its period is not accurate
+ * enough to be used as a clock, but it is gauranteed to be called at least once in
+ * any five second period, directly from the main loop of the server.
+ * @param curtime The current timer derived from time(2)
+ */
+ virtual void OnBackgroundTimer(time_t curtime);
+
+ /** Called whenever any command is about to be executed.
+ * This event occurs for all registered commands, wether they are registered in the core,
+ * or another module, and for invalid commands. Invalid commands may only be sent to this
+ * function when the value of validated is false. By returning 1 from this method you may prevent the
+ * command being executed. If you do this, no output is created by the core, and it is
+ * down to your module to produce any output neccessary.
+ * Note that unless you return 1, you should not destroy any structures (e.g. by using
+ * InspIRCd::QuitUser) otherwise when the command's handler function executes after your
+ * method returns, it will be passed an invalid pointer to the user object and crash!)
+ * @param command The command being executed
+ * @param parameters An array of array of characters containing the parameters for the command
+ * @param pcnt The nuimber of parameters passed to the command
+ * @param user the user issuing the command
+ * @param validated True if the command has passed all checks, e.g. it is recognised, has enough parameters, the user has permission to execute it, etc.
+ * You should only change the parameter list and command string if validated == false (e.g. before the command lookup occurs).
+ * @param original_line The entire original line as passed to the parser from the user
+ * @return 1 to block the command, 0 to allow
+ */
+ virtual int OnPreCommand(std::string &command, std::vector<std::string>& parameters, User *user, bool validated, const std::string &original_line);
+
+ /** Called after any command has been executed.
+ * This event occurs for all registered commands, wether they are registered in the core,
+ * or another module, but it will not occur for invalid commands (e.g. ones which do not
+ * exist within the command table). The result code returned by the command handler is
+ * provided.
+ * @param command The command being executed
+ * @param parameters An array of array of characters containing the parameters for the command
+ * @param pcnt The nuimber of parameters passed to the command
+ * @param user the user issuing the command
+ * @param result The return code given by the command handler, one of CMD_SUCCESS or CMD_FAILURE
+ * @param original_line The entire original line as passed to the parser from the user
+ */
+ virtual void OnPostCommand(const std::string &command, const std::vector<std::string>& parameters, User *user, CmdResult result, const std::string &original_line);
+
+ /** Called to check if a user who is connecting can now be allowed to register
+ * If any modules return false for this function, the user is held in the waiting
+ * state until all modules return true. For example a module which implements ident
+ * lookups will continue to return false for a user until their ident lookup is completed.
+ * Note that the registration timeout for a user overrides these checks, if the registration
+ * timeout is reached, the user is disconnected even if modules report that the user is
+ * not ready to connect.
+ * @param user The user to check
+ * @return true to indicate readiness, false if otherwise
+ */
+ virtual bool OnCheckReady(User* user);
+
+ /** Called whenever a user is about to register their connection (e.g. before the user
+ * is sent the MOTD etc). Modules can use this method if they are performing a function
+ * which must be done before the actual connection is completed (e.g. ident lookups,
+ * dnsbl lookups, etc).
+ * Note that you should NOT delete the user record here by causing a disconnection!
+ * Use OnUserConnect for that instead.
+ * @param user The user registering
+ * @return 1 to indicate user quit, 0 to continue
+ */
+ virtual int OnUserRegister(User* user);
+
+ /** Called whenever a user joins a channel, to determine if invite checks should go ahead or not.
+ * This method will always be called for each join, wether or not the channel is actually +i, and
+ * determines the outcome of an if statement around the whole section of invite checking code.
+ * return 1 to explicitly allow the join to go ahead or 0 to ignore the event.
+ * @param user The user joining the channel
+ * @param chan The channel being joined
+ * @return 1 to explicitly allow the join, 0 to proceed as normal
+ */
+ virtual int OnCheckInvite(User* user, Channel* chan);
+
+ /** Called whenever a mode character is processed.
+ * Return 1 from this function to block the mode character from being processed entirely.
+ * @param user The user who is sending the mode
+ * @param chan The channel the mode is being sent to (or NULL if a usermode)
+ * @param mode The mode character being set
+ * @param param The parameter for the mode or an empty string
+ * @param adding true of the mode is being added, false if it is being removed
+ * @param pcnt The parameter count for the mode (0 or 1)
+ * @return ACR_DENY to deny the mode, ACR_DEFAULT to do standard mode checking, and ACR_ALLOW
+ * to skip all permission checking. Please note that for remote mode changes, your return value
+ * will be ignored!
+ */
+ virtual int OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt, bool servermode = true);
+
+ /** 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
+ * determines the outcome of an if statement around the whole section of key checking code.
+ * if the user specified no key, the keygiven string will be a valid but empty value.
+ * return 1 to explicitly allow the join to go ahead or 0 to ignore the event.
+ * @param user The user joining the channel
+ * @param chan The channel being joined
+ * @return 1 to explicitly allow the join, 0 to proceed as normal
+ */
+ virtual int OnCheckKey(User* user, Channel* chan, const std::string &keygiven);
+
+ /** Called whenever a user joins a channel, to determine if channel limit checks should go ahead or not.
+ * This method will always be called for each join, wether or not the channel is actually +l, and
+ * determines the outcome of an if statement around the whole section of channel limit checking code.
+ * return 1 to explicitly allow the join to go ahead or 0 to ignore the event.
+ * @param user The user joining the channel
+ * @param chan The channel being joined
+ * @return 1 to explicitly allow the join, 0 to proceed as normal
+ */
+ virtual int OnCheckLimit(User* user, Channel* chan);
+
+ /** Called whenever a user joins a channel, to determine if banlist checks should go ahead or not.
+ * This method will always be called for each join, wether or not the user actually matches a channel ban, and
+ * determines the outcome of an if statement around the whole section of ban checking code.
+ * return 1 to explicitly allow the join to go ahead or 0 to ignore the event.
+ * @param user The user joining the channel
+ * @param chan The channel being joined
+ * @return 1 to explicitly allow the join, 0 to proceed as normal. Return -1 to explicitly deny the
+ * join to the channel.
+ */
+ virtual int OnCheckBan(User* user, Channel* chan);
+
+ /* Called whenever checking whether or not a user is matched by an applicable extended bantype.
+ * NOTE: may also trigger extra OnCheckStringExtBan events!
+ * @param u The user to check
+ * @param c The channel the user is on
+ * @param type The type of extended ban to check for.
+ * @returns 1 = exempt, 0 = no match, -1 = banned