diff --git a/chat_networking.hpp b/chat_networking.hpp index 6135ae4..05b89f0 100644 --- a/chat_networking.hpp +++ b/chat_networking.hpp @@ -15,8 +15,24 @@ namespace chat using boost::asio::ip::tcp; + struct receive_policy_stdout + { + static void message_do_what(chat_message msg) + { + std::cout << msg << '\n'; + } + + // TODO: handshake_policy + }; + + + /* most ezt így üres template paraméterekkel kell példányosítani, + * pl.: client_network_manager<> cnm; + * meg lehet oldani úgy, hogy ne kelljen? usingot/typedefet nem enged saját magára */ + template class client_network_manager { + // TODO: add static assert to check receive_policy /* members */ private: asio::io_service& _ios; @@ -128,7 +144,8 @@ namespace chat send(chat_message(message::PONG)); break; case byte(message::MESSAGE): - std::cout << data << '\n'; + chat_message msg(message::MESSAGE, data); + receive_policy::message_do_what(msg); break; }