]> git.sesse.net Git - casparcg/commitdiff
Print entire message, not parts.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 25 Dec 2011 10:51:17 +0000 (10:51 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 25 Dec 2011 10:51:17 +0000 (10:51 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@1939 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

protocol/amcp/AMCPProtocolStrategy.cpp
protocol/cii/CIIProtocolStrategy.cpp
protocol/cii/CIIProtocolStrategy.h
protocol/util/AsyncEventServer.cpp
protocol/util/ClientInfo.h
protocol/util/SocketInfo.h

index d7bc190edef200f547493c7c6ce784c8f241fe4e..d7abbfeeb509100a327f54c8e08ac1a3053e9f24 100644 (file)
@@ -35,6 +35,7 @@
 \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
@@ -110,7 +111,9 @@ void AMCPProtocolStrategy::Parse(const TCHAR* pData, int charCount, ClientInfoPt
 }\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
index 79e2732495bd82f35dc419075d959dd78dffbd6d..6499ae9b3447752481a5c8d20fa4316d9a792599 100644 (file)
@@ -32,6 +32,8 @@
 #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
@@ -61,7 +63,7 @@ void CIIProtocolStrategy::Parse(const TCHAR* pData, int charCount, IO::ClientInf
                        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
@@ -81,8 +83,10 @@ void CIIProtocolStrategy::Parse(const TCHAR* pData, int charCount, IO::ClientInf
        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
index f6d4d102c9aca9aab89656f165844faee14cf65e..88a3b6fd0416a00571a67d40d5a3a1480a095706 100644 (file)
@@ -79,7 +79,7 @@ private:
        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
index 036541c100481eb6970234c0293688f79379a556..3d068056680d1bdde70a7eddb04e6e6443e5104a 100644 (file)
 #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
@@ -356,15 +354,8 @@ bool AsyncEventServer::OnRead(SocketInfoPtr& pSI) {
                }\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
index 5278d34c3103626aae4f3cacbc678bd1cede0b5f..c7fd4285dad8f6db200f428dece2a54ea06cd235 100644 (file)
@@ -37,6 +37,7 @@ public:
 \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
@@ -49,6 +50,7 @@ struct ConsoleClientInfo : public caspar::IO::ClientInfo
                std::wcout << (L"#" + data);\r
        }\r
        void Disconnect(){}\r
+       virtual std::wstring print() const {return L"Console";}\r
 };\r
 \r
 }}\r
index 4b6cc405be9d628b426df947f4d084cf69dbcba7..0594fe99e3354644576b3a9d19e21e4085d34c0c 100644 (file)
@@ -44,6 +44,7 @@ public:
 \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