charybdis-ircd / charybdis

Scalable IRCv3.2 server for large, community-oriented networks
GNU General Public License v2.0
231 stars 102 forks source link

Simple hook priority system #321

Closed edk0 closed 4 years ago

edk0 commented 4 years ago

I'd like to see if we can stick to a set of discrete priorities (after all, just one priority worked for a long time) for now, to keep us less confused.

The idea behind their names is that LOWEST...HIGHEST are for hooks that change the outcome, while MONITOR is reserved by convention for hooks that merely observe (and perhaps take some other action). Hooks run lowest-priority-first so that the highest-priority hooks have the final say in the result. This has the somewhat counter-intuitive implication that if a hook needs to run first for its side-effects, it may need to be low-priority even though it isn't necessarily morally low-priority. But I think that's the less common case, and it makes sense to me that the priorities have names, so I've gone with it anyway.