From 4f995afdde1d96c367a6f712c33adabb0050d99e Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Mon, 28 Jul 2008 00:29:32 +0200 Subject: [PATCH] commands containing multiple slashes are no longer treated like a separate command (aka: it's safe to paste paths like /proc/cpuinfo now) --- src/core/userinputhandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/userinputhandler.cpp b/src/core/userinputhandler.cpp index 1bd29bd3..0e096a3c 100644 --- a/src/core/userinputhandler.cpp +++ b/src/core/userinputhandler.cpp @@ -37,7 +37,10 @@ void UserInputHandler::handleUserInput(const BufferInfo &bufferInfo, const QStri return; QString cmd; QString msg = msg_; - if(!msg.startsWith('/')) { + // leading slashes indicate there's a command to call unless there is anothere one in the first section (like a path /proc/cpuinfo) + int secondSlashPos = msg.indexOf('/', 1); + int firstSpacePos = msg.indexOf(' '); + if(!msg.startsWith('/') || (secondSlashPos != -1 && (secondSlashPos < firstSpacePos || firstSpacePos == -1))) { cmd = QString("SAY"); } else { cmd = msg.section(' ', 0, 0).remove(0, 1).toUpper(); -- 2.20.1