From 0d502095c5c8fd956deb60e4397529b7bbc4b44d Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 7 Jul 2016 21:38:12 -0700 Subject: [PATCH] relay: integrate with automode by sending relay JOINs as a hook --- plugins/automode.py | 1 + plugins/relay.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/plugins/automode.py b/plugins/automode.py index d2e3f24..1120fc7 100644 --- a/plugins/automode.py +++ b/plugins/automode.py @@ -222,6 +222,7 @@ def handle_join(irc, source, command, args): for uid in args['users']: match(irc, channel, uid) utils.add_hook(handle_join, 'JOIN') +utils.add_hook(handle_join, 'PYLINK_RELAY_JOIN') # Handle the relay verison of join def handle_services_login(irc, source, command, args): """ diff --git a/plugins/relay.py b/plugins/relay.py index bafb132..1276ae0 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -649,6 +649,11 @@ def relayJoins(irc, channel, users, ts, burst=True): # A regular JOIN only needs the user and the channel. TS, source SID, etc., can all be omitted. remoteirc.proto.join(queued_users[0][1], remotechan) + # Announce this JOIN as a hook, for plugins like Automode. Is this a hack? Yeah. + # Plugins can communicate with each other using hooks. + remoteirc.callHooks([remoteirc.sid, 'PYLINK_RELAY_JOIN', + {'channel': remotechan, 'users': [u[-1] for u in queued_users]}]) + def relayPart(irc, channel, user): """ Relays a user part from a channel to its relay links, as part of a channel delink.