]> git.pond.sub.org Git - empserver/commit
Fix execute to filter input just like the main command loop
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 1 Jul 2011 18:12:37 +0000 (20:12 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 9 Jul 2011 13:16:21 +0000 (15:16 +0200)
commite2e69a29d505285c989b4f5ff2bf38489ba89b99
treea264d9d32c2b570fd5a6f9537a60d81278bb04bf
parenta9611a5794f96eec8ab70fe9550e872d1ab6529b
Fix execute to filter input just like the main command loop

When we added input filtering in v4.2.21, we missed the execute
command.  Because of that, funny characters can be treated differently
in batch files.

The main command loop uses getcommand(), which filters input.
execute() uses recvclient() directly, and doesn't filter input.  Both
feed the command to parse(), which drops unwanted control and
non-ASCII characters.

Input filtering drops unwanted control characters and, for ASCII
sessions, replaces non-ASCII characters by '?'.

Because of that, execute in ASCII sessions drops non-ASCII command
characters in batch files rather than replacing them.

Except where parts of the command are used raw: execute's command
echo, flash and wall message argument.  There, unwanted control
characters aren't dropped in UTF-8 sessions, and non-ASCII characters
are interpreted as UTF-8 in ASCII sessions.  Output filtering replaces
any resulting non-ASCII characters.

players column "last command" also uses the command raw, but commands
executed from batch files are not visible there, so it isn't affected.

To get rid of the differences, move the prompting from getcommand() to
command(), then switch execute() over to getcommand().

Side effect: the batch file's commands are now recorded in
player_commands[].  That's desirable.
src/lib/player/empdis.c
src/lib/player/player.c