mirror of
https://github.com/yuzu-emu/discord-rpc.git
synced 2024-11-27 22:24:22 +01:00
Make these use my helper functions
This commit is contained in:
parent
d5e6c4c11a
commit
120fe1b069
@ -36,16 +36,9 @@ void RpcConnection::Open()
|
|||||||
if (state == State::SentHandshake) {
|
if (state == State::SentHandshake) {
|
||||||
JsonDocument message;
|
JsonDocument message;
|
||||||
if (Read(message)) {
|
if (Read(message)) {
|
||||||
auto cmd = message.FindMember("cmd");
|
auto cmd = GetStrMember(&message, "cmd");
|
||||||
if (cmd == message.MemberEnd() || !cmd->value.IsString()) {
|
auto evt = GetStrMember(&message, "evt");
|
||||||
return;
|
if (cmd && evt && !strcmp(cmd, "DISPATCH") && !strcmp(evt, "READY")) {
|
||||||
}
|
|
||||||
auto evt = message.FindMember("evt");
|
|
||||||
if (evt == message.MemberEnd() || !evt->value.IsString()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strcmp(cmd->value.GetString(), "DISPATCH") &&
|
|
||||||
!strcmp(evt->value.GetString(), "READY")) {
|
|
||||||
state = State::Connected;
|
state = State::Connected;
|
||||||
if (onConnect) {
|
if (onConnect) {
|
||||||
onConnect();
|
onConnect();
|
||||||
|
Loading…
Reference in New Issue
Block a user