summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/discord.vcxproj6
-rw-r--r--protocols/Discord/src/gateway.cpp7
-rw-r--r--protocols/Discord/src/stdafx.h2
3 files changed, 14 insertions, 1 deletions
diff --git a/protocols/Discord/discord.vcxproj b/protocols/Discord/discord.vcxproj
index a360422c31..1a76deed6c 100644
--- a/protocols/Discord/discord.vcxproj
+++ b/protocols/Discord/discord.vcxproj
@@ -30,4 +30,10 @@
<ExceptionHandling>Sync</ExceptionHandling>
</ClCompile>
</ItemDefinitionGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\libs\zlib\zlib.vcxproj">
+ <Project>{e2a369cd-eda3-414f-8ad0-e732cd7ee68c}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp
index a7352d4120..adf07eff4a 100644
--- a/protocols/Discord/src/gateway.cpp
+++ b/protocols/Discord/src/gateway.cpp
@@ -146,7 +146,7 @@ void CDiscordProto::GatewayThread(void*)
sel.dwTimeout = 1000;
sel.hReadConns[0] = m_hGatewayConnection;
if (CallService(MS_NETLIB_SELECT, 0, (LPARAM)&sel) == 0) // timeout, send a hartbeat packet
- GatewaySend(3, "{ \"op\":1, \"d\":(null) }");
+ GatewaySend(0, "{ \"op\":1, \"d\":(null) }");
unsigned char buf[2048];
int bufSize = Netlib_Recv(m_hGatewayConnection, (char*)buf+offset, _countof(buf) - offset, 0);
@@ -218,6 +218,11 @@ void CDiscordProto::GatewayThread(void*)
case 2: // continuation
if (bIsFinal) {
// process a packet here
+ z_stream stream = {};
+ stream.next_in = dataBuf + headerSize;
+ stream.avail_in = bufSize - headerSize;
+ deflate(&stream, true);
+
mir_free(dataBuf); dataBuf = NULL;
dataBufSize = 0;
}
diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h
index 43d0077d7c..b91bf0008d 100644
--- a/protocols/Discord/src/stdafx.h
+++ b/protocols/Discord/src/stdafx.h
@@ -39,6 +39,8 @@
#include <m_json.h>
#include <win2k.h>
+#include "../../libs/zlib/src/zlib.h"
+
extern HINSTANCE g_hInstance;
#include "version.h"