diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-08-25 22:10:39 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2020-08-25 22:10:39 -0400 |
commit | 82a21bd08558ba3e067f490525431be30f978b25 (patch) | |
tree | 5695ccc11939e0de3a0fa012e73d8071dd97ce3b /discord/discord.hpp | |
parent | 6b72931ba729bf6ede33cfa6877a5ad21e913c45 (diff) | |
download | abaddon-portaudio-82a21bd08558ba3e067f490525431be30f978b25.tar.gz abaddon-portaudio-82a21bd08558ba3e067f490525431be30f978b25.zip |
fix guild order, add copy id guild, add broken zlib, start member list
Diffstat (limited to 'discord/discord.hpp')
-rw-r--r-- | discord/discord.hpp | 17 |
1 files changed, 16 insertions, 1 deletions
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 <nlohmann/json.hpp> #include <thread> #include <unordered_map> +#include <set> #include <unordered_set> #include <mutex> +#ifdef ABADDON_USE_COMPRESSED_SOCKET + #include <zlib.h> +#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<uint8_t> m_compressed_buf; + std::vector<uint8_t> 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(); |