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

relay: use extra_channels to persistently join the PyLink bot to relay channels

Closes #247.
This commit is contained in:
James Lu 2016-06-25 14:21:18 -07:00
parent b90c69eead
commit 8af4b0c06d

View File

@ -457,6 +457,8 @@ def initializeChannel(irc, channel):
# Send our users and channel modes to the other nets # Send our users and channel modes to the other nets
log.debug('(%s) relay.initializeChannel: joining our (%s) users: %s', irc.name, remotenet, irc.channels[channel].users) log.debug('(%s) relay.initializeChannel: joining our (%s) users: %s', irc.name, remotenet, irc.channels[channel].users)
relayJoins(irc, channel, irc.channels[channel].users, irc.channels[channel].ts) relayJoins(irc, channel, irc.channels[channel].users, irc.channels[channel].ts)
world.services['pylink'].extra_channels[irc.name].add(channel)
if irc.pseudoclient and irc.pseudoclient.uid not in irc.channels[channel].users: if irc.pseudoclient and irc.pseudoclient.uid not in irc.channels[channel].users:
irc.proto.join(irc.pseudoclient.uid, channel) irc.proto.join(irc.pseudoclient.uid, channel)
@ -466,6 +468,7 @@ def removeChannel(irc, channel):
return return
if channel not in map(str.lower, irc.serverdata['channels']): if channel not in map(str.lower, irc.serverdata['channels']):
world.services['pylink'].extra_channels[irc.name].discard(channel)
irc.proto.part(irc.pseudoclient.uid, channel, 'Channel delinked.') irc.proto.part(irc.pseudoclient.uid, channel, 'Channel delinked.')
relay = getRelay((irc.name, channel)) relay = getRelay((irc.name, channel))