From 4379ef68ef6836834682abfd9f1227f3b3559cec Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 2 Aug 2017 22:24:23 +0800 Subject: [PATCH] Migrate coremods.permissions to snake case --- coremods/control.py | 2 +- coremods/corecommands.py | 10 +++++----- coremods/permissions.py | 22 +++++++++++++--------- launcher.py | 2 +- plugins/automode.py | 10 +++++----- plugins/bots.py | 12 ++++++------ plugins/changehost.py | 2 +- plugins/commands.py | 16 ++++++++-------- plugins/exec.py | 8 ++++---- plugins/global.py | 2 +- plugins/networks.py | 8 ++++---- plugins/opercmds.py | 14 +++++++------- plugins/relay.py | 28 ++++++++++++++-------------- plugins/servermaps.py | 2 +- plugins/stats.py | 2 +- 15 files changed, 72 insertions(+), 68 deletions(-) diff --git a/coremods/control.py b/coremods/control.py index 6326911..888af26 100644 --- a/coremods/control.py +++ b/coremods/control.py @@ -106,7 +106,7 @@ def rehash(): # Reset permissions. log.debug('rehash: resetting permissions') - permissions.resetPermissions() + permissions.reset_permissions() for network, ircobj in world.networkobjects.copy().items(): # Server was removed from the config file, disconnect them. diff --git a/coremods/corecommands.py b/coremods/corecommands.py index 874fae6..fe6978f 100644 --- a/coremods/corecommands.py +++ b/coremods/corecommands.py @@ -59,7 +59,7 @@ def shutdown(irc, source, args): """takes no arguments. Exits PyLink by disconnecting all networks.""" - permissions.checkPermissions(irc, source, ['core.shutdown']) + permissions.check_permissions(irc, source, ['core.shutdown']) log.info('(%s) SHUTDOWN requested by %s, exiting...', irc.name, irc.get_hostmask(source)) control.shutdown(irc=irc) @@ -70,7 +70,7 @@ def load(irc, source, args): Loads a plugin from the plugin folder.""" # Note: reload capability is acceptable here, because all it actually does is call # load after unload. - permissions.checkPermissions(irc, source, ['core.load', 'core.reload']) + permissions.check_permissions(irc, source, ['core.load', 'core.reload']) try: name = args[0] @@ -100,7 +100,7 @@ def unload(irc, source, args): """. Unloads a currently loaded plugin.""" - permissions.checkPermissions(irc, source, ['core.unload', 'core.reload']) + permissions.check_permissions(irc, source, ['core.unload', 'core.reload']) try: name = args[0] @@ -186,7 +186,7 @@ def rehash(irc, source, args): Reloads the configuration file for PyLink, (dis)connecting added/removed networks. Note: plugins must be manually reloaded.""" - permissions.checkPermissions(irc, source, ['core.rehash']) + permissions.check_permissions(irc, source, ['core.rehash']) try: control.rehash() except Exception as e: # Something went wrong, abort. @@ -200,5 +200,5 @@ def clearqueue(irc, source, args): """takes no arguments. Clears the outgoing text queue for the current connection.""" - permissions.checkPermissions(irc, source, ['core.clearqueue']) + permissions.check_permissions(irc, source, ['core.clearqueue']) irc._queue.queue.clear() diff --git a/coremods/permissions.py b/coremods/permissions.py index c5998ea..f150627 100644 --- a/coremods/permissions.py +++ b/coremods/permissions.py @@ -15,45 +15,48 @@ permissions_lock = threading.Lock() from pylinkirc import conf, utils from pylinkirc.log import log -def resetPermissions(): +def reset_permissions(): """ Loads the permissions specified in the permissions: block of the PyLink configuration, if such a block exists. Otherwise, fallback to the default permissions specified by plugins. """ with permissions_lock: global permissions - log.debug('permissions.resetPermissions: old perm list: %s', permissions) + log.debug('permissions.reset_permissions: old perm list: %s', permissions) new_permissions = default_permissions.copy() - log.debug('permissions.resetPermissions: new_permissions %s', new_permissions) + log.debug('permissions.reset_permissions: new_permissions %s', new_permissions) if not conf.conf.get('permissions_merge_defaults', True): - log.debug('permissions.resetPermissions: clearing perm list due to permissions_merge_defaults set False.') + log.debug('permissions.reset_permissions: clearing perm list due to permissions_merge_defaults set False.') new_permissions.clear() # Convert all perm lists to sets. for k, v in conf.conf.get('permissions', {}).items(): new_permissions[k] |= set(v) - log.debug('permissions.resetPermissions: new_permissions %s', new_permissions) + log.debug('permissions.reset_permissions: new_permissions %s', new_permissions) permissions.clear() permissions.update(new_permissions) - log.debug('permissions.resetPermissions: new perm list: %s', permissions) + log.debug('permissions.reset_permissions: new perm list: %s', permissions) +resetPermissions = reset_permissions -def addDefaultPermissions(perms): +def add_default_permissions(perms): """Adds default permissions to the index.""" with permissions_lock: global default_permissions for target, permlist in perms.items(): default_permissions[target] |= set(permlist) +addDefaultPermissions = add_default_permissions -def removeDefaultPermissions(perms): +def remove_default_permissions(perms): """Remove default permissions from the index.""" with permissions_lock: global default_permissions for target, permlist in perms.items(): default_permissions[target] -= set(permlist) +removeDefaultPermissions = remove_default_permissions -def checkPermissions(irc, uid, perms, also_show=[]): +def check_permissions(irc, uid, perms, also_show=[]): """ Checks permissions of the caller. If the caller has any of the permissions listed in perms, this function returns True. Otherwise, NotAuthorizedError is raised. @@ -79,3 +82,4 @@ def checkPermissions(irc, uid, perms, also_show=[]): return True raise utils.NotAuthorizedError("You are missing one of the following permissions: %s" % (', '.join(perms+also_show))) +checkPermissions = check_permissions diff --git a/launcher.py b/launcher.py index cf90539..46a7969 100644 --- a/launcher.py +++ b/launcher.py @@ -84,4 +84,4 @@ def main(): world.started.set() log.info("Loaded plugins: %s", ', '.join(sorted(world.plugins.keys()))) - coremods.permissions.resetPermissions() # XXX we should probably move this to run on import + coremods.permissions.reset_permissions() # XXX we should probably move this to run on import diff --git a/plugins/automode.py b/plugins/automode.py index c532784..b7c35ff 100644 --- a/plugins/automode.py +++ b/plugins/automode.py @@ -33,7 +33,7 @@ def main(irc=None): datastore.load() # Register our permissions. - permissions.addDefaultPermissions(default_permissions) + permissions.add_default_permissions(default_permissions) # Queue joins to all channels where Automode has entries. for entry in db: @@ -45,7 +45,7 @@ def main(irc=None): def die(irc=None): """Saves the Automode database and quit.""" datastore.die() - permissions.removeDefaultPermissions(default_permissions) + permissions.remove_default_permissions(default_permissions) utils.unregisterService('automode') def _check_automode_access(irc, uid, channel, command): @@ -64,12 +64,12 @@ def _check_automode_access(irc, uid, channel, command): try: # First, check the catch all and channel permissions. perms = [baseperm, baseperm+'.*', '%s.%s' % (baseperm, channel)] - return permissions.checkPermissions(irc, uid, perms) + return permissions.check_permissions(irc, uid, perms) except utils.NotAuthorizedError: if not command.startswith('remote'): # Relay-based ACL checking only works with local calls. log.debug('(%s) Automode: falling back to automode.%s.relay_owned', irc.name, command) - permissions.checkPermissions(irc, uid, [baseperm+'.relay_owned'], also_show=perms) + permissions.check_permissions(irc, uid, [baseperm+'.relay_owned'], also_show=perms) relay = world.plugins.get('relay') if relay is None: @@ -280,7 +280,7 @@ def save(irc, source, args): """takes no arguments. Saves the Automode database to disk.""" - permissions.checkPermissions(irc, source, ['automode.savedb']) + permissions.check_permissions(irc, source, ['automode.savedb']) datastore.save() reply(irc, 'Done.') diff --git a/plugins/bots.py b/plugins/bots.py index 2115852..7f262f7 100644 --- a/plugins/bots.py +++ b/plugins/bots.py @@ -12,7 +12,7 @@ def spawnclient(irc, source, args): Spawns the specified client on the PyLink server. Note: this doesn't check the validity of any fields you give it!""" - permissions.checkPermissions(irc, source, ['bots.spawnclient']) + permissions.check_permissions(irc, source, ['bots.spawnclient']) try: nick, ident, host = args[:3] except ValueError: @@ -26,7 +26,7 @@ def quit(irc, source, args): """ [] Quits the PyLink client with nick , if one exists.""" - permissions.checkPermissions(irc, source, ['bots.quit']) + permissions.check_permissions(irc, source, ['bots.quit']) try: nick = args[0] @@ -59,7 +59,7 @@ def joinclient(irc, source, args): For the channel arguments, prefixes can also be specified to join the given client with (e.g. @#channel will join the client with op, while ~@#channel will join it with +qo. """ - permissions.checkPermissions(irc, source, ['bots.joinclient']) + permissions.check_permissions(irc, source, ['bots.joinclient']) try: # Check if the first argument is an existing PyLink client. If it is not, @@ -117,7 +117,7 @@ def nick(irc, source, args): Changes the nick of , a PyLink client, to . If is not given, it defaults to the main PyLink client.""" - permissions.checkPermissions(irc, source, ['bots.nick']) + permissions.check_permissions(irc, source, ['bots.nick']) try: nick = args[0] @@ -152,7 +152,7 @@ def part(irc, source, args): """[] ,[],... [] Parts , the nick of a PyLink client, from a comma-separated list of channels. If is not given, it defaults to the main PyLink client.""" - permissions.checkPermissions(irc, source, ['bots.part']) + permissions.check_permissions(irc, source, ['bots.part']) try: nick = args[0] @@ -198,7 +198,7 @@ def msg(irc, source, args): """[] Sends message from , where is the nick of a PyLink client. If is not given, it defaults to the main PyLink client.""" - permissions.checkPermissions(irc, source, ['bots.msg']) + permissions.check_permissions(irc, source, ['bots.msg']) # Because we want the source nick to be optional, this argument parsing gets a bit tricky. try: diff --git a/plugins/changehost.py b/plugins/changehost.py index 40e82c1..33d8c50 100644 --- a/plugins/changehost.py +++ b/plugins/changehost.py @@ -126,7 +126,7 @@ def applyhosts(irc, sender, args): Applies all configured hosts for users on the given network, or the current network if none is specified.""" - permissions.checkPermissions(irc, sender, ['changehost.applyhosts']) + permissions.check_permissions(irc, sender, ['changehost.applyhosts']) try: # Try to get network from the command line. network = world.networkobjects[args[0]] diff --git a/plugins/commands.py b/plugins/commands.py index ffd2463..fe970a3 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -12,18 +12,18 @@ default_permissions = {"*!*@*": ['commands.status', 'commands.showuser', 'comman def main(irc=None): """Commands plugin main function, called on plugin load.""" # Register our permissions. - permissions.addDefaultPermissions(default_permissions) + permissions.add_default_permissions(default_permissions) def die(irc=None): """Commands plugin die function, called on plugin unload.""" - permissions.removeDefaultPermissions(default_permissions) + permissions.remove_default_permissions(default_permissions) @utils.add_cmd def status(irc, source, args): """takes no arguments. Returns your current PyLink login status.""" - permissions.checkPermissions(irc, source, ['commands.status']) + permissions.check_permissions(irc, source, ['commands.status']) identified = irc.users[source].account if identified: irc.reply('You are identified as \x02%s\x02.' % identified) @@ -37,7 +37,7 @@ def showuser(irc, source, args): """ Shows information about .""" - permissions.checkPermissions(irc, source, ['commands.showuser']) + permissions.check_permissions(irc, source, ['commands.showuser']) try: target = args[0] except IndexError: @@ -81,7 +81,7 @@ def showchan(irc, source, args): """ Shows information about .""" - permissions.checkPermissions(irc, source, ['commands.showchan']) + permissions.check_permissions(irc, source, ['commands.showchan']) try: channel = irc.to_lower(args[0]) except IndexError: @@ -142,7 +142,7 @@ def echo(irc, source, args): """ Echoes the text given.""" - permissions.checkPermissions(irc, source, ['commands.echo']) + permissions.check_permissions(irc, source, ['commands.echo']) irc.reply(' '.join(args)) def _check_logout_access(irc, source, target, perms): @@ -154,7 +154,7 @@ def _check_logout_access(irc, source, target, perms): assert source in irc.users, "Unknown source user" assert target in irc.users, "Unknown target user" try: - permissions.checkPermissions(irc, source, perms) + permissions.check_permissions(irc, source, perms) except utils.NotAuthorizedError: if irc.users[source].account and (irc.users[source].account == irc.users[target].account): return True @@ -200,7 +200,7 @@ def loglevel(irc, source, args): Sets the log level to the given . must be either DEBUG, INFO, WARNING, ERROR, or CRITICAL. If no log level is given, shows the current one.""" - permissions.checkPermissions(irc, source, ['commands.loglevel']) + permissions.check_permissions(irc, source, ['commands.loglevel']) try: level = args[0].upper() try: diff --git a/plugins/exec.py b/plugins/exec.py index b0ff8fa..bb80d18 100644 --- a/plugins/exec.py +++ b/plugins/exec.py @@ -25,7 +25,7 @@ def _exec(irc, source, args, locals_dict=None): Admin-only. Executes in the current PyLink instance. This command performs backslash escaping of characters, so things like \\n and \\ will work. \x02**WARNING: THIS CAN BE DANGEROUS IF USED IMPROPERLY!**\x02""" - permissions.checkPermissions(irc, source, ['exec.exec']) + permissions.check_permissions(irc, source, ['exec.exec']) # Allow using \n in the code, while escaping backslashes correctly otherwise. args = bytes(' '.join(args), 'utf-8').decode("unicode_escape") @@ -69,7 +69,7 @@ def _eval(irc, source, args, locals_dict=None, pretty_print=False): Admin-only. Evaluates the given Python expression and returns the result. \x02**WARNING: THIS CAN BE DANGEROUS IF USED IMPROPERLY!**\x02""" - permissions.checkPermissions(irc, source, ['exec.eval']) + permissions.check_permissions(irc, source, ['exec.eval']) args = ' '.join(args) if not args.strip(): @@ -142,7 +142,7 @@ def raw(irc, source, args): Admin-only. Sends raw text to the uplink IRC server. \x02**WARNING: THIS CAN BREAK YOUR NETWORK IF USED IMPROPERLY!**\x02""" - permissions.checkPermissions(irc, source, ['exec.raw']) + permissions.check_permissions(irc, source, ['exec.raw']) args = ' '.join(args) if not args.strip(): @@ -162,7 +162,7 @@ def inject(irc, source, args): Admin-only. Injects raw text into the running PyLink protocol module, replying with the hook data returned. \x02**WARNING: THIS CAN BREAK YOUR NETWORK IF USED IMPROPERLY!**\x02""" - permissions.checkPermissions(irc, source, ['exec.inject']) + permissions.check_permissions(irc, source, ['exec.inject']) args = ' '.join(args) if not args.strip(): diff --git a/plugins/global.py b/plugins/global.py index 7817dc8..8d281d4 100644 --- a/plugins/global.py +++ b/plugins/global.py @@ -13,7 +13,7 @@ def g(irc, source, args): Sends out a Instance-wide notice. """ - permissions.checkPermissions(irc, source, ["global.global"]) + permissions.check_permissions(irc, source, ["global.global"]) message = " ".join(args) template = string.Template(conf.conf.get('global', {}).get("format", DEFAULT_FORMAT)) diff --git a/plugins/networks.py b/plugins/networks.py index 60b89d9..005fcba 100644 --- a/plugins/networks.py +++ b/plugins/networks.py @@ -16,7 +16,7 @@ def disconnect(irc, source, args): Disconnects the network . When all networks are disconnected, PyLink will automatically exit. To reconnect a network disconnected using this command, use REHASH to reload the networks list.""" - permissions.checkPermissions(irc, source, ['networks.disconnect']) + permissions.check_permissions(irc, source, ['networks.disconnect']) try: netname = args[0] network = world.networkobjects[netname] @@ -37,7 +37,7 @@ def autoconnect(irc, source, args): Sets the autoconnect time for to . You can disable autoconnect for a network by setting to a negative value.""" - permissions.checkPermissions(irc, source, ['networks.autoconnect']) + permissions.check_permissions(irc, source, ['networks.autoconnect']) try: netname = args[0] seconds = float(args[1]) @@ -64,7 +64,7 @@ def remote(irc, source, args): Runs on the remote network . Plugin responses sent using irc.reply() are supported and returned here, but others are dropped due to protocol limitations.""" - permissions.checkPermissions(irc, source, ['networks.remote']) + permissions.check_permissions(irc, source, ['networks.remote']) args = remote_parser.parse_args(args) netname = args.network @@ -151,7 +151,7 @@ def reloadproto(irc, source, args): """ Reloads the given protocol module without restart. You will have to manually disconnect and reconnect any network using the module for changes to apply.""" - permissions.checkPermissions(irc, source, ['networks.reloadproto']) + permissions.check_permissions(irc, source, ['networks.reloadproto']) try: name = args[0] except IndexError: diff --git a/plugins/opercmds.py b/plugins/opercmds.py index bf6de90..f65bcc2 100644 --- a/plugins/opercmds.py +++ b/plugins/opercmds.py @@ -36,7 +36,7 @@ def checkban(irc, source, args): include users in the given channel. The --maxresults option configures how many responses will be shown.""" - permissions.checkPermissions(irc, source, ['opercmds.checkban']) + permissions.check_permissions(irc, source, ['opercmds.checkban']) args = checkban_parser.parse_args(args) if not args.target: @@ -79,7 +79,7 @@ def jupe(irc, source, args): Jupes the given server.""" - permissions.checkPermissions(irc, source, ['opercmds.jupe']) + permissions.check_permissions(irc, source, ['opercmds.jupe']) try: servername = args[0] @@ -106,7 +106,7 @@ def kick(irc, source, args): """ [] Kicks from the specified channel.""" - permissions.checkPermissions(irc, source, ['opercmds.kick']) + permissions.check_permissions(irc, source, ['opercmds.kick']) try: channel = irc.to_lower(args[0]) target = args[1] @@ -137,7 +137,7 @@ def kill(irc, source, args): """ [] Kills the given target.""" - permissions.checkPermissions(irc, source, ['opercmds.kill']) + permissions.check_permissions(irc, source, ['opercmds.kill']) try: target = args[0] reason = ' '.join(args[1:]) @@ -170,7 +170,7 @@ def mode(irc, source, args): Sets the given modes on the target channel.""" - permissions.checkPermissions(irc, source, ['opercmds.mode']) + permissions.check_permissions(irc, source, ['opercmds.mode']) try: target, modes = args[0], args[1:] @@ -208,7 +208,7 @@ def topic(irc, source, args): """ Changes the topic in a channel.""" - permissions.checkPermissions(irc, source, ['opercmds.topic']) + permissions.check_permissions(irc, source, ['opercmds.topic']) try: channel = args[0] topic = ' '.join(args[1:]) @@ -249,7 +249,7 @@ def chgname(irc, source, args): chgfield(irc, source, args, 'name', 'GECOS') def chgfield(irc, source, args, human_field, internal_field=None): - permissions.checkPermissions(irc, source, ['opercmds.chg' + human_field]) + permissions.check_permissions(irc, source, ['opercmds.chg' + human_field]) try: target = args[0] new = args[1] diff --git a/plugins/relay.py b/plugins/relay.py index ee77650..1a601ce 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -52,7 +52,7 @@ def main(irc=None): log.debug('relay.main: loading links database') datastore.load() - permissions.addDefaultPermissions(default_permissions) + permissions.add_default_permissions(default_permissions) if irc is not None: # irc is defined when the plugin is reloaded. Otherwise, it means that we've just started the @@ -79,7 +79,7 @@ def die(irc=None): relayusers.clear() # 3) Unload our permissions. - permissions.removeDefaultPermissions(default_permissions) + permissions.remove_default_permissions(default_permissions) # 4) Save the database and quit. datastore.die() @@ -1626,7 +1626,7 @@ def create(irc, source, args): irc.error('You must be in %r to complete this operation.' % channel) return - permissions.checkPermissions(irc, source, ['relay.create']) + permissions.check_permissions(irc, source, ['relay.create']) # Check to see whether the channel requested is already part of a different # relay. @@ -1676,9 +1676,9 @@ def destroy(irc, source, args): # Check for different permissions based on whether we're destroying a local channel or # a remote one. if network == irc.name: - permissions.checkPermissions(irc, source, ['relay.destroy']) + permissions.check_permissions(irc, source, ['relay.destroy']) else: - permissions.checkPermissions(irc, source, ['relay.destroy.remote']) + permissions.check_permissions(irc, source, ['relay.destroy.remote']) entry = (network, channel) if entry in db: @@ -1699,7 +1699,7 @@ def purge(irc, source, args): """ Destroys all links relating to the target network.""" - permissions.checkPermissions(irc, source, ['relay.purge']) + permissions.check_permissions(irc, source, ['relay.purge']) try: network = args[0] except IndexError: @@ -1771,7 +1771,7 @@ def link(irc, source, args): irc.error('You must be in %r to complete this operation.' % localchan) return - permissions.checkPermissions(irc, source, ['relay.link']) + permissions.check_permissions(irc, source, ['relay.link']) if remotenet not in world.networkobjects: irc.error('No network named %r exists.' % remotenet) @@ -1798,7 +1798,7 @@ def link(irc, source, args): return if args.force: - permissions.checkPermissions(irc, source, ['relay.link.force']) + permissions.check_permissions(irc, source, ['relay.link.force']) log.info("(%s) relay: Forcing link %s%s -> %s%s", irc.name, irc.name, localchan, remotenet, args.channel) else: @@ -1842,7 +1842,7 @@ def delink(irc, source, args): except IndexError: remotenet = None - permissions.checkPermissions(irc, source, ['relay.delink']) + permissions.check_permissions(irc, source, ['relay.delink']) if not utils.isChannel(channel): irc.error('Invalid channel %r.' % channel) @@ -1876,7 +1876,7 @@ def linked(irc, source, args): Returns a list of channels shared across PyLink Relay. If \x02network\x02 is given, filters output to channels linked to the given network.""" - permissions.checkPermissions(irc, source, ['relay.linked']) + permissions.check_permissions(irc, source, ['relay.linked']) # Only show remote networks that are marked as connected. remote_networks = [netname for netname, ircobj in world.networkobjects.copy().items() @@ -1976,12 +1976,12 @@ def linkacl(irc, source, args): irc.error('No such relay %r exists.' % channel) return if cmd == 'list': - permissions.checkPermissions(irc, source, ['relay.linkacl.view']) + permissions.check_permissions(irc, source, ['relay.linkacl.view']) s = 'Blocked networks for \x02%s\x02: \x02%s\x02' % (channel, ', '.join(db[relay]['blocked_nets']) or '(empty)') irc.reply(s) return - permissions.checkPermissions(irc, source, ['relay.linkacl']) + permissions.check_permissions(irc, source, ['relay.linkacl']) try: remotenet = args[2] except IndexError: @@ -2072,7 +2072,7 @@ def save(irc, source, args): """takes no arguments. Saves the relay database to disk.""" - permissions.checkPermissions(irc, source, ['relay.savedb']) + permissions.check_permissions(irc, source, ['relay.savedb']) datastore.save() irc.reply('Done.') @@ -2097,7 +2097,7 @@ def claim(irc, source, args): irc.error("Not enough arguments. Needs 1-2: channel, list of networks (optional).") return - permissions.checkPermissions(irc, source, ['relay.claim']) + permissions.check_permissions(irc, source, ['relay.claim']) # We override get_relay() here to limit the search to the current network. relay = (irc.name, channel) diff --git a/plugins/servermaps.py b/plugins/servermaps.py index 8fbab0f..5443826 100644 --- a/plugins/servermaps.py +++ b/plugins/servermaps.py @@ -14,7 +14,7 @@ def _map(irc, source, args, show_relay=True): Shows the network map for the given network, or the current network if not specified.""" - permissions.checkPermissions(irc, source, ['servermaps.map']) + permissions.check_permissions(irc, source, ['servermaps.map']) try: netname = args[0] diff --git a/plugins/stats.py b/plugins/stats.py index 4af1401..c9b795a 100644 --- a/plugins/stats.py +++ b/plugins/stats.py @@ -32,7 +32,7 @@ def uptime(irc, source, args): Returns the uptime for PyLink and the given network's connection (or the current network if not specified). The --all argument can also be given to show the uptime for all networks.""" - permissions.checkPermissions(irc, source, ['stats.uptime']) + permissions.check_permissions(irc, source, ['stats.uptime']) try: network = args[0]