dolphin/Source/Core/UICommon/DiscordPresence.h

40 lines
1.0 KiB
C
Raw Normal View History

2018-05-26 22:24:13 -06:00
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
2018-07-03 15:50:08 -06:00
#include <functional>
2018-05-26 22:24:13 -06:00
namespace Discord
{
2018-07-03 15:50:08 -06:00
using JoinFunction = std::function<void()>;
using JoinRequestFunction =
std::function<void(const char* id, const std::string& discord_tag, const char* avatar)>;
2018-07-03 15:50:08 -06:00
class Handler
{
public:
virtual ~Handler();
virtual void DiscordJoin() = 0;
virtual void DiscordJoinRequest(const char* id, const std::string& discord_tag,
const char* avatar) = 0;
};
enum class SecretType
2018-07-03 15:50:08 -06:00
{
Empty,
IPAddress,
RoomID,
};
2018-05-26 22:24:13 -06:00
void Init();
void InitNetPlayFunctionality(Handler& handler);
2018-07-03 15:50:08 -06:00
void CallPendingCallbacks();
void UpdateDiscordPresence(int party_size = 0, SecretType type = SecretType::Empty,
const std::string& secret = {}, const std::string& current_game = {});
std::string CreateSecretFromIPAddress(const std::string& ip_address, int port);
2018-05-26 22:24:13 -06:00
void Shutdown();
void SetDiscordPresenceEnabled(bool enabled);
2018-05-26 22:24:13 -06:00
} // namespace Discord