cherry pick improvements from hostmask_ignores br

And upload to weechat.org, may take quite a while to be reviewed.