3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

networks: reintroduce networks properly in 'connect'

Closes #245.
This commit is contained in:
James Lu 2016-06-22 10:39:22 -07:00
parent dd08c01791
commit 1ad8b2e539

View File

@ -9,6 +9,8 @@ import threading
import utils
import world
from log import log
import conf
import classes
@utils.add_cmd
def disconnect(irc, source, args):
@ -51,15 +53,9 @@ def connect(irc, source, args):
return
if network.connection_thread.is_alive():
irc.reply('Error: Network "%s" seems to be already connected.' % netname)
else: # Reconnect the network!
network.connection_thread = threading.Thread(target=network.connect)
network.connection_thread.start()
# And the plugins we have too.
for plugin in world.plugins.values():
if hasattr(plugin, 'main'):
log.debug('(%s) Calling main() function of plugin %r', irc.name, plugin)
plugin.main(irc)
else: # Recreate the IRC object.
proto = utils.getProtocolModule(network.serverdata.get("protocol"))
world.networkobjects[netname] = classes.Irc(netname, proto, conf.conf)
irc.reply("Done.")