From 04f88df38590d4bc8ce575bdc7ffcaada5419700 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 12 May 2017 19:19:52 -0700 Subject: [PATCH] Actually use 'irc' in main() and die() as a keyword argument (per docs) --- coremods/corecommands.py | 4 ++-- plugins/automode.py | 2 +- plugins/commands.py | 2 +- plugins/games.py | 2 +- plugins/relay.py | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/coremods/corecommands.py b/coremods/corecommands.py index b51d046..9b5bb5c 100644 --- a/coremods/corecommands.py +++ b/coremods/corecommands.py @@ -98,7 +98,7 @@ def load(irc, source, args): else: if hasattr(pl, 'main'): log.debug('Calling main() function of plugin %r', pl) - pl.main(irc) + pl.main(irc=irc) irc.reply("Loaded plugin %r." % name) @utils.add_cmd @@ -150,7 +150,7 @@ def unload(irc, source, args): # Call the die() function in the plugin, if present. if hasattr(pl, 'die'): try: - pl.die(irc) + pl.die(irc=irc) except: # But don't allow it to crash the server. log.exception('(%s) Error occurred in die() of plugin %s, skipping...', irc.name, pl) diff --git a/plugins/automode.py b/plugins/automode.py index 5d9b64d..a0f723c 100644 --- a/plugins/automode.py +++ b/plugins/automode.py @@ -42,7 +42,7 @@ def main(irc=None): log.debug('automode: auto-joining %s on %s', channel, netname) modebot.join(netname, channel) -def die(sourceirc): +def die(irc=None): """Saves the Automode database and quit.""" datastore.die() permissions.removeDefaultPermissions(default_permissions) diff --git a/plugins/commands.py b/plugins/commands.py index 2eca65c..377c809 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -14,7 +14,7 @@ def main(irc=None): # Register our permissions. permissions.addDefaultPermissions(default_permissions) -def die(irc): +def die(irc=None): """Commands plugin die function, called on plugin unload.""" permissions.removeDefaultPermissions(default_permissions) diff --git a/plugins/games.py b/plugins/games.py index 83d114d..67f3866 100644 --- a/plugins/games.py +++ b/plugins/games.py @@ -122,5 +122,5 @@ def fml(irc, source, args): reply(irc, s) gameclient.add_cmd(fml, featured=True) -def die(irc): +def die(irc=None): utils.unregisterService('games') diff --git a/plugins/relay.py b/plugins/relay.py index 704dc20..c0aa1f8 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -61,16 +61,16 @@ def main(irc=None): log.debug('relay.main: finished initialization sequence') -def die(sourceirc): +def die(irc=None): """Deinitialize PyLink Relay by quitting all relay clients and saving the relay DB.""" # For every connected network: - for irc in world.networkobjects.values(): + for ircobj in world.networkobjects.values(): # 1) SQUIT every relay subserver. - for server, sobj in irc.servers.copy().items(): + for server, sobj in ircobj.servers.copy().items(): if hasattr(sobj, 'remote'): - irc.proto.squit(irc.sid, server, text="Relay plugin unloaded.") + ircobj.proto.squit(ircobj.sid, server, text="Relay plugin unloaded.") # 2) Clear our internal servers and users caches. relayservers.clear()