Merge pull request #7976 from spycrab/netplay_index_feedback

Qt/NetPlay: Show feedback for index adding
This commit is contained in:
spycrab
2019-04-12 14:21:42 +02:00
committed by GitHub
6 changed files with 50 additions and 1 deletions

View File

@ -142,6 +142,8 @@ void NetPlayIndex::NotificationLoop()
if (!json)
{
m_last_error = "BAD_JSON";
m_secret.clear();
m_error_callback();
return;
}
@ -150,6 +152,8 @@ void NetPlayIndex::NotificationLoop()
if (status != "OK")
{
m_last_error = std::move(status);
m_secret.clear();
m_error_callback();
return;
}
}
@ -323,3 +327,13 @@ const std::string& NetPlayIndex::GetLastError() const
{
return m_last_error;
}
bool NetPlayIndex::HasActiveSession() const
{
return !m_secret.empty();
}
void NetPlayIndex::SetErrorCallback(std::function<void()> function)
{
m_error_callback = function;
}