mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-11 20:52:42 +01:00
relay: allow toggling netsplit hiding
This commit is contained in:
parent
a3b9c55de6
commit
1ce6102ae8
@ -382,6 +382,10 @@ relay:
|
||||
# opers), and "none" (disabled). Defaults to none if not specified.
|
||||
whois_show_server: opers
|
||||
|
||||
# Determines whether netsplits should be hidden as *.net *.split over the relay.
|
||||
# Defaults to False.
|
||||
show_netsplits: false
|
||||
|
||||
games:
|
||||
# Sets the nick of the Games service, if you're using it.
|
||||
nick: Games
|
||||
|
@ -834,24 +834,47 @@ def handle_quit(irc, numeric, command, args):
|
||||
utils.add_hook(handle_quit, 'QUIT')
|
||||
|
||||
def handle_squit(irc, numeric, command, args):
|
||||
"""
|
||||
Handles SQUITs over relay.
|
||||
"""
|
||||
users = args['users']
|
||||
target = args['target']
|
||||
|
||||
# Someone /SQUIT one of our relay subservers. Bad! Rejoin them!
|
||||
if target in relayservers[irc.name].values():
|
||||
sname = args['name']
|
||||
remotenet = sname.split('.', 1)[0]
|
||||
del relayservers[irc.name][remotenet]
|
||||
|
||||
for userpair in relayusers:
|
||||
if userpair[0] == remotenet and irc.name in relayusers[userpair]:
|
||||
del relayusers[userpair][irc.name]
|
||||
|
||||
remoteirc = world.networkobjects[remotenet]
|
||||
initializeAll(remoteirc)
|
||||
|
||||
else:
|
||||
# Some other netsplit happened on the network, we'll have to fake
|
||||
# some *.net *.split quits for that.
|
||||
for user in users:
|
||||
log.debug('(%s) relay.handle_squit: sending handle_quit on %s', irc.name, user)
|
||||
handle_quit(irc, user, command, {'text': '*.net *.split'})
|
||||
|
||||
try: # Allow netsplit hiding to be toggled
|
||||
show_splits = irc.conf['relay']['show_netsplits']
|
||||
except KeyError:
|
||||
show_splits = False
|
||||
|
||||
text = '*.net *.split'
|
||||
if show_splits:
|
||||
uplink = args['uplink']
|
||||
try:
|
||||
text = '%s %s' % (irc.servers[uplink].name, args['name'])
|
||||
except (KeyError, AttributeError):
|
||||
log.warning("(%s) relay.handle_squit: Failed to get server name for %s",
|
||||
irc.name, uplink)
|
||||
|
||||
handle_quit(irc, user, command, {'text': text})
|
||||
|
||||
utils.add_hook(handle_squit, 'SQUIT')
|
||||
|
||||
def handle_nick(irc, numeric, command, args):
|
||||
|
Loading…
Reference in New Issue
Block a user