Adding more lenient checks of TTYPE to avoid a visible traceback. The error with TTYPE utf-8 tracebacks seems to be in an older version of tintin++, newer versions don't show this behaviour. Older versions of tintin++ will display one Huh? (with logged traceback) after which everything will work. This is reported in issue 219.

This commit is contained in:
Griatch 2012-03-21 19:56:04 +01:00
parent 6aac9e6c2b
commit 8ada50fcb7
3 changed files with 25 additions and 14 deletions

View file

@ -41,7 +41,7 @@ class Ttype(object):
"""
self.ttype_step = 0
self.protocol = protocol
self.protocol.protocol_flags['TTYPE'] = {}
self.protocol.protocol_flags['TTYPE'] = {"init_done":False}
# setup protocol to handle ttype initialization and negotiation
self.protocol.negotiationMap[TTYPE] = self.do_ttype
@ -52,7 +52,7 @@ class Ttype(object):
"""
Callback if ttype is not supported by client.
"""
pass
self.protocol.protocol_flags['TTYPE'] = False
def do_ttype(self, option):
"""
@ -65,6 +65,9 @@ class Ttype(object):
stored on protocol.protocol_flags under the TTYPE key.
"""
if self.protocol.protocol_flags['TTYPE']['init_done']:
return
self.ttype_step += 1
if self.ttype_step == 1:
@ -89,5 +92,7 @@ class Ttype(object):
self.protocol.protocol_flags['TTYPE'][standard] = status
if status:
option = option % codenum
self.protocol.protocol_flags['TTYPE']['init_done'] = True
#print "ttype results:", self.protocol.protocol_flags['TTYPE']