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

clientbot: introduce virtual SQUIT and SJOIN hooks

This commit is contained in:
James Lu 2016-08-04 11:48:57 -07:00
parent 62099e6078
commit 1c0900b29d

View File

@ -227,12 +227,18 @@ class ClientbotWrapperProtocol(Protocol):
self.irc.users[user].channels.add(channel)
self.irc.channels[channel].users |= puids
nicks = {self.irc.getFriendlyName(u) for u in puids}
self.irc.callHooks([server, 'CLIENTBOT_SJOIN', {'channel': channel, 'nicks': nicks}])
def squit(self, source, target, text):
"""STUB: SQUITs a server."""
# What this actually does is just handle the SQUIT internally: i.e.
# Removing pseudoclients and pseudoservers.
self._squit(source, 'CLIENTBOT_VIRTUAL_SQUIT', [target, text])
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}])
def _stub(self, *args):
"""Stub outgoing command function (does nothing)."""