2017-03-13 17:30:06 +01:00
|
|
|
# global.py: Global Noticing Plugin
|
|
|
|
|
|
|
|
from pylinkirc import conf, utils, world
|
|
|
|
from pylinkirc.log import log
|
|
|
|
from pylinkirc.coremods import permissions
|
|
|
|
|
|
|
|
def g(irc, source, args):
|
|
|
|
"""<message text>
|
2017-03-13 21:29:04 +01:00
|
|
|
|
2017-03-13 17:30:06 +01:00
|
|
|
Sends out a Instance-wide notice.
|
|
|
|
"""
|
|
|
|
permissions.checkPermissions(irc, source, ["global.global"])
|
|
|
|
message = " ".join(args)
|
|
|
|
message = message + " (sent by %s@%s)" % (irc.getFriendlyName(irc.called_by), irc.getFullNetworkName())
|
|
|
|
for name, ircd in world.networkobjects.items():
|
2017-03-13 21:23:22 +01:00
|
|
|
if ircd.connected.is_set(): # Only attempt to send to connected networks
|
|
|
|
for channel in ircd.pseudoclient.channels:
|
2017-03-13 21:29:04 +01:00
|
|
|
# Disable relaying or other plugins handling the global message.
|
|
|
|
ircd.msg(channel, message, loopback=False)
|
|
|
|
|
2017-03-13 17:30:06 +01:00
|
|
|
|
|
|
|
utils.add_cmd(g, "global", featured=True)
|