summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/gateway.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-03-21 13:26:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-03-21 13:26:12 +0300
commit368611ceedca2c4c37e435ee2da34775eaf06109 (patch)
tree8b96f11af067da368a8186ff739a4dac7f4b28be /protocols/Discord/src/gateway.cpp
parentce09a6d8185f0d9ee8c2b67969aed25e5a29eebe (diff)
Discord: fixes N/A status restoration after login
Diffstat (limited to 'protocols/Discord/src/gateway.cpp')
-rw-r--r--protocols/Discord/src/gateway.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp
index cfb6d82c17..a8a0ca4efa 100644
--- a/protocols/Discord/src/gateway.cpp
+++ b/protocols/Discord/src/gateway.cpp
@@ -20,14 +20,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////////////
// sends a piece of JSON to a server via a websocket, masked
-void CDiscordProto::GatewaySend(const JSONNode &pRoot)
+bool CDiscordProto::GatewaySend(const JSONNode &pRoot)
{
if (m_hGatewayConnection == nullptr)
- return;
+ return false;
json_string szText = pRoot.write();
debugLogA("Gateway send: %s", szText.c_str());
WebSocket_Send(m_hGatewayConnection, szText.c_str(), szText.length());
+ return true;
}
//////////////////////////////////////////////////////////////////////////////////////
@@ -311,11 +312,11 @@ void CDiscordProto::GatewaySendResume()
GatewaySend(root);
}
-void CDiscordProto::GatewaySendStatus(int iStatus, const wchar_t *pwszStatusText)
+bool CDiscordProto::GatewaySendStatus(int iStatus, const wchar_t *pwszStatusText)
{
if (iStatus == ID_STATUS_OFFLINE) {
Push(new AsyncHttpRequest(this, REQUEST_POST, "/auth/logout", nullptr));
- return;
+ return true;
}
const char *pszStatus;
@@ -341,5 +342,5 @@ void CDiscordProto::GatewaySendStatus(int iStatus, const wchar_t *pwszStatusText
}
JSONNode root; root << INT_PARAM("op", OPCODE_STATUS_UPDATE) << payload;
- GatewaySend(root);
+ return GatewaySend(root);
}