Page 1 of 1

is these Hooks global ?

Posted: Fri Jul 04, 2014 11:36 pm
by viein
hi
i want to be sure
are the two Hooks global ?
HOOKTYPE_USERMSG and HOOKTYPE_CHANMSG
thanks

Re: is these Hooks global ?

Posted: Sat Jul 05, 2014 1:43 am
by Stealth
Any hook a module uses will only apply to the local server. To have a module work globally the module will need to be loaded on all servers.

Re: is these Hooks global ?

Posted: Sat Jul 05, 2014 10:10 am
by viein
ok but i don't understand why in some modules they check
if (MyClient(sptr))
since the hook data is local the client is surely on that server i really appreciate if you explained me the role of MyClient(sptr) in this case.

Re: is these Hooks global ?

Posted: Sun Jul 06, 2014 12:06 am
by Stealth
You should check to see if the client is connected to your local server before taking any action on the user. It is generally assumed if the client is remote that it has already been checked or acted on.

An example would be if you have a module that looks at messages from a user to a channel. Let's say your module blocks messages from users with +B. If a user sends messages to a channel, your module would want to see if the message needs to be blocked. If the user is not on your server but you block the message, only users on your server will not see the message. If the user is on your server and you block the message, all servers will not see the message.

EDIT: Hooks are called for ANY message of that type, regardless of where the message came from. This is because there may be some cases where you might want to check a remote user's actions.

Re: is these Hooks global ?

Posted: Sun Jul 06, 2014 12:23 am
by viein
i hope i understand well hooks (data) may be sent globaly (except *local_* hooks) but modules actions (in our case block msg ) have a local effect
thanks a lot Stealth