summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-08 20:49:03 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-08 20:49:03 +0300
commitc594e25496f682ffe9ef63f1c25e0ac5156bbdcd (patch)
tree412dfadad38ab39748ed7d3d70e6b6c823bd25b1 /src
parenta0ea4c0ba04425c08c5e9fe15ed70745891f3f8a (diff)
downloadmv-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.tar.gz
mv-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.tar.bz2
mv-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.tar.xz
mv-c594e25496f682ffe9ef63f1c25e0ac5156bbdcd.zip
Allow run ipc commands before connected to server.
Diffstat (limited to 'src')
-rw-r--r--src/net/ipc.cpp21
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();