diff --git a/plugins/networks.py b/plugins/networks.py index b5ecf6a..275048e 100644 --- a/plugins/networks.py +++ b/plugins/networks.py @@ -1,7 +1,7 @@ """Networks plugin - allows you to manipulate connections to various configured networks.""" import threading -from pylinkirc import utils, world +from pylinkirc import utils, world, conf, classes from pylinkirc.log import log @utils.add_cmd @@ -45,15 +45,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.") diff --git a/plugins/relay.py b/plugins/relay.py index 9500249..c7ded88 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -1127,7 +1127,8 @@ def handle_mode(irc, numeric, command, args): reversed_modes = irc.reverseModes(target, modes, oldobj=oldchan) log.debug('(%s) relay.handle_mode: Reversing mode changes of %r with %r (CLAIM).', irc.name, modes, reversed_modes) - irc.proto.mode(irc.sid, target, reversed_modes) + if reversed_modes: + irc.proto.mode(irc.sid, target, reversed_modes) break else: diff --git a/protocols/ts6.py b/protocols/ts6.py index 999f192..4fbacce 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -627,7 +627,11 @@ class TS6Protocol(TS6BaseProtocol): Note: The core of WHOIS handling is done by coreplugin.py (IRCd-independent), and not here.""" # <- :42XAAAAAB WHOIS 5PYAAAAAA :pylink-devel - return {'target': args[0]} + # First argument is the server that should reply to the WHOIS request + # or the server hosting the UID given. We can safely assume that any + # WHOIS commands received are for US, since we can't host any servers + # behind us to route it to. + return {'target': self.irc.nickToUid(args[-1])} def handle_472(self, numeric, command, args): """Handles the incoming 472 numeric.