diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-08 20:49:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-08 20:49:03 +0300 |
commit | c594e25496f682ffe9ef63f1c25e0ac5156bbdcd (patch) | |
tree | 412dfadad38ab39748ed7d3d70e6b6c823bd25b1 /src/net | |
parent | a0ea4c0ba04425c08c5e9fe15ed70745891f3f8a (diff) | |
download | manaplus-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.tar.gz manaplus-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.tar.bz2 manaplus-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.tar.xz manaplus-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.zip |
Allow run ipc commands before connected to server.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ipc.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 0137fa226..c694417c9 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -22,6 +22,10 @@ #include "gui/windows/chatwindow.h" +#ifndef DYECMD +#include "input/inputmanager.h" +#endif // DYECMD + #include "utils/delete2.h" #include "utils/sdlhelper.h" #include "utils/stringutils.h" @@ -198,6 +202,23 @@ void IPC::flush() chatWindow->chatInput(*it); } } + else + { + FOR_EACH (std::vector<std::string>::const_iterator, it, + mDelayedCommands) + { + std::string msg = *it; + if (msg.empty() || msg[0] != '/') + continue; + msg = msg.substr(1); + const size_t pos = msg.find(' '); + const std::string type(msg, 0, pos); + std::string args(msg, + pos == std::string::npos ? msg.size() : pos + 1); + args = trim(args); + inputManager.executeChatCommand(type, args, nullptr); + } + } #endif // DYECMD mDelayedCommands.clear(); |