3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

protocols: send old IrcServer object (serverdata) in SQUIT hooks

This commit is contained in:
James Lu 2016-08-04 12:50:04 -07:00
parent 1c0900b29d
commit b36ce36451
2 changed files with 10 additions and 7 deletions

View File

@ -1290,6 +1290,7 @@ class Protocol():
split_server = self._getSid(args[0])
affected_users = []
affected_nicks = []
log.debug('(%s) Splitting server %s (reason: %s)', self.irc.name, split_server, args[-1])
if split_server not in self.irc.servers:
@ -1310,16 +1311,20 @@ class Protocol():
for user in self.irc.servers[split_server].users.copy():
affected_users.append(user)
log.debug('Removing client %s (%s)', user, self.irc.users[user].nick)
nick = self.irc.users[user].nick
affected_nicks.append(nick)
log.debug('Removing client %s (%s)', user, nick)
self.removeClient(user)
sname = self.irc.servers[split_server].name
uplink = self.irc.servers[split_server].uplink
serverdata = self.irc.servers[split_server]
sname = serverdata.name
uplink = serverdata.uplink
del self.irc.servers[split_server]
log.debug('(%s) Netsplit affected users: %s', self.irc.name, affected_users)
return {'target': split_server, 'users': affected_users, 'name': sname,
'uplink': uplink}
'uplink': uplink, 'nicks': affected_nicks, 'serverdata': serverdata}
def parseCapabilities(self, args):
"""

View File

@ -236,9 +236,7 @@ class ClientbotWrapperProtocol(Protocol):
# Removing pseudoclients and pseudoservers.
squit_data = self._squit(source, 'CLIENTBOT_VIRTUAL_SQUIT', [target, text])
nicks = {self.irc.getFriendlyName(u) for u in squit_data['users']}
self.irc.callHooks([server, 'CLIENTBOT_SQUIT', {'nicks': nicks}])
self.irc.callHooks([source, 'CLIENTBOT_SQUIT', squit_data])
def _stub(self, *args):
"""Stub outgoing command function (does nothing)."""