mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-17 23:52:49 +01:00
changehost: add optional vHost enforcement
This commit is contained in:
parent
ffc271a53a
commit
501647805c
@ -412,6 +412,11 @@ changehost:
|
|||||||
- inspnet
|
- inspnet
|
||||||
- ts6net
|
- ts6net
|
||||||
|
|
||||||
|
# Sets the networks where Changehost hosts should be enforced: that is, any attempts
|
||||||
|
# by the user or other services to overwrite a host will be reverted.
|
||||||
|
#enforced_nets:
|
||||||
|
# - inspnet
|
||||||
|
|
||||||
# This sets the hostmasks that Changehost should look for. Whenever someone
|
# 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
|
# with a matching nick!user@host connects, their host will be set to the
|
||||||
# text defined. The following substitutions are available here:
|
# text defined. The following substitutions are available here:
|
||||||
|
@ -81,6 +81,26 @@ def handle_uid(irc, sender, command, args):
|
|||||||
|
|
||||||
utils.add_hook(handle_uid, 'UID')
|
utils.add_hook(handle_uid, 'UID')
|
||||||
|
|
||||||
|
def handle_chghost(irc, sender, command, args):
|
||||||
|
"""
|
||||||
|
Handles incoming CHGHOST requests for optional host-change enforcement.
|
||||||
|
"""
|
||||||
|
changehost_conf = conf.conf.get("changehost")
|
||||||
|
if not changehost_conf:
|
||||||
|
return
|
||||||
|
|
||||||
|
target = args['target']
|
||||||
|
|
||||||
|
if (not irc.isInternalClient(sender)) and (not irc.isInternalServer(sender)):
|
||||||
|
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))
|
||||||
|
userdata = irc.users.get(target)
|
||||||
|
if userdata:
|
||||||
|
_changehost(irc, target, userdata.__dict__)
|
||||||
|
|
||||||
|
utils.add_hook(handle_chghost, 'CHGHOST')
|
||||||
|
|
||||||
@utils.add_cmd
|
@utils.add_cmd
|
||||||
def applyhosts(irc, sender, args):
|
def applyhosts(irc, sender, args):
|
||||||
"""[<network>]
|
"""[<network>]
|
||||||
|
Loading…
Reference in New Issue
Block a user