3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-03-01 12:00:42 +01:00

relay: integrate with automode by sending relay JOINs as a hook

This commit is contained in:
James Lu 2016-07-07 21:38:12 -07:00
parent 2be4811673
commit 0d502095c5
2 changed files with 6 additions and 0 deletions

View File

@ -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):
"""

View File

@ -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.