X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules.h;h=12df69a211159ab245917440d177a71c11213be0;hb=9ebbd138cc41fdd89d32b1bcbd137be4f89afa5e;hp=b9bf136bb5eb0bd72a41c5c7b74d29fd80674df0;hpb=86c496cf14c77a6862f4167dd449d23366f74581;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules.h b/include/modules.h index b9bf136bb..12df69a21 100644 --- a/include/modules.h +++ b/include/modules.h @@ -60,7 +60,8 @@ enum WriteModeFlags { enum TargetTypeFlags { TYPE_USER = 1, TYPE_CHANNEL, - TYPE_SERVER + TYPE_SERVER, + TYPE_OTHER }; #include "dynamic.h" @@ -268,7 +269,7 @@ class ExtMode : public classbase int params_when_on; int params_when_off; bool list; - ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { }; + ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off), list(false) { }; }; /** Priority types which can be returned from Module::Prioritize() @@ -288,7 +289,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_OnGlobalConnect, I_OnAddBan, I_OnDelBan, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, - I_OnOperCompare, I_OnChannelDelete }; + I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData }; /** Base class for all InspIRCd modules * This class is the base class for InspIRCd modules. All modules must inherit from this class, @@ -482,6 +483,15 @@ class Module : public classbase * @param opertype The opers type name */ virtual void OnOper(userrec* user, std::string opertype); + + /** Called after a user opers locally. + * This is identical to Module::OnOper(), except it is called after OnOper so that other modules + * can be gauranteed to already have processed the oper-up, for example m_spanningtree has sent + * out the OPERTYPE, etc. + * @param user The user who is opering up + * @param opertype The opers type name + */ + virtual void OnPostOper(userrec* user, std::string opertype); /** Called whenever a user types /INFO. * The userrec will contain the information of the user who typed the command. Modules may use this @@ -575,8 +585,9 @@ class Module : public classbase * @param dest The target of the message * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text the text being sent by the user + * @param status The status being used, e.g. PRIVMSG @#chan has status== '@', 0 to send to everyone. */ - virtual void OnUserMessage(userrec* user, void* dest, int target_type, std::string text); + virtual void OnUserMessage(userrec* user, void* dest, int target_type, std::string text, char status); /** Called after any NOTICE sent from a user. * The dest variable contains a userrec* if target_type is TYPE_USER and a chanrec* @@ -585,8 +596,9 @@ class Module : public classbase * @param dest The target of the message * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text the text being sent by the user + * @param status The status being used, e.g. NOTICE @#chan has status== '@', 0 to send to everyone. */ - virtual void OnUserNotice(userrec* user, void* dest, int target_type, std::string text); + virtual void OnUserNotice(userrec* user, void* dest, int target_type, std::string text, char status); /** Called after every MODE command sent from a user * The dest variable contains a userrec* if target_type is TYPE_USER and a chanrec* @@ -666,6 +678,17 @@ class Module : public classbase */ virtual void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, std::string extname); + /* Allows modules to syncronize metadata not related to users or channels, over the network during a netburst. + * Whenever the linking module wants to send out data, but doesnt know what the data + * represents (e.g. it is Extensible metadata, added to a userrec or chanrec by a module) then + * this method is called. You should use the ProtoSendMetaData function after you've + * correctly decided how the data should be represented, to send the metadata on its way if + * if it belongs to your module. + * @param proto A pointer to the module handling network protocol + * @param opaque An opaque pointer set by the protocol module, should not be modified! + */ + virtual void OnSyncOtherMetaData(Module* proto, void* opaque); + /** Allows module data, sent via ProtoSendMetaData, to be decoded again by a receiving module. * Please see src/modules/m_swhois.cpp for a working example of how to use this method call. * @param target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL