summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 1c375ad9..f8ef116c 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -50,6 +50,7 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
std::string::size_type pos = command.find(' ');
std::string type(command, 0, pos);
std::string args(command, pos == std::string::npos ? command.size() : pos + 1);
+ trim(args);
if (type == "help") // Do help before tabs so they can't override it
{
@@ -402,8 +403,21 @@ void CommandHandler::handleMsg(const std::string &args, ChatTab *tab)
void CommandHandler::handleQuery(const std::string &args, ChatTab *tab)
{
- if (chatWindow->addWhisperTab(args, true))
+ if (args.empty())
+ {
+ tab->chatLog(_("No <nick> was given."), BY_SERVER);
+ return;
+ }
+
+ if (args.length() > 1 && args[0] == '\"' && args[args.length() - 1] == '\"')
+ {
+ if (chatWindow->addWhisperTab(args.substr(1, args.length() - 2), true))
+ return;
+ }
+ else if (chatWindow->addWhisperTab(args, true))
+ {
return;
+ }
tab->chatLog(strprintf(_("Cannot create a whisper tab for nick \"%s\"! "
"It either already exists, or is you."), args.c_str()), BY_SERVER);