From c594e25496f682ffe9ef63f1c25e0ac5156bbdcd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 May 2017 20:49:03 +0300 Subject: Allow run ipc commands before connected to server. --- src/net/ipc.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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::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(); -- cgit v1.2.3-60-g2f50