From 1c0900b29dc2b11824bb9ada95cd93e82176c7fb Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 4 Aug 2016 11:48:57 -0700 Subject: [PATCH] clientbot: introduce virtual SQUIT and SJOIN hooks --- protocols/clientbot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 17ad4ac..bb5f9ca 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -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)."""