diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-07 22:57:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-07 22:57:57 +0300 |
commit | f1a204292b895a94f142c32b2f3dc69fcc053e67 (patch) | |
tree | 465127e97ce90f457c90b8cfc78ae8f0e00b5064 /protocols/Discord/src/gateway.cpp | |
parent | e012650957335d5f4295441debf849b3b9b2f4ef (diff) |
first version of Discord that sends messages, catches presence packets and displays typing notification
version bump
Diffstat (limited to 'protocols/Discord/src/gateway.cpp')
-rw-r--r-- | protocols/Discord/src/gateway.cpp | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp index b8049e3a1b..db07b18069 100644 --- a/protocols/Discord/src/gateway.cpp +++ b/protocols/Discord/src/gateway.cpp @@ -17,30 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -#pragma pack(4) - -struct CDiscordCommand -{ - const wchar_t *szCommandId; - GatewayHandlerFunc pFunc; -} -static handlers[] = // these structures must me sorted alphabetically -{ - { L"READY", &CDiscordProto::OnCommandReady } -}; - -static int __cdecl pSearchFunc(const void *p1, const void *p2) -{ - return wcscmp(((CDiscordCommand*)p1)->szCommandId, ((CDiscordCommand*)p2)->szCommandId); -} - -GatewayHandlerFunc CDiscordProto::GetHandler(const wchar_t *pwszCommand) -{ - CDiscordCommand tmp = { pwszCommand, NULL }; - CDiscordCommand *p = (CDiscordCommand*)bsearch(&tmp, handlers, _countof(handlers), sizeof(handlers[0]), pSearchFunc); - return (p != NULL) ? p->pFunc : NULL; -} - ////////////////////////////////////////////////////////////////////////////////////// // sends a piece of JSON to a server via a websocket, masked @@ -176,7 +152,7 @@ void CDiscordProto::GatewayThreadWorker() break; unsigned char buf[2048]; - int bufSize = Netlib_Recv(m_hGatewayConnection, (char*)buf + offset, _countof(buf) - offset, MSG_DUMPASTEXT); + int bufSize = Netlib_Recv(m_hGatewayConnection, (char*)buf + offset, _countof(buf) - offset, 0); if (bufSize == 0) { debugLogA("Gateway connection gracefully closed"); break; |