mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-11 20:52:42 +01:00
Actually use 'irc' in main() and die() as a keyword argument (per docs)
This commit is contained in:
parent
998beb51b5
commit
04f88df385
@ -98,7 +98,7 @@ def load(irc, source, args):
|
|||||||
else:
|
else:
|
||||||
if hasattr(pl, 'main'):
|
if hasattr(pl, 'main'):
|
||||||
log.debug('Calling main() function of plugin %r', pl)
|
log.debug('Calling main() function of plugin %r', pl)
|
||||||
pl.main(irc)
|
pl.main(irc=irc)
|
||||||
irc.reply("Loaded plugin %r." % name)
|
irc.reply("Loaded plugin %r." % name)
|
||||||
|
|
||||||
@utils.add_cmd
|
@utils.add_cmd
|
||||||
@ -150,7 +150,7 @@ def unload(irc, source, args):
|
|||||||
# Call the die() function in the plugin, if present.
|
# Call the die() function in the plugin, if present.
|
||||||
if hasattr(pl, 'die'):
|
if hasattr(pl, 'die'):
|
||||||
try:
|
try:
|
||||||
pl.die(irc)
|
pl.die(irc=irc)
|
||||||
except: # But don't allow it to crash the server.
|
except: # But don't allow it to crash the server.
|
||||||
log.exception('(%s) Error occurred in die() of plugin %s, skipping...', irc.name, pl)
|
log.exception('(%s) Error occurred in die() of plugin %s, skipping...', irc.name, pl)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ def main(irc=None):
|
|||||||
log.debug('automode: auto-joining %s on %s', channel, netname)
|
log.debug('automode: auto-joining %s on %s', channel, netname)
|
||||||
modebot.join(netname, channel)
|
modebot.join(netname, channel)
|
||||||
|
|
||||||
def die(sourceirc):
|
def die(irc=None):
|
||||||
"""Saves the Automode database and quit."""
|
"""Saves the Automode database and quit."""
|
||||||
datastore.die()
|
datastore.die()
|
||||||
permissions.removeDefaultPermissions(default_permissions)
|
permissions.removeDefaultPermissions(default_permissions)
|
||||||
|
@ -14,7 +14,7 @@ def main(irc=None):
|
|||||||
# Register our permissions.
|
# Register our permissions.
|
||||||
permissions.addDefaultPermissions(default_permissions)
|
permissions.addDefaultPermissions(default_permissions)
|
||||||
|
|
||||||
def die(irc):
|
def die(irc=None):
|
||||||
"""Commands plugin die function, called on plugin unload."""
|
"""Commands plugin die function, called on plugin unload."""
|
||||||
permissions.removeDefaultPermissions(default_permissions)
|
permissions.removeDefaultPermissions(default_permissions)
|
||||||
|
|
||||||
|
@ -122,5 +122,5 @@ def fml(irc, source, args):
|
|||||||
reply(irc, s)
|
reply(irc, s)
|
||||||
gameclient.add_cmd(fml, featured=True)
|
gameclient.add_cmd(fml, featured=True)
|
||||||
|
|
||||||
def die(irc):
|
def die(irc=None):
|
||||||
utils.unregisterService('games')
|
utils.unregisterService('games')
|
||||||
|
@ -61,16 +61,16 @@ def main(irc=None):
|
|||||||
|
|
||||||
log.debug('relay.main: finished initialization sequence')
|
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
|
"""Deinitialize PyLink Relay by quitting all relay clients and saving the
|
||||||
relay DB."""
|
relay DB."""
|
||||||
|
|
||||||
# For every connected network:
|
# For every connected network:
|
||||||
for irc in world.networkobjects.values():
|
for ircobj in world.networkobjects.values():
|
||||||
# 1) SQUIT every relay subserver.
|
# 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'):
|
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.
|
# 2) Clear our internal servers and users caches.
|
||||||
relayservers.clear()
|
relayservers.clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user