diff options
author | David Athay <dathay@mini1.local> | 2011-04-06 19:24:23 -0500 |
---|---|---|
committer | David Athay <dathay@mini1.local> | 2011-04-06 19:24:23 -0500 |
commit | 701a8d8bf4fe2d286c2ffa39efa8b80e6c85ff01 (patch) | |
tree | 4f01225b6a3958ce9361fe60533a19d6d522ed48 /src/commandhandler.cpp | |
parent | 66bd56ebec2bff48fb1484603b41643fd89bf4d6 (diff) | |
parent | b6f3db30c595d8e89572c78eb82b9823b8491c54 (diff) | |
download | mana-client-701a8d8bf4fe2d286c2ffa39efa8b80e6c85ff01.tar.gz mana-client-701a8d8bf4fe2d286c2ffa39efa8b80e6c85ff01.tar.bz2 mana-client-701a8d8bf4fe2d286c2ffa39efa8b80e6c85ff01.tar.xz mana-client-701a8d8bf4fe2d286c2ffa39efa8b80e6c85ff01.zip |
Merge branch '0.5' of git://gitorious.org/mana/mana into 0.5
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r-- | src/commandhandler.cpp | 16 |
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); |