mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
relay: delay RELAY_JOIN hooks to a second loop. Closes #311.
This commit is contained in:
parent
17127dd131
commit
63f40c9565
@ -626,6 +626,7 @@ def relayJoins(irc, channel, users, ts, burst=True):
|
|||||||
"""
|
"""
|
||||||
Relays one or more users' joins from a channel to its relay links.
|
Relays one or more users' joins from a channel to its relay links.
|
||||||
"""
|
"""
|
||||||
|
joined_nets = {}
|
||||||
for name, remoteirc in world.networkobjects.copy().items():
|
for name, remoteirc in world.networkobjects.copy().items():
|
||||||
queued_users = []
|
queued_users = []
|
||||||
if name == irc.name or not remoteirc.connected.is_set():
|
if name == irc.name or not remoteirc.connected.is_set():
|
||||||
@ -675,10 +676,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.
|
# 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)
|
remoteirc.proto.join(queued_users[0][1], remotechan)
|
||||||
|
|
||||||
# Announce this JOIN as a hook, for plugins like Automode. Is this a hack? Yeah.
|
joined_nets[remoteirc] = {'channel': remotechan, 'users': [u[-1] for u in queued_users]}
|
||||||
# Plugins can communicate with each other using hooks.
|
|
||||||
remoteirc.callHooks([remoteirc.sid, 'PYLINK_RELAY_JOIN',
|
for remoteirc, hookdata in joined_nets.items():
|
||||||
{'channel': remotechan, 'users': [u[-1] for u in queued_users]}])
|
# HACK: Announce this JOIN as a special hook on each network, for plugins like Automode.
|
||||||
|
remoteirc.callHooks([remoteirc.sid, 'PYLINK_RELAY_JOIN', hookdata])
|
||||||
|
|
||||||
def relayPart(irc, channel, user):
|
def relayPart(irc, channel, user):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user