summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-06 20:37:38 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-06 23:10:07 +0300
commitc6646a4fbf19011b2c1aaea49e1fa2becfe8cc7b (patch)
treedb55de4addf1b510a011690ec0787c716b5435e2 /protocols/Discord
parent50c8ace2f8329b5ac013e9fcadd1905af19fe6cd (diff)
adding zlib
Diffstat (limited to 'protocols/Discord')
-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"