summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2011-02-16 13:58:57 +0100
committerStefan Dombrowski <stefan@uni-bonn.de>2011-02-16 13:58:57 +0100
commit871203e820e8be156e62c873c366482cf18d1408 (patch)
treecf0f69b3279e6cd65f4d1e1e029b455ebb518914
parentd8cd477c05bda13b3fa231198f40dde3d6871eae (diff)
downloadmana-client-871203e820e8be156e62c873c366482cf18d1408.tar.gz
mana-client-871203e820e8be156e62c873c366482cf18d1408.tar.bz2
mana-client-871203e820e8be156e62c873c366482cf18d1408.tar.xz
mana-client-871203e820e8be156e62c873c366482cf18d1408.zip
Fixing query command handling
Tab completion puts quotes around nicks. The query command now removes the quotes. Also avoiding the opening of a tab if no nick was given. Reviewed-by: Freeyorp
-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);