Some minor fixes and cleanups.

This commit is contained in:
Griatch 2011-04-19 15:31:13 +00:00
parent 0ea95631bf
commit 36bc29865b
2 changed files with 9 additions and 3 deletions

View file

@ -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):

View file

@ -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)