Limit netplay chat messages to 2000 characters.
There's not really a good reason to be sending messages longer than that, and very long messages can hang dolphin for quite a long time.
This commit is contained in:
parent
b58753bd69
commit
61d3360033
|
@ -335,6 +335,7 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
|
||||||
m_chat_msg_text = new wxTextCtrl(panel, wxID_ANY, wxEmptyString
|
m_chat_msg_text = new wxTextCtrl(panel, wxID_ANY, wxEmptyString
|
||||||
, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
||||||
m_chat_msg_text->Bind(wxEVT_TEXT_ENTER, &NetPlayDiag::OnChat, this);
|
m_chat_msg_text->Bind(wxEVT_TEXT_ENTER, &NetPlayDiag::OnChat, this);
|
||||||
|
m_chat_msg_text->SetMaxLength(2000);
|
||||||
|
|
||||||
wxButton* const chat_msg_btn = new wxButton(panel, wxID_ANY, _("Send"));
|
wxButton* const chat_msg_btn = new wxButton(panel, wxID_ANY, _("Send"));
|
||||||
chat_msg_btn->Bind(wxEVT_BUTTON, &NetPlayDiag::OnChat, this);
|
chat_msg_btn->Bind(wxEVT_BUTTON, &NetPlayDiag::OnChat, this);
|
||||||
|
@ -425,6 +426,8 @@ void NetPlayDiag::OnChat(wxCommandEvent&)
|
||||||
|
|
||||||
if (s.Length())
|
if (s.Length())
|
||||||
{
|
{
|
||||||
|
if (s.Length() > 2000)
|
||||||
|
s.erase(2000);
|
||||||
netplay_client->SendChatMessage(WxStrToStr(s));
|
netplay_client->SendChatMessage(WxStrToStr(s));
|
||||||
m_chat_text->AppendText(s.Prepend(" >> ").Append('\n'));
|
m_chat_text->AppendText(s.Prepend(" >> ").Append('\n'));
|
||||||
m_chat_msg_text->Clear();
|
m_chat_msg_text->Clear();
|
||||||
|
|
Loading…
Reference in New Issue