diff options
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; } |