diff --git a/example-conf.yml b/example-conf.yml index a395986..588b010 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -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. diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 8a55d77..f40100a 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -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)