summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/src/tox_proto.h')
-rw-r--r--protocols/Tox/src/tox_proto.h36
1 files changed, 30 insertions, 6 deletions
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h
index 3bdd6eaaf3..1f90091503 100644
--- a/protocols/Tox/src/tox_proto.h
+++ b/protocols/Tox/src/tox_proto.h
@@ -1,7 +1,7 @@
#ifndef _TOX_PROTO_H_
#define _TOX_PROTO_H_
-struct CToxProto : public PROTO<CToxProto>
+class CToxProto : public PROTO<CToxProto>
{
friend class CToxEnterPasswordDlg;
friend class CToxCreatePasswordDlg;
@@ -9,6 +9,32 @@ struct CToxProto : public PROTO<CToxProto>
friend class CToxOptionsMain;
friend class CToxOptionsNodeList;
+ class Impl
+ {
+ friend class CToxProto;
+
+ CToxProto &m_proto;
+ CTimer timerCheck, timerPoll;
+
+ void OnCheck(CTimer *) {
+ m_proto.OnToxCheck();
+ }
+
+ void OnPoll(CTimer *) {
+ m_proto.OnToxPoll();
+ }
+
+ Impl(CToxProto &ppro) :
+ m_proto(ppro),
+ timerPoll(Miranda_GetSystemWindow(), UINT_PTR(this)),
+ timerCheck(Miranda_GetSystemWindow(), UINT_PTR(this) + 1)
+ {
+ timerPoll.OnEvent = Callback(this, &Impl::OnPoll);
+ timerCheck.OnEvent = Callback(this, &Impl::OnCheck);
+ }
+ }
+ m_impl;
+
public:
//////////////////////////////////////////////////////////////////////////////////////
// Ctors
@@ -70,9 +96,6 @@ private:
ULONG hMessageProcess;
int m_retriesCount;
- HANDLE m_hTimerQueue;
- HANDLE m_hPollingTimer;
- HANDLE m_hCheckingTimer;
static HANDLE hProfileFolderPath;
@@ -108,12 +131,13 @@ private:
// tox connection
bool IsOnline();
+ void __cdecl InitThread(void *);
void TryConnect();
void CheckConnection();
- static void __stdcall OnToxCheck(void*, uint8_t);
- static void __stdcall OnToxPoll(void*, uint8_t);
+ void OnToxCheck();
+ void OnToxPoll();
// accounts
int __cdecl OnAccountRenamed(WPARAM, LPARAM);