summaryrefslogtreecommitdiff
path: root/protocols/YAMN/src/account.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/YAMN/src/account.cpp')
-rw-r--r--protocols/YAMN/src/account.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/protocols/YAMN/src/account.cpp b/protocols/YAMN/src/account.cpp
index ef06bc78b9..7609a23e18 100644
--- a/protocols/YAMN/src/account.cpp
+++ b/protocols/YAMN/src/account.cpp
@@ -20,6 +20,35 @@ static mir_cs csFileWritingCS;
/////////////////////////////////////////////////////////////////////////////////////////
// CAccount class
+void CAccount::CheckMail()
+{
+ // we use event to signal, that running thread has all needed stack parameters copied
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
+ return;
+
+ // if we want to close miranda, we get event and do not run pop3 checking anymore
+ if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
+ return;
+
+ mir_cslock lck(PluginRegCS);
+ SReadGuard sra(AccountAccessSO, 0);
+ if (sra.Succeeded()) {
+ if ((Flags & YAMN_ACC_ENA) && Plugin->Fcn->SynchroFcnPtr) {
+ CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, this };
+
+ TimeLeft = Interval;
+ DWORD tid;
+ HANDLE NewThread = CreateThread(nullptr, 0, (YAMN_STANDARDFCN)Plugin->Fcn->SynchroFcnPtr, &ParamToPlugin, 0, &tid);
+ if (NewThread) {
+ WaitForSingleObject(ThreadRunningEV, INFINITE);
+ CloseHandle(NewThread);
+ }
+ }
+ }
+ CloseHandle(ThreadRunningEV);
+}
+
void CAccount::RefreshContact()
{
if (hContact != 0) {