summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/VoiceService/src/hooks.cpp7
-rw-r--r--plugins/VoiceService/src/main.cpp2
-rw-r--r--plugins/VoiceService/src/stdafx.h16
3 files changed, 21 insertions, 4 deletions
diff --git a/plugins/VoiceService/src/hooks.cpp b/plugins/VoiceService/src/hooks.cpp
index b9c41336d6..52a8eafbda 100644
--- a/plugins/VoiceService/src/hooks.cpp
+++ b/plugins/VoiceService/src/hooks.cpp
@@ -76,8 +76,6 @@ static INT_PTR CMAnswer(WPARAM wParam, LPARAM lParam);
static INT_PTR CMHold(WPARAM wParam, LPARAM lParam);
static INT_PTR CMDrop(WPARAM wParam, LPARAM lParam);
-static VOID CALLBACK ClearOldVoiceCalls(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
-
class CallingMethod
{
public:
@@ -417,7 +415,7 @@ VoiceCall* FindVoiceCall(MCONTACT hContact)
return nullptr;
}
-static VOID CALLBACK ClearOldVoiceCalls(HWND, UINT, UINT_PTR, DWORD)
+void Timers::ClearEvents(CTimer*)
{
DWORD now = GetTickCount();
bool refresh = false;
@@ -692,7 +690,7 @@ int ModulesLoaded(WPARAM, LPARAM)
g_plugin.addSound(it.szName, LPGENW("Voice Calls"), it.wszDescr);
g_plugin.addSound("voice_dialpad", LPGENW("Voice Calls"), LPGENW("Dialpad press"));
- SetTimer(NULL, 0, 1000, ClearOldVoiceCalls);
+ g_timers.m_timer.Start(1000);
// Accounts
for (auto *pa : Accounts())
@@ -704,6 +702,7 @@ int ModulesLoaded(WPARAM, LPARAM)
int PreShutdown(WPARAM, LPARAM)
{
+ g_timers.m_timer.Stop();
DeInitFrames();
DeInitOptions();
return 0;
diff --git a/plugins/VoiceService/src/main.cpp b/plugins/VoiceService/src/main.cpp
index fd9062dfc2..d2c2f9fe1a 100644
--- a/plugins/VoiceService/src/main.cpp
+++ b/plugins/VoiceService/src/main.cpp
@@ -19,6 +19,8 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
+Timers g_timers;
+
// Prototypes ///////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfoEx =
diff --git a/plugins/VoiceService/src/stdafx.h b/plugins/VoiceService/src/stdafx.h
index 2f3cbc4f75..2787006dd0 100644
--- a/plugins/VoiceService/src/stdafx.h
+++ b/plugins/VoiceService/src/stdafx.h
@@ -65,6 +65,22 @@ using namespace std;
#include "frame.h"
#include "popup.h"
+struct Timers
+{
+ Timers() :
+ m_timer(Miranda_GetSystemWindow(), (UINT_PTR)this)
+ {
+ m_timer.OnEvent = Callback(this, &Timers::ClearEvents);
+ }
+
+ CTimer m_timer;
+ void ClearEvents(CTimer *);
+};
+
+extern Timers g_timers;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
struct CMPlugin : public PLUGIN<CMPlugin>
{
bool bFramesExist = false;