mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
Let's *really* prevent ourselves from reconnecting to the same network. The
Raise=True was raising a callbacks.Error which was being caught.
This commit is contained in:
parent
b4557e0cf4
commit
f36fdd3d21
@ -50,6 +50,8 @@ import supybot.privmsgs as privmsgs
|
|||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
|
class NetworkError(callbacks.Error):
|
||||||
|
pass
|
||||||
|
|
||||||
class Network(callbacks.Privmsg):
|
class Network(callbacks.Privmsg):
|
||||||
_whois = {}
|
_whois = {}
|
||||||
@ -59,13 +61,13 @@ class Network(callbacks.Privmsg):
|
|||||||
for irc in world.ircs:
|
for irc in world.ircs:
|
||||||
if irc.network.lower() == network:
|
if irc.network.lower() == network:
|
||||||
return irc
|
return irc
|
||||||
raise callbacks.Error, 'I\'m not currently connected to %s.' % network
|
raise NetworkError, 'I\'m not currently connected to %s.' % network
|
||||||
|
|
||||||
def _getNetwork(self, irc, args):
|
def _getNetwork(self, irc, args):
|
||||||
try:
|
try:
|
||||||
self._getIrc(args[0])
|
self._getIrc(args[0])
|
||||||
return args.pop(0)
|
return args.pop(0)
|
||||||
except (callbacks.Error, IndexError):
|
except (NetworkError, IndexError):
|
||||||
return irc.network
|
return irc.network
|
||||||
|
|
||||||
def connect(self, irc, msg, args):
|
def connect(self, irc, msg, args):
|
||||||
@ -79,7 +81,7 @@ class Network(callbacks.Privmsg):
|
|||||||
try:
|
try:
|
||||||
otherIrc = self._getIrc(network)
|
otherIrc = self._getIrc(network)
|
||||||
irc.error('I\'m already connected to %s.' % network, Raise=True)
|
irc.error('I\'m already connected to %s.' % network, Raise=True)
|
||||||
except callbacks.Error:
|
except NetworkError:
|
||||||
pass
|
pass
|
||||||
if server:
|
if server:
|
||||||
if ':' in server:
|
if ':' in server:
|
||||||
|
Loading…
Reference in New Issue
Block a user