mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-26 02:06:38 +02:00
2eecf4f2da
CAN_SEND_TO_USER rather than HOOKTYPE_PRE_USERMSG (which is now removed). As for the numeric change: this makes it much easier for client devs. You rarely need to differentiate in the client code between the various causes. One only cares about detecting that the message was not sent and that the user needs to be informed. This replaces various NOTICEs, ERR_NOCTCP, ERR_NONONREG etc. with just the new numeric 531, which is taken from InspIRCd. The syntax is: :server 531 yourname targetname :reason for the block This makes it similar to numeric 404 (ERR_CANNOTSENDTOCHAN) that is used to indicate that a channel message was blocked. For module devs, the new hook CAN_SEND_TO_USER prototype is: int hooktype_can_send_to_user(Client *client, Client *target, char **text, char **errmsg, int notice); You can replace the text via this, by setting *text in your function. You can block the message, by returning HOOK_DENY. If doing so, then you must also set *errmsg to an appropriate value. Do not send any error message to the user! UnrealIRCd will take care of sending the error message for you, if you set *errmsg. Only if you need something special you could violate this rule, but preferably not! As you can see, CAN_SEND_TO_USER works just like CAN_SEND_TO_CHANNEL.