.. hook:: H_TELNET_NEG :arg string value: void|mixed (int action, int option [, int * opts ] ) :arg closure value: void|mixed (int action, int option [, int * opts ] ) Optional hook to specifiy how to perform a single telnet negotiation. Hook setting may be any closure or a string. If not set, most telnet options are rejected (read: only a very minimal negotiation takes place). The hook is called whenever the driver receives a demand for option negotiation for any option the driver does not handle itself. By default, the driver deals with the following options: :macro:`TELOPT_ECHO`: Echo option :macro:`TELOPT_SGA`: Suppress Go Ahead (nearly always on) :macro:`TELOPT_COMPRESS`: Mud client compression protocol (obsolete) :macro:`TELOPT_COMPRESS2`: Mud client compression protocol V2 For all other telnet options negotiations, this hook is called. The hook has then to perform the negotiation using the :efun::`binary_message`. Alternatively, if :hook:`H_NOECHO` is set, this hook is called for *all* telnet data received. If the setting is a string, it used as the name of an lfun to call in ``this_player()``. Closures are just called, with unbound lambda-closures being bound to ``this_player()`` prior to execution. The hook is called for a 'DO/DONT/WILL/WONT ' with the action (DO/DONT/...) as the first, and as the second argument. For example:, if the driver receives the sequence IAC SB ... followed by IAC SB/SE, the hook is called with 'SB' as first argument, as second, and as an array of integers as third argument. .. subtopic:: Negotiations An incomplete list of telnet negotiations this hook is called for includes the following: SB: Suboption negotiation :macro:`TELOPT_LINEMODE`: linemode :macro:`TELOPT_NAWS`: window size :macro:`TELOPT_TTYPE`: terminal type :macro:`TELOPT_TM`: timing mark :macro:`TELOPT_NEWENV`: remote environment variables :macro:`TELOPT_ENVIRON`: remote environment variables :macro:`TELOPT_XDISPLOC`: remote X display address :macro:`TELOPT_TSPEED`: terminal speed :macro:`TELOPT_BINARY`: binary data, needed for non-ASCII charsets :macro:`TELOPT_EOR`: TinyFugue prompt marker (together with EOR) :macro:`TELOPT_MSP`: Mud Sound Protocol :macro:`TELOPT_MXP`: Mud Extension Protocol :macro:`TELOPT_MSSP`: Mud Server Status Protocol :macro:`TELOPT_GMCP`: Generic Mud Communication Protocol .. history .. seealso:: :overview:`hook`, :concept:`telnet`, :hook:`no_echo`