commandline_chat's policies now get their messages via const reference

This commit is contained in:
Kjistóf 2016-12-04 14:54:15 +01:00
parent ab4a102bad
commit c256a9a928

View File

@ -6,25 +6,25 @@
struct receive_policy_stdout struct receive_policy_stdout
{ {
static void message_do_what(chat::chat_message msg) static void message_do_what(const chat::chat_message& msg)
{ std::cout << msg.get_content() << '\n'; } { std::cout << msg.get_content() << '\n'; }
static void handshake_do_what(chat::chat_message msg) static void handshake_do_what(const chat::chat_message& msg)
{ std::cout << "Handshake üzenetek:\n" << msg.get_content() << '\n'; } { std::cout << "Handshake üzenetek:\n" << msg.get_content() << '\n'; }
static void serverdirection_do_what(chat::chat_message msg) static void serverdirection_do_what(const chat::chat_message& msg)
{ std::cout << "Szerver üzenet: " << msg.get_content() << '\n'; } { std::cout << "Szerver üzenet: " << msg.get_content() << '\n'; }
static void login_do_what(chat::chat_message msg) static void login_do_what(const chat::chat_message& msg)
{ std::cout << msg.get_content() << " belépett.\n"; } { std::cout << msg.get_content() << " belépett.\n"; }
static void logout_do_what(chat::chat_message msg) static void logout_do_what(const chat::chat_message& msg)
{ std::cout << msg.get_content() << " kilépett.\n"; } { std::cout << msg.get_content() << " kilépett.\n"; }
}; };
struct send_policy_stdout struct send_policy_stdout
{ {
static bool check_msg_length(chat::chat_message msg) static bool check_msg_length(const chat::chat_message& msg)
{ {
bool good = msg.length() <= (256-34); bool good = msg.length() <= (256-34);
if (!good) if (!good)