diff options
Diffstat (limited to 'protocols/YAMN/src/yamn.cpp')
-rw-r--r-- | protocols/YAMN/src/yamn.cpp | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/protocols/YAMN/src/yamn.cpp b/protocols/YAMN/src/yamn.cpp index 753f269d3a..e4ad646694 100644 --- a/protocols/YAMN/src/yamn.cpp +++ b/protocols/YAMN/src/yamn.cpp @@ -26,34 +26,13 @@ HANDLE ExitEV; //If this is signaled, write accounts to file is performed. Set this event if you want to actualize your accounts and messages
HANDLE WriteToFileEV;
-// Function every seconds decrements account counter of seconds and checks if they are 0
-// If yes, creates a POP3 thread to check account
-void CALLBACK TimerProc(HWND, UINT, UINT, uint32_t);
-
-// Function called to check all accounts immidialtelly
-// no params
-INT_PTR ForceCheckSvc(WPARAM, LPARAM);
-
-//thread is running all the time
-//waits for WriteToFileEV and then writes all accounts to file
-//uint32_t WINAPI FileWritingThread(PVOID);
-
// Function is called when Miranda notifies plugin that it is about to exit
// Ensures succesfull end of POP3 checking, sets event that no next checking should be performed
// If there's no writer to account (POP3 thread), saves the results to the file
-//not used now, perhaps in the future
-
-
-//int ExitProc(WPARAM wParam, LPARAM lParam);
-
-//--------------------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------------------
+// not used now, perhaps in the future
void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
- CAccount *ActualAccount;
- DWORD Status, tid;
-
// we use event to signal, that running thread has all needed stack parameters copied
HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (ThreadRunningEV == nullptr)
@@ -64,7 +43,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) return;
// Get actual status of current user in Miranda
- Status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
+ DWORD Status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
mir_cslock lck(PluginRegCS);
for (YAMN_PROTOPLUGINQUEUE *ActualPlugin = FirstProtoPlugin; ActualPlugin != nullptr; ActualPlugin = ActualPlugin->Next) {
@@ -72,7 +51,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) if (!srb.Succeeded())
return;
- for (ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) {
+ for (auto *ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) {
if (ActualAccount->Plugin == nullptr || ActualAccount->Plugin->Fcn == nullptr) //account not inited
continue;
@@ -104,6 +83,8 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_NORMALCHECK, (void *)nullptr, nullptr};
ActualAccount->TimeLeft = ActualAccount->Interval;
+
+ DWORD tid;
HANDLE NewThread = CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, &ParamToPlugin, 0, &tid);
if (NewThread == nullptr)
continue;
@@ -116,13 +97,12 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) ChangeIsCountingStatusLabel:
if (((ActualAccount->isCounting) != 0) != isAccountCounting) {
ActualAccount->isCounting = isAccountCounting;
+
uint16_t cStatus = g_plugin.getWord(ActualAccount->hContact, "Status");
switch (cStatus) {
case ID_STATUS_ONLINE:
case ID_STATUS_OFFLINE:
g_plugin.setWord(ActualAccount->hContact, "Status", isAccountCounting ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
- default:
- break;
}
}
}
@@ -132,14 +112,12 @@ ChangeIsCountingStatusLabel: INT_PTR ForceCheckSvc(WPARAM, LPARAM)
{
- CAccount *ActualAccount;
- DWORD tid;
-
- //we use event to signal, that running thread has all needed stack parameters copied
+ // 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 0;
- //if we want to close miranda, we get event and do not run pop3 checking anymore
+
+ // if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
return 0;
@@ -147,7 +125,7 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) for (YAMN_PROTOPLUGINQUEUE *ActualPlugin = FirstProtoPlugin; ActualPlugin != nullptr; ActualPlugin = ActualPlugin->Next) {
SReadGuard srb(ActualPlugin->Plugin->AccountBrowserSO);
- for (ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) {
+ for (auto *ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) {
if (ActualAccount->Plugin->Fcn == nullptr) //account not inited
continue;
@@ -159,8 +137,8 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == nullptr)
continue;
- struct CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)nullptr, nullptr };
-
+ DWORD tid;
+ CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)nullptr, nullptr };
if (nullptr == CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
continue;
|