chmode: Refactor access checks into new function

Took a lot of repeated code and put it into a function chk_access
Add missing declaration for sendto_channel_local_with_capability_butone

Fixes a warning when compiling src/channel.c