Skip to content

Commit

Permalink
Network: add 'networks --all' option
Browse files Browse the repository at this point in the history
  • Loading branch information
GLolol committed Dec 19, 2014
1 parent 88f6496 commit 0c081b8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/Network/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,22 @@ def whowas(self, irc, msg, args, otherIrc, nick):
whowas = wrap(whowas, ['networkIrc', 'nick'])

@internationalizeDocstring
def networks(self, irc, msg, args):
"""takes no arguments
def networks(self, irc, msg, args, opts):
"""[--all]
Returns the networks to which the bot is currently connected.
If --all is given, also includes networks known by the bot,
but not connected to.
"""
opts = dict(opts)
L = ['%s: %s' % (ircd.network, ircd.server) for ircd in world.ircs]
if 'all' in opts:
for net in conf.supybot.networks._children.keys():
if net not in [ircd.network for ircd in world.ircs]:
L.append('%s: (%s)' % (net, _('disconnected')))
utils.sortBy(str.lower, L)
irc.reply(format('%L', L))
networks = wrap(networks)
networks = wrap(networks, [getopts({'all': ''})])

def doPong(self, irc, msg):
now = time.time()
Expand Down

0 comments on commit 0c081b8

Please sign in to comment.