\r
#include <boost/algorithm/string/trim.hpp>\r
#include <boost/algorithm/string/split.hpp>\r
+#include <boost/algorithm/string/replace.hpp>\r
#include <boost/lexical_cast.hpp>\r
\r
#if defined(_MSC_VER)\r
}\r
\r
void AMCPProtocolStrategy::ProcessMessage(const std::wstring& message, ClientInfoPtr& pClientInfo)\r
-{\r
+{ \r
+ CASPAR_LOG(info) << L"Received message from " << pClientInfo->print() << ": " << message + L"\\r\\n";\r
+ \r
bool bError = true;\r
MessageParserState state = New;\r
\r
#include <core/mixer/mixer.h>\r
#include <common/env.h>\r
\r
+#include <boost/algorithm/string/replace.hpp>\r
+\r
#if defined(_MSC_VER)\r
#pragma warning (push, 1) // TODO: Legacy code, just disable warnings\r
#endif\r
std::wstring message = availibleData.substr(0,pos);\r
\r
if(message.length() > 0) {\r
- ProcessMessage(message);\r
+ ProcessMessage(message, pClientInfo);\r
if(pClientInfo != 0)\r
pClientInfo->Send(TEXT("*\r\n"));\r
}\r
currentMessage_ = availibleData;\r
}\r
\r
-void CIIProtocolStrategy::ProcessMessage(const std::wstring& message)\r
-{\r
+void CIIProtocolStrategy::ProcessMessage(const std::wstring& message, IO::ClientInfoPtr pClientInfo)\r
+{ \r
+ CASPAR_LOG(info) << L"Received message from " << pClientInfo->print() << ": " << message + L"\\r\\n";\r
+\r
std::vector<std::wstring> tokens;\r
int tokenCount = TokenizeMessage(message, &tokens);\r
\r
static const TCHAR TokenDelimiter;\r
static const std::wstring MessageDelimiter;\r
\r
- void ProcessMessage(const std::wstring& message);\r
+ void ProcessMessage(const std::wstring& message, IO::ClientInfoPtr pClientInfo);\r
int TokenizeMessage(const std::wstring& message, std::vector<std::wstring>* pTokenVector);\r
CIICommandPtr Create(const std::wstring& name);\r
\r
#include "SocketInfo.h"\r
\r
#include <common/log/log.h>\r
-\r
-#include <boost/algorithm/string/replace.hpp>\r
-\r
#include <string>\r
#include <algorithm>\r
+#include <boost/algorithm/string/replace.hpp>\r
\r
#if defined(_MSC_VER)\r
#pragma warning (push, 1) // TODO: Legacy code, just disable warnings, will replace with boost::asio in future\r
}\r
\r
//Convert to widechar\r
- if(ConvertMultiByteToWideChar(pProtocolStrategy_->GetCodepage(), pSI->recvBuffer_, recvResult + pSI->recvLeftoverOffset_, pSI->wideRecvBuffer_, pSI->recvLeftoverOffset_))\r
- {\r
- auto msg = std::wstring(pSI->wideRecvBuffer_.begin(), pSI->wideRecvBuffer_.end());\r
- boost::replace_all(msg, L"\n", L"\\n");\r
- boost::replace_all(msg, L"\r", L"\\r");\r
-\r
- CASPAR_LOG(info) << L"Received message from " << pSI->host_.c_str() << ": "<< msg;\r
- pProtocolStrategy_->Parse(&pSI->wideRecvBuffer_[0], pSI->wideRecvBuffer_.size(), pSI);\r
- }\r
+ if(ConvertMultiByteToWideChar(pProtocolStrategy_->GetCodepage(), pSI->recvBuffer_, recvResult + pSI->recvLeftoverOffset_, pSI->wideRecvBuffer_, pSI->recvLeftoverOffset_)) \r
+ pProtocolStrategy_->Parse(&pSI->wideRecvBuffer_[0], pSI->wideRecvBuffer_.size(), pSI); \r
else \r
CASPAR_LOG(error) << "Read from " << pSI->host_.c_str() << TEXT(" failed, could not convert command to UNICODE");\r
\r
\r
virtual void Send(const std::wstring& data) = 0;\r
virtual void Disconnect() = 0;\r
+ virtual std::wstring print() const = 0;\r
\r
std::wstring currentMessage_;\r
};\r
std::wcout << (L"#" + data);\r
}\r
void Disconnect(){}\r
+ virtual std::wstring print() const {return L"Console";}\r
};\r
\r
}}\r
\r
void Send(const std::wstring& data);\r
void Disconnect();\r
+ virtual std::wstring print() const override {return host_;}\r
\r
SOCKET socket_;\r
HANDLE event_;\r