Obtain terminal type (RFC 1091)
[mudpy.git] / mudpy / misc.py
index d753559..0543aa1 100644 (file)
@@ -503,6 +503,7 @@ class User:
         self.password_tries = 0
         self.state = "telopt_negotiation"
         self.telopts = {}
+        self.ttype = None
         self.universe = universe
 
     def quit(self):
@@ -805,6 +806,13 @@ class User:
         else:
             self.check_idle()
 
+        # ask the client for their current terminal type (RFC 1091); it's None
+        # if it's not been initialized, the empty string if it has but the
+        # output was indeterminate, "UNKNOWN" if the client specified it has no
+        # terminal types to supply
+        if self.ttype is None:
+            mudpy.telnet.request_ttype(self)
+
         # if output is paused, decrement the counter
         if self.state == "telopt_negotiation":
             if self.negotiation_pause: