mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
pr/insp: send the list of affected users in handle_squit
This commit is contained in:
parent
798476c850
commit
e413a21e68
@ -449,18 +449,22 @@ def handle_mode(irc, numeric, command, args):
|
|||||||
def handle_squit(irc, numeric, command, args):
|
def handle_squit(irc, numeric, command, args):
|
||||||
# :70M SQUIT 1ML :Server quit by GL!gl@0::1
|
# :70M SQUIT 1ML :Server quit by GL!gl@0::1
|
||||||
split_server = args[0]
|
split_server = args[0]
|
||||||
|
affected_users = []
|
||||||
log.info('(%s) Netsplit on server %s', irc.name, split_server)
|
log.info('(%s) Netsplit on server %s', irc.name, split_server)
|
||||||
# Prevent RuntimeError: dictionary changed size during iteration
|
# Prevent RuntimeError: dictionary changed size during iteration
|
||||||
old_servers = copy(irc.servers)
|
old_servers = copy(irc.servers)
|
||||||
for sid, data in old_servers.items():
|
for sid, data in old_servers.items():
|
||||||
if data.uplink == split_server:
|
if data.uplink == split_server:
|
||||||
log.debug('Server %s also hosts server %s, removing those users too...', split_server, sid)
|
log.debug('Server %s also hosts server %s, removing those users too...', split_server, sid)
|
||||||
handle_squit(irc, sid, 'SQUIT', [sid, "PyLink: Automatically splitting leaf servers of %s" % sid])
|
args = handle_squit(irc, sid, 'SQUIT', [sid, "PyLink: Automatically splitting leaf servers of %s" % sid])
|
||||||
|
affected_users += args['users']
|
||||||
for user in copy(irc.servers[split_server].users):
|
for user in copy(irc.servers[split_server].users):
|
||||||
|
affected_users.append(user)
|
||||||
log.debug('Removing client %s (%s)', user, irc.users[user].nick)
|
log.debug('Removing client %s (%s)', user, irc.users[user].nick)
|
||||||
removeClient(irc, user)
|
removeClient(irc, user)
|
||||||
del irc.servers[split_server]
|
del irc.servers[split_server]
|
||||||
return {'target': split_server}
|
log.debug('(%s) Netsplit affected users: %s', irc.name, affected_users)
|
||||||
|
return {'target': split_server, 'users': affected_users}
|
||||||
|
|
||||||
def handle_rsquit(irc, numeric, command, args):
|
def handle_rsquit(irc, numeric, command, args):
|
||||||
# <- :1MLAAAAIG RSQUIT :ayy.lmao
|
# <- :1MLAAAAIG RSQUIT :ayy.lmao
|
||||||
|
Loading…
Reference in New Issue
Block a user