From 64dad7886e22e24a52c260b5e7de5af1308b9b70 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Mon, 14 Apr 2008 09:51:05 +0000 Subject: Tweaked /whisper command to allow quoting of nicks with spaces in them. --- src/gui/chat.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/gui') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index bbd5cb00..d01e934d 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -301,10 +301,21 @@ ChatWindow::chatSend(const std::string &nick, std::string msg) std::string recvnick = ""; msg.erase(0, IS_WHISPER_LENGTH + 1); - const std::string::size_type pos = msg.find(" "); - if (pos != std::string::npos) { - recvnick = msg.substr(0, pos); - msg.erase(0, pos + 1); + if (msg.substr(0,1) == "\"") + { + const std::string::size_type pos = msg.find('"', 1); + if (pos != std::string::npos) { + recvnick = msg.substr(1, pos - 1); + msg.erase(0, pos + 2); + } + } + else + { + const std::string::size_type pos = msg.find(" "); + if (pos != std::string::npos) { + recvnick = msg.substr(0, pos); + msg.erase(0, pos + 1); + } } MessageOut outMsg(mNetwork); -- cgit v1.2.3-70-g09d2