evennia.server.portal.telnet¶
This module implements the telnet protocol.
This depends on a generic session module that implements the actual login procedure of the game, tracks sessions etc.
-
class
evennia.server.portal.telnet.
TelnetServerFactory
[source]¶ Bases:
twisted.internet.protocol.ServerFactory
This exists only to name this better in logs.
-
noisy
= False¶
-
-
class
evennia.server.portal.telnet.
TelnetProtocol
(*args, **kwargs)[source]¶ Bases:
twisted.conch.telnet.Telnet
,twisted.conch.telnet.StatefulTelnetProtocol
,evennia.server.session.Session
Each player connecting over telnet (ie using most traditional mud clients) gets a telnet protocol instance assigned to them. All communication between game and player goes through here.
-
dataReceived
(data)[source]¶ Unused by default, but a good place to put debug printouts of incoming data.
-
toggle_nop_keepalive
()[source]¶ Allow to toggle the NOP keepalive for those sad clients that can’t even handle a NOP instruction. This is turned off by the protocol_flag NOPKEEPALIVE (settable e.g. by the default option command).
-
handshake_done
(timeout=False)[source]¶ This is called by all telnet extensions once they are finished. When all have reported, a sync with the server is performed. The system will force-call this sync after a small time to handle clients that don’t reply to handshakes at all.
-
enableRemote
(option)[source]¶ This sets up the remote-activated options we allow for this protocol.
- Parameters
option (char) – The telnet option to enable.
- Returns
enable (bool) – If this option should be enabled.
-
disableRemote
(option)[source]¶ Signal a programming error by raising an exception.
L{enableRemote} must return true for the given value of C{option} in order for this method to be called. If a subclass of L{Telnet} overrides enableRemote to allow certain options to be enabled, it must also override disableRemote tto disable those options.
@raise NotImplementedError: Always raised.
-
enableLocal
(option)[source]¶ Call to allow the activation of options for this protocol
- Parameters
option (char) – The telnet option to enable locally.
- Returns
enable (bool) – If this option should be enabled.
-
disableLocal
(option)[source]¶ Disable a given option locally.
- Parameters
option (char) – The telnet option to disable locally.
-
connectionLost
(reason)[source]¶ this is executed when the connection is lost for whatever reason. it can also be called directly, from the disconnect method
- Parameters
reason (str) – Motivation for losing connection.
-
applicationDataReceived
(data)[source]¶ Telnet method called when non-telnet-command data is coming in over the telnet connection. We pass it on to the game engine directly.
- Parameters
data (str) – Incoming data.
-
sendLine
(line)[source]¶ Hook overloading the one used by linereceiver.
- Parameters
line (str) – Line to send.
-
disconnect
(reason='')[source]¶ Generic hook for the engine to call in order to disconnect this protocol.
- Parameters
reason (str, optional) – Reason for disconnecting.
-
data_in
(**kwargs)[source]¶ Data User -> Evennia
- Keyword Arguments
kwargs (any) – Options from the protocol.
-
data_out
(**kwargs)[source]¶ Data Evennia -> User
- Keyword Arguments
kwargs (any) – Options to the protocol
-
send_text
(*args, **kwargs)[source]¶ Send text data. This is an in-band telnet operation.
- Parameters
text (str) – The first argument is always the text string to send. No other arguments are considered.
- Keyword Arguments
options (dict) –
Send-option flags
mxp: Enforce MXP link support.
ansi: Enforce no ANSI colors.
xterm256: Enforce xterm256 colors, regardless of TTYPE.
noxterm256: Enforce no xterm256 color support, regardless of TTYPE.
nocolor: Strip all Color, regardless of ansi/xterm256 setting.
truecolor: Enforce truecolor, regardless of TTYPE.
- raw: Pass string through without any ansi processing
(i.e. include Evennia ansi markers but do not convert them into ansi tokens)
- echo: Turn on/off line echo on the client. Turn
off line echo for client, for example for password. Note that it must be actively turned back on again!
-