baines / insobot

C99 modular IRC bot with markov chains
MIT License
74 stars 5 forks source link

mod_whitelist nickserv support / defer system #4

Open baines opened 7 years ago

baines commented 7 years ago

It might be nice to allow whitelist / admin entries that are based on nickserv usernames instead of nicknames. This way, people who change nick would not need to be re-added, and it would ensure impersonators could not elevate their privileges.

The 'ACC *' command to nickserv would probably be useful for this.

One problem however, is that we would want to get the nickserv response immediately in mod_whitelist's mod_msg handler - but new messages are not polled during a module callback.

One potential solution to this would be to add a "defer" system, possibly using the POSIX getcontext / setcontext functions to yield execution in the mod_msg handler, and return once the main loop receives the next PM.

I haven't fully thought this through yet.

baines commented 7 years ago

A potentially simpler solution than using the ucontext_t stuff is to use this IRCv3 capability: http://ircv3.net/specs/extensions/account-notify-3.1.html instead of messaging nickserv.

It would certainly not be as powerful as allowing modules to defer themselves until an arbitrary event though.