Cherry-pick useful parts of pull request #801

This commit is contained in:
Jyrki Vesterinen 2016-09-25 20:15:17 +03:00
parent 9ccc4300b9
commit 419a30b45e
2 changed files with 8 additions and 1 deletions

View File

@ -64,6 +64,7 @@ tmp_staging::tmp_staging(const config& /*cfg*/, ng::connect_engine& connect_engi
, ai_algorithms_(ai::configuration::get_available_ais())
, lobby_info_(lobby_info)
{
set_show_even_without_video(true);
}
void tmp_staging::pre_show(twindow& window)
@ -268,7 +269,7 @@ void tmp_staging::pre_show(twindow& window)
plugins_context_->set_callback("launch", [&window](const config&) { window.set_retval(twindow::OK); }, false);
plugins_context_->set_callback("quit", [&window](const config&) { window.set_retval(twindow::CANCEL); }, false);
plugins_context_->set_callback("chat", [this, &window](const config&) { return; /* TODO*/ }, false);
plugins_context_->set_callback("chat", [&chat](const config& cfg) { chat.send_chat_message(cfg["message"], false); }, true);
}
void tmp_staging::sync_changes()

View File

@ -37,6 +37,7 @@
#include "game_preferences.hpp"
#include "lobby_preferences.hpp"
#include "log.hpp"
#include "scripting/plugins/manager.hpp"
static lg::log_domain log_lobby("lobby");
#define DBG_LB LOG_STREAM(debug, log_lobby)
@ -701,6 +702,11 @@ void tchatbox::process_message(const ::config& data, bool whisper /*= false*/)
add_chat_room_message_received(room, sender, message);
}
// Notify plugins about the message
::config plugin_data = data;
plugin_data["whisper"] = whisper;
plugins_manager::get()->notify_event("chat", plugin_data);
}
bool tchatbox::process_network_data(const ::config& data)