Fixed some bugz0rs.

This commit is contained in:
Jeremy Fincher 2004-07-30 23:40:36 +00:00
parent 6f0309cc24
commit 893727f962

View File

@ -149,15 +149,16 @@ class Relay(callbacks.Privmsg):
""" """
realIrc = self._getRealIrc(irc) realIrc = self._getRealIrc(irc)
(network, server) = privmsgs.getArgs(args, optional=1) (network, server) = privmsgs.getArgs(args, optional=1)
if not server: if server:
server = None
else:
if ':' in server: if ':' in server:
(server, port) = server.split(':') (server, port) = server.split(':')
port = int(port) port = int(port)
else: else:
port = 6667 port = 6667
self._connect(network, realIrc, serverPort=(server, port)) serverPort = (server, port)
else:
serverPort = None
self._connect(network, realIrc, serverPort=serverPort)
irc.replySuccess() irc.replySuccess()
connect = privmsgs.checkCapability(connect, 'owner') connect = privmsgs.checkCapability(connect, 'owner')
@ -173,12 +174,8 @@ class Relay(callbacks.Privmsg):
def _connect(self, network, realIrc, serverPort=None, makeNew=True): def _connect(self, network, realIrc, serverPort=None, makeNew=True):
try: try:
group = conf.supybot.networks.get(network) group = conf.supybot.networks.get(network)
try: (server, port) = group.servers()[0]
(server, port) = group.server().split(':') except (registry.NonExistentRegistryEntry, IndexError):
serverPort = (server, int(port))
except ValueError: # Unpack list of wrong size.
serverPort = (group.server(), 6667)
except registry.NonExistentRegistryEntry:
# XXX: This should be a real error. # XXX: This should be a real error.
if serverPort is None: if serverPort is None:
raise ValueError, '_connect requires a (server, port) if ' \ raise ValueError, '_connect requires a (server, port) if ' \