From 57d7aea9d038519bfa7cf38e757105d730220e37 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 14 Aug 2015 11:21:27 +0000 Subject: SkypeWeb: small fixes. git-svn-id: http://svn.miranda-ng.org/main/trunk@14952 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/main.cpp | 5 +++++ protocols/SkypeWeb/src/skype_polling.cpp | 5 ++--- protocols/SkypeWeb/src/skype_proto.cpp | 5 ----- protocols/SkypeWeb/src/skype_proto.h | 2 -- protocols/SkypeWeb/src/skype_trouter.cpp | 6 ++---- protocols/SkypeWeb/src/skype_utils.cpp | 2 +- protocols/SkypeWeb/src/stdafx.h | 1 + 7 files changed, 11 insertions(+), 15 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index a65a80bd4f..732c570d59 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -21,6 +21,7 @@ int hLangpack; HINSTANCE g_hInstance; CLIST_INTERFACE *pcli; char g_szMirVer[100]; +HANDLE g_hCallEvent; PLUGININFOEX pluginInfo = { @@ -73,6 +74,8 @@ extern "C" int __declspec(dllexport) Load(void) CreateServiceFunction(MODULE "/GetEventIcon", &CSkypeProto::EventGetIcon); CreateServiceFunction(MODULE "/GetEventText", &CSkypeProto::GetEventText); + g_hCallEvent = CreateHookableEvent(MODULE "/IncomingCall"); + HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded); return 0; @@ -83,6 +86,8 @@ extern "C" int __declspec(dllexport) Unload(void) CSkypeProto::UninitIcons(); CSkypeProto::UninitMenus(); + DestroyHookableEvent(g_hCallEvent); + return 0; } diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index b1b91a8d6f..bf2fc714ff 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -68,11 +68,11 @@ void CSkypeProto::PollingThread(void*) PollRequest *request = new PollRequest(m_szRegToken, m_szServer); request->nlc = m_pollingConnection; NLHR_PTR response(request->Send(m_hNetlibUser)); + delete request; if (response == NULL) { errors++; - delete request; continue; } @@ -98,7 +98,6 @@ void CSkypeProto::PollingThread(void*) int errorCode = error.as_int(); if (errorCode == 729) { - delete request; break; } } @@ -106,7 +105,7 @@ void CSkypeProto::PollingThread(void*) } m_pollingConnection = response->nlc; - delete request; + } if (!isTerminated) diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 39cc3d960f..731514871a 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -40,9 +40,6 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) CreateDirectoryTreeT(m_tszAvatarFolder.c_str()); - //hooks - if (!m_hCallEvent) m_hCallEvent = CreateHookableEvent(MODULE "/IncomingCall"); - //sounds SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound")); SkinAddNewSoundEx("skype_call_canceled", "SkypeWeb", LPGEN("Incoming call canceled sound")); @@ -61,8 +58,6 @@ CSkypeProto::~CSkypeProto() UninitPopups(); CloseHandle(m_hTrouterEvent); m_hTrouterEvent = NULL; - - if (m_hCallEvent && Accounts.getCount() == 0) DestroyHookableEvent(m_hCallEvent); SkypeUnsetTimer(); } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 9e70268c7c..dba8fd238e 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -103,8 +103,6 @@ private: m_TrouterConnection, m_hTrouterEvent; - static HANDLE m_hCallEvent; - TRInfo TRouter; LIST m_PopupClasses; diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 0685bb287e..55f96576f7 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -17,8 +17,6 @@ along with this program. If not, see . #include "stdafx.h" -HANDLE CSkypeProto::m_hCallEvent; - void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response) { if (response == NULL || response->pData == NULL) @@ -227,7 +225,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) INT_PTR CSkypeProto::OnIncomingCallCLE(WPARAM, LPARAM lParam) { CLISTEVENT *cle = (CLISTEVENT*)lParam; - NotifyEventHooks(m_hCallEvent, (WPARAM)cle->hContact, (LPARAM)0); + NotifyEventHooks(g_hCallEvent, (WPARAM)cle->hContact, (LPARAM)0); return 0; } @@ -244,7 +242,7 @@ INT_PTR CSkypeProto::OnIncomingCallPP(WPARAM wParam, LPARAM hContact) } if (wParam == 1) - NotifyEventHooks(m_hCallEvent, (WPARAM)hContact, (LPARAM)0); + NotifyEventHooks(g_hCallEvent, (WPARAM)hContact, (LPARAM)0); return 0; } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 756eba91d6..bfdaf2ab56 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -553,7 +553,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) else if (!mir_tstrcmpi(szCommand, _T("call"))) { MCONTACT hContact = AddContact(_T2A(szJid), true); - NotifyEventHooks(m_hCallEvent, (WPARAM)hContact, (LPARAM)0); + NotifyEventHooks(g_hCallEvent, (WPARAM)hContact, (LPARAM)0); return 0; } else if (!mir_tstrcmpi(szCommand, _T("userinfo"))){ return 0; } diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 0e8440203b..94faae7e08 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -57,6 +57,7 @@ struct CSkypeProto; extern HINSTANCE g_hInstance; extern char g_szMirVer[]; +extern HANDLE g_hCallEvent; #define SKYPE_ENDPOINTS_HOST "client-s.gateway.messenger.live.com" -- cgit v1.2.3