summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon/NetPlayIndex.cpp
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2019-04-12 14:21:42 +0200
committerGitHub <noreply@github.com>2019-04-12 14:21:42 +0200
commit2a1dee4dce2e0e671d3a90f33164fc015aece7a0 (patch)
tree006dda648cd317e944d11881cc0fc10be25deee7 /Source/Core/UICommon/NetPlayIndex.cpp
parentf2e3f69d34317c7f4fc1fe4e94d470344dafd1f7 (diff)
parent8b6bb39e82b66c0faa7ac29512b3f68167874404 (diff)
Merge pull request #7976 from spycrab/netplay_index_feedback
Qt/NetPlay: Show feedback for index adding
Diffstat (limited to 'Source/Core/UICommon/NetPlayIndex.cpp')
-rw-r--r--Source/Core/UICommon/NetPlayIndex.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/Core/UICommon/NetPlayIndex.cpp b/Source/Core/UICommon/NetPlayIndex.cpp
index 9915bb311d..c6ab872b4e 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;
}
}
@@ -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;
+}