mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
Allow disabling dynamic channels via a new "join_empty_channels" option
This commit is contained in:
parent
94a345423e
commit
77febfe69f
@ -141,6 +141,8 @@ def _services_dynamic_part(irc, channel):
|
||||
if irc.has_cap('visible-state-only'):
|
||||
# No-op on bot-only servers.
|
||||
return
|
||||
if irc.serverdata.get('join_empty_channels', conf.conf['pylink'].get('join_empty_channels', False)):
|
||||
return
|
||||
|
||||
# If all remaining users in the channel are service bots, make them all part.
|
||||
if all(irc.get_service_bot(u) for u in irc.channels[channel].users):
|
||||
|
@ -80,6 +80,11 @@ pylink:
|
||||
# of all database-enabled plugins to take effect.
|
||||
#save_delay: 300
|
||||
|
||||
# Determines whether that service bots should join preconfigured channels even if they are empty.
|
||||
# This can also be overriden per-network via the "join_empty_channels" variable.
|
||||
# This defaults to False if not set.
|
||||
#join_empty_channels: false
|
||||
|
||||
login:
|
||||
# NOTE: for users migrating from PyLink < 1.1, the old login:user/login:password settings
|
||||
# have been deprecated. We strongly recommend migrating to the new "accounts:" block below, as
|
||||
|
10
utils.py
10
utils.py
@ -150,7 +150,7 @@ class ServiceBot():
|
||||
else:
|
||||
raise NotImplementedError("Network specific plugins not supported yet.")
|
||||
|
||||
def join(self, irc, channels, ignore_empty=True):
|
||||
def join(self, irc, channels, ignore_empty=None):
|
||||
"""
|
||||
Joins the given service bot to the given channel(s). "channels" can be
|
||||
an iterable of channel names or the name of a single channel (type 'str').
|
||||
@ -160,8 +160,8 @@ class ServiceBot():
|
||||
marked persistent). This option is automatically *disabled* on networks
|
||||
where we cannot monitor channels that we're not in (e.g. Clientbot).
|
||||
|
||||
Before PyLink 2.0-alpha3, this function implicitly marks channels i
|
||||
receives to be persistent - this is no longer the case!
|
||||
Before PyLink 2.0-alpha3, this function implicitly marked channels it
|
||||
receives to be persistent. This behaviour is no longer the case.
|
||||
"""
|
||||
uid = self.uids.get(irc.name)
|
||||
if uid is None:
|
||||
@ -173,6 +173,10 @@ class ServiceBot():
|
||||
if irc.has_cap('visible-state-only'):
|
||||
# Disable dynamic channel joining on networks where we can't monitor channels for joins.
|
||||
ignore_empty = False
|
||||
elif ignore_empty is None:
|
||||
ignore_empty = not (irc.serverdata.get('join_empty_channels',
|
||||
conf.conf['pylink'].get('join_empty_channels',
|
||||
False)))
|
||||
|
||||
# Specify modes to join the services bot with.
|
||||
joinmodes = irc.get_service_option(self.name, 'joinmodes', default='')
|
||||
|
Loading…
Reference in New Issue
Block a user