From 180da83b4ef5410448cc79314b4869dcbec954e5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 8 Jun 2018 18:28:28 -0700 Subject: [PATCH] global: reply with a confirmation We can also use this space to show the number of channels and networks announced to. --- plugins/global.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/global.py b/plugins/global.py index c2d9f66..2961771 100644 --- a/plugins/global.py +++ b/plugins/global.py @@ -24,8 +24,12 @@ def g(irc, source, args): template = string.Template(global_conf.get('format', DEFAULT_FORMAT)) exempt_channels = set(global_conf.get('exempt_channels', set())) + + netcount = 0 + chancount = 0 for netname, ircd in world.networkobjects.items(): if ircd.connected.is_set(): # Only attempt to send to connected networks + netcount += 1 for channel in ircd.pseudoclient.channels: local_exempt_channels = exempt_channels | set(ircd.serverdata.get('global_exempt_channels', set())) @@ -51,5 +55,8 @@ def g(irc, source, args): # Disable relaying or other plugins handling the global message. ircd.msg(channel, template.safe_substitute(subst), loopback=False) + chancount += 1 + + irc.reply('Done. Sent to %d channels across %d networks.' % (chancount, netcount)) utils.add_cmd(g, "global", featured=True)