From 36bc29865b4ba2bae08acdd2d3ee003ba45bcc73 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 19 Apr 2011 15:31:13 +0000 Subject: [PATCH] Some minor fixes and cleanups. --- src/commands/default/comms.py | 2 +- src/comms/imc2.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commands/default/comms.py b/src/commands/default/comms.py index 0220a0fb8e..00a14b3f6e 100644 --- a/src/commands/default/comms.py +++ b/src/commands/default/comms.py @@ -956,7 +956,7 @@ class CmdIMC2Chan(MuxCommand): cols = [["Evennia channel"], ["IMC channel"]] for conn in connections: cols[0].append(conn.channel.key) - cols[1].append(" ".join(conn.external_config.split('|'))) + cols[1].append(" ".join(conn.external_config.split('|')[:-3])) ftable = utils.format_table(cols) string = "" for ir, row in enumerate(ftable): diff --git a/src/comms/imc2.py b/src/comms/imc2.py index fdd1fa5791..156ecc5324 100644 --- a/src/comms/imc2.py +++ b/src/comms/imc2.py @@ -150,6 +150,13 @@ class IMC2Protocol(telnet.StatefulTelnetProtocol): logger.log_infomsg("IMC2: Sending authentication packet.") self.send_packet(pck.IMC2PacketAuthPlaintext()) + def connectionLost(self, reason=None): + """ + This is executed when the connection is lost for + whatever reason. + """ + pass # we don't need to do anything, it's cleaned up automatically. + def send_packet(self, packet): """ Given a sub-class of IMC2Packet, assemble the packet and send it @@ -395,7 +402,6 @@ def create_connection(channel, imc2_network, imc2_port, imc2_channel, imc2_mudna old_conns = ExternalChannelConnection.objects.filter(db_external_key=key) if old_conns: - return # connection already exists. We try to only connect a new channel old_config = old_conns[0].db_external_config.split('|',5) old_chan_subs = old_config[2].split(',') @@ -408,7 +414,7 @@ def create_connection(channel, imc2_network, imc2_port, imc2_channel, imc2_mudna old_config[2] = old_chan_subs # add a channel subscription to old config old_conns[0].db_external_config = "|".join(old_config) old_conns[0].save() - return True + return True # new connection config = "%s|%s|%s|%s|%s|%s" % (imc2_network, imc2_port, imc2_channel, imc2_mudname, imc2_client_pwd, imc2_server_pwd)