From ca0920e6354d14966d6ded6f25e98f9c7b86979a Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 23 Jun 2012 11:03:16 +0200 Subject: [PATCH] Added "raw_string" (unformatted, no stripping) as a property on commands, inspired by work by user Kelketek. --- src/commands/cmdhandler.py | 4 +++- src/server/telnet.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/cmdhandler.py b/src/commands/cmdhandler.py index 53df4635ac..86ba15be45 100644 --- a/src/commands/cmdhandler.py +++ b/src/commands/cmdhandler.py @@ -180,7 +180,7 @@ def cmdhandler(caller, raw_string, testing=False): if not cmdset: # this is bad and shouldn't happen. raise NoCmdSets - + unformatted_raw_string = raw_string raw_string = raw_string.strip() if not raw_string: # Empty input. Test for system command instead. @@ -248,6 +248,7 @@ def cmdhandler(caller, raw_string, testing=False): cmd.cmdstring = cmdname cmd.args = args cmd.cmdset = cmdset + cmd.raw_string = unformatted_raw_string if hasattr(cmd, 'obj') and hasattr(cmd.obj, 'scripts'): # cmd.obj are automatically made available. @@ -289,6 +290,7 @@ def cmdhandler(caller, raw_string, testing=False): syscmd.cmdstring = syscmd.key syscmd.args = sysarg syscmd.cmdset = cmdset + syscmd.raw_string = unformatted_raw_string if hasattr(syscmd, 'obj') and hasattr(syscmd.obj, 'scripts'): # cmd.obj is automatically made available. diff --git a/src/server/telnet.py b/src/server/telnet.py index 17e0e31dd6..3c807177da 100644 --- a/src/server/telnet.py +++ b/src/server/telnet.py @@ -101,8 +101,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): logger.log_trace() # if we get to this point the command must end with a linebreak. # We make sure to add it, to fix some clients messing this up. - data = data.rstrip("\r\n") + "\r\n" - #print "line mode: (%s)" % data + data = data.rstrip("\r\n") + "\n" + #print "line data in:", repr(data) StatefulTelnetProtocol.dataReceived(self, data) def _write(self, data):