mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
global: allow configuring channels to exempt from announcements
Closes #453.
This commit is contained in:
parent
0edbeb7fad
commit
f82ddb5336
@ -815,6 +815,12 @@ stats:
|
||||
# $text: the global text
|
||||
#format: "[$sender@$fullnetwork] $text"
|
||||
|
||||
# Configures a set of channel globs to exempt from announcements. You can also add to
|
||||
# this per network via: servers::<server name>::global_exempt_channels,
|
||||
# the contents of which will be merged into this list.
|
||||
#exempt_channels:
|
||||
# - "#*staff*"
|
||||
|
||||
#antispam:
|
||||
# This block configures the antispam plugin; you don't need this if you aren't using it.
|
||||
# Antispam is automatically enabled in all channels that it's in, and you can configure
|
||||
|
@ -23,14 +23,28 @@ def g(irc, source, args):
|
||||
global_conf = conf.conf.get('global') or {}
|
||||
template = string.Template(global_conf.get('format', DEFAULT_FORMAT))
|
||||
|
||||
for name, ircd in world.networkobjects.items():
|
||||
exempt_channels = set(global_conf.get('exempt_channels', set()))
|
||||
for netname, ircd in world.networkobjects.items():
|
||||
if ircd.connected.is_set(): # Only attempt to send to connected networks
|
||||
for channel in ircd.pseudoclient.channels:
|
||||
|
||||
local_exempt_channels = exempt_channels | set(ircd.serverdata.get('global_exempt_channels', set()))
|
||||
|
||||
skip = False
|
||||
for exempt in local_exempt_channels:
|
||||
if irc.match_text(exempt, channel):
|
||||
log.debug('global: Skipping channel %s%s for exempt %r', netname, channel, exempt)
|
||||
skip = True
|
||||
break
|
||||
|
||||
if skip:
|
||||
continue
|
||||
|
||||
subst = {'sender': irc.get_friendly_name(source),
|
||||
'network': irc.name,
|
||||
'fullnetwork': irc.get_full_network_name(),
|
||||
'current_channel': channel,
|
||||
'current_network': ircd.name,
|
||||
'current_network': netname,
|
||||
'current_fullnetwork': ircd.get_full_network_name(),
|
||||
'text': message}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user