is these Hooks global ?

These are old archives. They are kept for historic purposes only.
Post Reply
viein
Posts: 10
Joined: Sat Jun 21, 2014 5:47 pm

is these Hooks global ?

Post by viein » Fri Jul 04, 2014 11:36 pm

hi
i want to be sure
are the two Hooks global ?
HOOKTYPE_USERMSG and HOOKTYPE_CHANMSG
thanks

Stealth
Head of Support
Posts: 2078
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Re: is these Hooks global ?

Post by Stealth » Sat Jul 05, 2014 1:43 am

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.

viein
Posts: 10
Joined: Sat Jun 21, 2014 5:47 pm

Re: is these Hooks global ?

Post by viein » Sat Jul 05, 2014 10:10 am

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.

Stealth
Head of Support
Posts: 2078
Joined: Tue Jun 15, 2004 8:50 pm
Location: Chino Hills, CA, US
Contact:

Re: is these Hooks global ?

Post by Stealth » Sun Jul 06, 2014 12:06 am

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.

viein
Posts: 10
Joined: Sat Jun 21, 2014 5:47 pm

Re: is these Hooks global ?

Post by viein » Sun Jul 06, 2014 12:23 am

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

Post Reply