diff --git a/example-conf.yml b/example-conf.yml index e265c59..401a240 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -697,12 +697,15 @@ changehost: # Sets the masks that Changehost enforcement should ignore: these can be users with certain # hosts, exttargets, etc. + # Since PyLink 2.1, you can also add to this list on a per-network basis by adding options under + # "servers::::changehost_enforce_exceptions". enforce_exceptions: - "*!*@yournet/staff/*" #- "$account" # Determines whether Changehost rules should also match the host portion of a mask by IP and - # real hosts. These default to false. + # real hosts. These default to false. You can override these on a per-network basis by setting + # "servers::::changehost_match_ip" or "servers::::changehost_match_realhosts". #match_ip: false #match_realhosts: false @@ -711,18 +714,16 @@ changehost: # text defined. The following substitutions are available here: # $uid, $ts (time of connection), $nick, $realhost, $ident, and $ip. # Invalid characters in hosts are replaced with a "-". - # Also, make sure you quote each entry so the YAML parser treats them as - # raw strings. + # Also, make sure you quote each entry so the YAML parser treats them as raw strings. + # Since PyLink 2.1, you can also add to this list on a per-network basis by adding options under + # "servers::::changehost_hosts". hosts: - - # Here are some examples. Note that to keep your users' details - # private, you should probably refrain from using $ip or $realhost, - # in these hostmasks, unless cloaking is already disabled. + # Here are some examples. Note that to keep your users' details private, you should probably refrain + # from using $ip or $realhost, in these hostmasks, unless cloaking is already disabled. "*!yourname@*.yournet.com": "$nick.opers.yournet.com" "*!*@localhost": "some-server.hostname" - # Freenode-style masks are possible with this (though without the - # hashing) + # Freenode-style masks are possible with this (though without the hashing) "*!*@bnc-server.yournet.com": "yournet/bnc-users/$ident" "*!*@ircip?.mibbit.com": "$ident.$realhost" "WebchatUser*!*@*": "webchat/users/$ident" diff --git a/plugins/changehost.py b/plugins/changehost.py index 9b18256..2b8a604 100644 --- a/plugins/changehost.py +++ b/plugins/changehost.py @@ -27,13 +27,11 @@ def _changehost(irc, target): # We're not enabled on the network, break. return - match_ip = changehost_conf.get('match_ip', False) - match_realhosts = changehost_conf.get('match_realhosts', False) + match_ip = irc.get_service_option('changehost', 'match_ip', default=False) + match_realhosts = irc.get_service_option('changehost', 'match_realhosts', default=False) - changehost_hosts = changehost_conf.get('hosts') + changehost_hosts = irc.get_service_options('changehost', 'hosts', dict) if not changehost_hosts: - log.warning("(%s) No hosts were defined in changehost::hosts; " - "Changehost will not function correctly!", irc.name) return args = irc.users[target].get_fields() @@ -102,7 +100,7 @@ def handle_chghost(irc, sender, command, args): log.debug('(%s) Enforce for network is on, re-checking host for target %s/%s', irc.name, target, irc.get_friendly_name(target)) - for ex in changehost_conf.get("enforce_exceptions", []): + for ex in irc.get_service_options("changehost", "enforce_exceptions", list): if irc.match_host(ex, target): log.debug('(%s) Skipping host change for target %s; they are exempted by mask %s', irc.name, target, ex)