From 8b6bb39e82b66c0faa7ac29512b3f68167874404 Mon Sep 17 00:00:00 2001 From: spycrab Date: Thu, 11 Apr 2019 01:21:40 +0200 Subject: Qt/NetPlay: Show feedback for index adding --- Source/Core/UICommon/NetPlayIndex.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Source/Core/UICommon/NetPlayIndex.cpp') diff --git a/Source/Core/UICommon/NetPlayIndex.cpp b/Source/Core/UICommon/NetPlayIndex.cpp index 36cb103243..ab90872d47 100644 --- a/Source/Core/UICommon/NetPlayIndex.cpp +++ b/Source/Core/UICommon/NetPlayIndex.cpp @@ -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; } } @@ -318,3 +322,13 @@ const std::string& NetPlayIndex::GetLastError() const { return m_last_error; } + +bool NetPlayIndex::HasActiveSession() const +{ + return !m_secret.empty(); +} + +void NetPlayIndex::SetErrorCallback(std::function function) +{ + m_error_callback = function; +} -- cgit v1.2.3