3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

Rename utils.getProtoModule => utils.getProtocolModule

This commit is contained in:
James Lu 2015-12-24 17:33:49 -08:00
parent 2391918deb
commit 9a81a2ba1f
3 changed files with 12 additions and 4 deletions

View File

@ -199,7 +199,7 @@ def rehash(irc, source, args):
for network, sdata in new_conf['servers'].items():
# New server was added. Connect them if not already connected.
if network not in world.networkobjects:
proto = utils.getProtoModule(sdata['protocol'])
proto = utils.getProtocolModule(sdata['protocol'])
world.networkobjects[network] = classes.Irc(network, proto, new_conf)
irc.reply("Done.")

12
pylink
View File

@ -39,10 +39,18 @@ if __name__ == '__main__':
log.debug('Calling main() function of plugin %r', pl)
pl.main()
for network in conf.conf['servers']:
proto = utils.getProtoModule(conf.conf['servers'][network]['protocol'])
# Initialize all the networks one by one
for network, sdata in conf.conf['servers'].items():
protoname = sdata['protocol']
# Fetch the correct protocol module
proto = utils.getProtocolModule(protoname)
world.networkobjects[network] = irc = classes.Irc(network, proto, conf.conf)
# Call coreplugin's initialization method
log.debug('Calling main() function of coreplugin on network %s', irc.name)
coreplugin.main(irc)
world.started.set()
log.info("loaded plugins: %s", world.plugins)

View File

@ -519,7 +519,7 @@ def loadModuleFromFolder(name, folder):
m = importlib.machinery.SourceFileLoader(name, fullpath).load_module()
return m
def getProtoModule(protoname):
def getProtocolModule(protoname):
"""Imports and returns the protocol module requested."""
return loadModuleFromFolder(protoname, world.protocols_folder)