X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules.h;h=ae438128d33cf40994256ba813e1695534fb5e5f;hb=b00451a85cfc5d26bbfbd7bb903071f3bba91c9c;hp=b4f13c6b72e44df665c32e71390071db9782fd74;hpb=6adca3e0997781eae4adb02f19a2f8c312512ae1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules.h b/include/modules.h index b4f13c6b7..ae438128d 100644 --- a/include/modules.h +++ b/include/modules.h @@ -99,14 +99,15 @@ struct ModResult { /** InspIRCd major version. * 1.2 -> 102; 2.1 -> 201; 2.12 -> 212 */ -#define INSPIRCD_VERSION_MAJ 202 +#define INSPIRCD_VERSION_MAJ 300 + /** InspIRCd API version. * If you change any API elements, increment this value. This counter should be * reset whenever the major version is changed. Modules can use these two values * and numerical comparisons in preprocessor macros if they wish to support * multiple versions of InspIRCd in one file. */ -#define INSPIRCD_VERSION_API 1 +#define INSPIRCD_VERSION_API 3 /** * This #define allows us to call a method in all @@ -215,7 +216,7 @@ enum Implementation I_OnSendSnotice, I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper, I_OnUserPreInvite, I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNick, I_OnUserPostMessage, I_OnUserMessageBlocked, I_OnMode, - I_OnDecodeMetaData, I_OnAcceptConnection, I_OnUserInit, + I_OnDecodeMetaData, I_OnAcceptConnection, I_OnUserInit, I_OnUserPostInit, I_OnChangeHost, I_OnChangeRealName, I_OnAddLine, I_OnDelLine, I_OnExpireLine, I_OnUserPostNick, I_OnPreMode, I_On005Numeric, I_OnKill, I_OnLoadModule, I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnCheckInvite, @@ -721,11 +722,20 @@ class CoreExport Module : public classbase, public usecountbase */ virtual void OnPostCommand(Command* command, const CommandBase::Params& parameters, LocalUser* user, CmdResult result, bool loop); - /** Called when a user is first connecting, prior to starting DNS lookups, checking initial - * connect class, or accepting any commands. + /** Called after a user object is initialised and added to the user list. + * When this is called the user has not had their I/O hooks checked or had their initial + * connect class assigned and may not yet have a serialiser. You probably want to use + * the OnUserPostInit or OnUserSetIP hooks instead of this one. + * @param user The connecting user. */ virtual void OnUserInit(LocalUser* user); + /** Called after a user object has had their I/O hooks checked, their initial connection + * class assigned, and had a serialiser set. + * @param user The connecting user. + */ + virtual void OnUserPostInit(LocalUser* user); + /** 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 @@ -895,13 +905,6 @@ class CoreExport Module : public classbase, public usecountbase */ virtual ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass); -#ifdef INSPIRCD_ENABLE_TESTSUITE - /** Add test suite hooks here. These are used for testing functionality of a module - * via the --testsuite debugging parameter. - */ - virtual void OnRunTestSuite(); -#endif - /** Called for every item in a NAMES list, so that modules may reformat portions of it as they see fit. * For example NAMESX, channel mode +u and +I, and UHNAMES. * @param issuer The user who is going to receive the NAMES list being built @@ -932,6 +935,12 @@ class CoreExport Module : public classbase, public usecountbase */ virtual void OnServiceDel(ServiceProvider& service); + /** Called whenever a message is about to be written to a user. + * @param user The user who is having a message sent to them. + * @param msg The message which is being written to the user. + * @return MOD_RES_ALLOW to explicitly allow the message to be sent, MOD_RES_DENY to explicitly + * deny the message from being sent, or MOD_RES_PASSTHRU to let another module handle the event. + */ virtual ModResult OnUserWrite(LocalUser* user, ClientProtocol::Message& msg); };