* parameters for the mode as strings. If mode_on is false, the mode is being removed, and parameters
* may contain the parameters for the mode, dependent on wether they were defined when a mode handler
* was set up with Server::AddExtendedMode
- * If the mode is not a channel mode, chanrec* chan is null, and should not be read from or written to.
+ * If the mode is a channel mode, target is a chanrec*, and if it is a user mode, target is a userrec*.
+ * You must cast this value yourself to make use of it.
*/
- virtual bool OnExtendedMode(userrec* user, chanrec* chan, char modechar, int type, bool mode_on, string_list ¶ms);
+ virtual bool OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms);
/** 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
* 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);
-
+ virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname);
+
+
+ /** Called whenever a user opers locally.
+ * The userrec will contain the oper mode 'o' as this function is called after any modifications
+ * are made to the user's structure by the core.
+ */
+ virtual void OnOper(userrec* user);
+
+ /** Called whenever a user types /INFO.
+ * The userrec will contain the information of the user who typed the command. Modules may use this
+ * method to output their own credits in /INFO (which is the ircd's version of an about box).
+ * It is purposefully not possible to modify any info that has already been output, or halt the list.
+ * You must write a 371 numeric to the user, containing your info in the following format:
+ *
+ * <nick> :information here
+ */
+ virtual void OnInfo(userrec* user);
+
+ /** Called whenever a /WHOIS is performed on a local user.
+ * 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.
+ */
+ 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);
};
*/
virtual void SendMode(char **parameters, int pcnt, userrec *user);
+
+ /** Sends to all users matching a mode mask
+ * You must specify one or more usermodes as the first parameter. These can be RFC specified modes such as +i,
+ * or module provided modes, including ones provided by your own module.
+ * In the second parameter you must place a flag value which indicates wether the modes you have given will be
+ * logically ANDed or OR'ed. You may use one of either WM_AND or WM_OR.
+ * for example, if you were to use:
+ *
+ * Serv->SendToModeMask("xi", WM_OR, "m00");
+ *
+ * Then the text 'm00' will be sent to all users with EITHER mode x or i. Conversely if you used WM_AND, the
+ * user must have both modes set to receive the message.
+ */
+ virtual void SendToModeMask(std::string modes, int flags, std::string text);
+
+ /** Forces a user to join a channel.
+ * This is similar to svsjoin and can be used to implement redirection, etc.
+ * On success, the return value is a valid pointer to a chanrec* of the channel the user was joined to.
+ * On failure, the result is NULL.
+ */
+ virtual chanrec* Server::JoinUserToChannel(userrec* user, std::string cname, std::string key);
+
+ /** Forces a user to part a channel.
+ * This is similar to svspart and can be used to implement redirection, etc.
+ * Although the return value of this function is a pointer to a channel record, the returned data is
+ * undefined and should not be read or written to. This behaviour may be changed in a future version.
+ */
+ virtual chanrec* Server::PartUserFromChannel(userrec* user, std::string cname, std::string reason);
+
+ /** Forces a user nickchange.
+ * This command works similarly to SVSNICK, and can be used to implement Q-lines etc.
+ * If you specify an invalid nickname, the nick change will be dropped and the target user will receive
+ * the error numeric for it.
+ */
+ virtual void ChangeUserNick(userrec* user, std::string nickname);
+
+ /** Forces a user to quit with the specified reason.
+ * To the user, it will appear as if they typed /QUIT themselves, except for the fact that this function
+ * may bypass the quit prefix specified in the config file.
+ *
+ * WARNING!
+ *
+ * Once you call this function, userrec* user will immediately become INVALID. You MUST NOT write to, or
+ * read from this pointer after calling the QuitUser method UNDER ANY CIRCUMSTANCES! The best course of
+ * action after calling this method is to immediately bail from your handler.
+ */
+ virtual void QuitUser(userrec* user, std::string reason);
};
/** Allows reading of values from configuration files