From 5838d884043204a9530928e37de78dac248cd9dd Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 23 Aug 2018 02:56:01 -0400 Subject: [PATCH] networks: reload shared modules used by protocol modules too --- plugins/networks.py | 13 ++++++++++++- protocols/__init__.py | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/networks.py b/plugins/networks.py index 257a8a1..25fb113 100644 --- a/plugins/networks.py +++ b/plugins/networks.py @@ -3,7 +3,8 @@ import importlib import types import threading -from pylinkirc import utils, world, conf, classes +import pylinkirc +from pylinkirc import utils, world from pylinkirc.log import log from pylinkirc.coremods import control, permissions @@ -177,7 +178,17 @@ def reloadproto(irc, source, args): irc.error('Not enough arguments (needs 1: protocol module name)') return + # Reload the dependency libraries first + importlib.reload(pylinkirc.classes) + log.debug('networks.reloadproto: reloading %s', pylinkirc.classes) + + for common_name in pylinkirc.protocols.common_modules: + module = utils._get_protocol_module(common_name) + log.debug('networks.reloadproto: reloading %s', module) + importlib.reload(module) + proto = utils._get_protocol_module(name) + log.debug('networks.reloadproto: reloading %s', proto) importlib.reload(proto) irc.reply("Done. You will have to manually disconnect and reconnect any network using the %r module for changes to apply." % name) diff --git a/protocols/__init__.py b/protocols/__init__.py index a25b70a..249d3a6 100644 --- a/protocols/__init__.py +++ b/protocols/__init__.py @@ -1 +1,2 @@ -# Stub so that pylinkirc.protocols is a module +# Abstract modules containing shared protocol code; modules higher in the hierarchy go first +common_modules = ['ircs2s_common', 'ts6_common']