diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-04 00:34:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-04 00:34:25 +0300 |
commit | ac1d88965de3022be2f484c2f58185ae75b4fe00 (patch) | |
tree | ce2e5ddf89bb9acf1f13a698d4d4a9e55d8a4520 /protocols/Discord/src/proto.cpp | |
parent | f82e226c107565f8dac8bc327b945648377c0eba (diff) |
gateway support: beginning
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 41179a5a2d..f85df56fe3 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -57,13 +57,21 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : } // Network initialization - CMStringW descr(FORMAT, TranslateT("%s server connection"), m_tszUserName); - + CMStringW descr; NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; + nlu.szSettingsModule = m_szModuleName; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; + descr.Format(TranslateT("%s server connection"), m_tszUserName); nlu.ptszDescriptiveName = descr.GetBuffer(); m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + + CMStringA module(FORMAT, "%s.Gateway", m_szModuleName); + nlu.szSettingsModule = module.GetBuffer(); + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_UNICODE; + descr.Format(TranslateT("%s gateway connection"), m_tszUserName); + nlu.ptszDescriptiveName = descr.GetBuffer(); + m_hGatewayNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); } CDiscordProto::~CDiscordProto() @@ -263,6 +271,9 @@ int CDiscordProto::OnPreShutdown(WPARAM, LPARAM) m_bTerminated = true; SetEvent(m_evRequestsQueue); + + if (m_hGatewayConnection) + Netlib_Shutdown(m_hGatewayConnection); return 0; } |