3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 03:33:10 +01:00

clientbot: add option to always autorejoin channels

Closes #647.
This commit is contained in:
James Lu 2019-11-29 23:51:57 -08:00
parent 7eff7861ed
commit 72c57d433a
2 changed files with 11 additions and 0 deletions

View File

@ -541,6 +541,10 @@ servers:
# - "MODE $nick +B"
# - "NOTICE somebody :hello, i've connected"
# Determines whether we should always attempt to rejoin channels we've been removed from.
# These attempts take place in the same interval as pingfreq. Defaults to false if not set.
#always_autorejoin: true
# Determines whether oper statuses should be tracked on this Clientbot network. This
# defaults to False for the best security, since oper status may allow more access to the
# entire PyLink service than what's desired, even when PyLink is only connected as a bot.

View File

@ -398,6 +398,13 @@ class ClientbotWrapperProtocol(ClientbotBaseProtocol, IRCCommonProtocol):
for channel in self.pseudoclient.channels:
self._send_who(channel)
# Join persistent channels if always_autorejoin is enabled and there are any we're not in
if self.serverdata.get('always_autorejoin') and self.has_cap('can-manage-bot-channels'):
for channel in world.services['pylink'].get_persistent_channels(self):
if channel not in self.pseudoclient.channels:
log.info('(%s) Attempting to rejoin %s', self.name, channel)
self.join(self.pseudoclient.uid, channel)
def part(self, source, channel, reason=''):
"""STUB: Parts a user from a channel."""
self._channels[channel].remove_user(source)