Add chardelete command to ooc menu for MULTISESSION_MODEs > 1. Also strip the result string from get_input helper to get rid of the carriage return always sent due to the user committing the command string.

This commit is contained in:
Griatch 2016-08-28 23:15:46 +02:00
parent d3c2e5de9d
commit 46ac4d3928
4 changed files with 61 additions and 1 deletions

View file

@ -792,7 +792,7 @@ class CmdGetInput(Command):
caller = self.caller
callback = caller.ndb._getinputcallback
prompt = caller.ndb._getinputprompt
result = self.raw_string
result = self.raw_string.strip() # we strip the ending line break caused by sending
ok = not callback(caller, prompt, result)
if ok:
@ -842,6 +842,13 @@ def get_input(caller, prompt, callback):
Raises:
RuntimeError: If the given callback is not callable.
Notes:
The result value sent to the callback is raw and not
processed in any way. This means that you will get
the ending line return character from most types of
client inputs. So make sure to strip that before
doing a comparison.
"""
if not callable(callback):
raise RuntimeError("get_input: input callback is not callable.")