From 3d4f907c1237b1210ae75a9530a82fabda2af484 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 6 Jan 2017 23:09:58 +0300 Subject: gateway commands --- protocols/Discord/src/proto.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'protocols/Discord/src/proto.h') diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index b822bbf323..aa4e36ef1c 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -26,6 +26,15 @@ struct PARAM {} }; +struct BOOL_PARAM : public PARAM +{ + bool bValue; + __forceinline BOOL_PARAM(LPCSTR _name, bool _value) : + PARAM(_name), bValue(_value) + {} +}; +AsyncHttpRequest* operator<<(AsyncHttpRequest*, const BOOL_PARAM&); + struct INT_PARAM : public PARAM { int iValue; @@ -54,6 +63,7 @@ struct WCHAR_PARAM : public PARAM AsyncHttpRequest* operator<<(AsyncHttpRequest*, const WCHAR_PARAM&); JSONNode& operator<<(JSONNode &json, const INT_PARAM ¶m); +JSONNode& operator<<(JSONNode &json, const BOOL_PARAM ¶m); JSONNode& operator<<(JSONNode &json, const CHAR_PARAM ¶m); JSONNode& operator<<(JSONNode &json, const WCHAR_PARAM ¶m); @@ -123,10 +133,19 @@ class CDiscordProto : public PROTO HANDLE m_hGatewayNetlibUser, // the separate netlib user handle for gateways m_hGatewayConnection; // gateway connection + void __cdecl GatewayThread(void*); - void GatewaySend(int opCode, const char*); + void GatewaySend(int opCode, const JSONNode&); + void GatewayProcess(const JSONNode&); + + void GatewaySendHeartbeat(void); + void GatewaySendIdentify(void); + + void OnReceiveGateway(NETLIBHTTPREQUEST*, AsyncHttpRequest*); - void OnReceiveGateway(NETLIBHTTPREQUEST*, AsyncHttpRequest*); + int m_iHartbeatInterval; + int m_iGatewaySeq; // gateway sequence number + DWORD m_dwLastHeartbeat; ////////////////////////////////////////////////////////////////////////////////////// // options -- cgit v1.2.3