3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

changehost: implement enforce exceptions

This commit is contained in:
James Lu 2016-11-20 12:33:58 -08:00
parent f9e798cf93
commit 476f84a181
2 changed files with 13 additions and 0 deletions

View File

@ -417,6 +417,12 @@ changehost:
#enforced_nets:
# - inspnet
# Sets the masks that Changehost enforcement should ignore: these can be users with certain
# hosts, exttargets, etc.
enforce_exceptions:
- "*!*@yournet/staff/*"
#- "$account"
# This sets the hostmasks that Changehost should look for. Whenever someone
# with a matching nick!user@host connects, their host will be set to the
# text defined. The following substitutions are available here:

View File

@ -101,6 +101,13 @@ def handle_chghost(irc, sender, command, args):
if irc.name in changehost_conf.get('enforced_nets', []):
log.debug('(%s) Enforce for network is on, re-checking host for target %s/%s',
irc.name, target, irc.getFriendlyName(target))
for ex in changehost_conf.get("enforce_exceptions", []):
if irc.matchHost(ex, target):
log.debug('(%s) Skipping host change for target %s; they are exempted by mask %s',
irc.name, target, ex)
return
userdata = irc.users.get(target)
if userdata:
_changehost(irc, target, userdata.__dict__)