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

Describe this factory for log messages.

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.

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.


Unused by default, but a good place to put debug printouts of incoming data.


This is called when the connection is first established.


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


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.


Called when this session gets authenticated by the server.


This sets up the remote-activated options we allow for this protocol.


option (char) – The telnet option to enable.


enable (bool) – If this option should be enabled.


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.


Call to allow the activation of options for this protocol


option (char) – The telnet option to enable locally.


enable (bool) – If this option should be enabled.


Disable a given option locally.


option (char) – The telnet option to disable locally.


this is executed when the connection is lost for whatever reason. it can also be called directly, from the disconnect method


reason (str) – Motivation for losing connection.


Telnet method called when non-telnet-command data is coming in over the telnet connection. We pass it on to the game engine directly.


data (str) – Incoming data.


Hook overloading the one used by linereceiver.


line (str) – Line to send.


Generic hook for the engine to call in order to disconnect this protocol.


reason (str, optional) – Reason for disconnecting.


Data User -> Evennia

Keyword Arguments

kwargs (any) – Options from the protocol.


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.


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.

  • 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!

send_prompt(*args, **kwargs)[source]

Send a prompt - a text without a line end. See send_text for argument options.

send_default(cmdname, *args, **kwargs)[source]

Send other oob data