From 82a21bd08558ba3e067f490525431be30f978b25 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 25 Aug 2020 22:10:39 -0400 Subject: fix guild order, add copy id guild, add broken zlib, start member list --- discord/discord.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'discord/discord.hpp') diff --git a/discord/discord.hpp b/discord/discord.hpp index ab390dc..3a98b40 100644 --- a/discord/discord.hpp +++ b/discord/discord.hpp @@ -4,8 +4,12 @@ #include #include #include +#include #include #include +#ifdef ABADDON_USE_COMPRESSED_SOCKET + #include +#endif // bruh #ifdef GetMessage @@ -372,7 +376,11 @@ class DiscordClient { friend class Abaddon; public: +#ifdef ABADDON_USE_COMPRESSED_SOCKET + static const constexpr char *DiscordGateway = "wss://gateway.discord.gg/?v=6&encoding=json&compress=zlib-stream"; +#else static const constexpr char *DiscordGateway = "wss://gateway.discord.gg/?v=6&encoding=json"; +#endif static const constexpr char *DiscordAPI = "https://discord.com/api"; static const constexpr char *GatewayIdentity = "Discord"; @@ -400,7 +408,14 @@ public: void UpdateToken(std::string token); private: - void HandleGatewayMessage(nlohmann::json msg); +#ifdef ABADDON_USE_COMPRESSED_SOCKET + static const constexpr int InflateChunkSize = 0x10000; + std::vector m_compressed_buf; + std::vector m_decompress_buf; +#endif + std::string DecompressGatewayMessage(std::string str); + void HandleGatewayMessageRaw(std::string str); + void HandleGatewayMessage(std::string str); void HandleGatewayReady(const GatewayMessage &msg); void HandleGatewayMessageCreate(const GatewayMessage &msg); void HeartbeatThread(); -- cgit v1.2.3