mirror of
https://github.com/jlu5/PyLink.git
synced 2025-05-06 06:37:22 +02: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.
|
# opers), and "none" (disabled). Defaults to none if not specified.
|
||||||
whois_show_server: opers
|
whois_show_server: opers
|
||||||
|
|
||||||
|
# Determines whether netsplits should be hidden as *.net *.split over the relay.
|
||||||
|
# Defaults to False.
|
||||||
|
show_netsplits: false
|
||||||
|
|
||||||
games:
|
games:
|
||||||
# Sets the nick of the Games service, if you're using it.
|
# Sets the nick of the Games service, if you're using it.
|
||||||
nick: Games
|
nick: Games
|
||||||
|
@ -834,24 +834,47 @@ def handle_quit(irc, numeric, command, args):
|
|||||||
utils.add_hook(handle_quit, 'QUIT')
|
utils.add_hook(handle_quit, 'QUIT')
|
||||||
|
|
||||||
def handle_squit(irc, numeric, command, args):
|
def handle_squit(irc, numeric, command, args):
|
||||||
|
"""
|
||||||
|
Handles SQUITs over relay.
|
||||||
|
"""
|
||||||
users = args['users']
|
users = args['users']
|
||||||
target = args['target']
|
target = args['target']
|
||||||
|
|
||||||
# Someone /SQUIT one of our relay subservers. Bad! Rejoin them!
|
# Someone /SQUIT one of our relay subservers. Bad! Rejoin them!
|
||||||
if target in relayservers[irc.name].values():
|
if target in relayservers[irc.name].values():
|
||||||
sname = args['name']
|
sname = args['name']
|
||||||
remotenet = sname.split('.', 1)[0]
|
remotenet = sname.split('.', 1)[0]
|
||||||
del relayservers[irc.name][remotenet]
|
del relayservers[irc.name][remotenet]
|
||||||
|
|
||||||
for userpair in relayusers:
|
for userpair in relayusers:
|
||||||
if userpair[0] == remotenet and irc.name in relayusers[userpair]:
|
if userpair[0] == remotenet and irc.name in relayusers[userpair]:
|
||||||
del relayusers[userpair][irc.name]
|
del relayusers[userpair][irc.name]
|
||||||
|
|
||||||
remoteirc = world.networkobjects[remotenet]
|
remoteirc = world.networkobjects[remotenet]
|
||||||
initializeAll(remoteirc)
|
initializeAll(remoteirc)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Some other netsplit happened on the network, we'll have to fake
|
# Some other netsplit happened on the network, we'll have to fake
|
||||||
# some *.net *.split quits for that.
|
# some *.net *.split quits for that.
|
||||||
for user in users:
|
for user in users:
|
||||||
log.debug('(%s) relay.handle_squit: sending handle_quit on %s', irc.name, user)
|
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')
|
utils.add_hook(handle_squit, 'SQUIT')
|
||||||
|
|
||||||
def handle_nick(irc, numeric, command, args):
|
def handle_nick(irc, numeric, command, args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user