summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-03 16:30:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-03 16:30:25 +0300
commit9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch)
treef8fe94a3efe7598a2af926f264d354f7a08fb943 /plugins/StatusManager/src/KeepStatus/keepstatus.cpp
parent2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff)
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/StatusManager/src/KeepStatus/keepstatus.cpp')
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index 0d70c4d010..bb58b27323 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -726,27 +726,25 @@ static void CheckContinuouslyFunction(void *)
if (((!ping) && (!InternetGetConnectedState(nullptr, 0))) || ((ping) && (!bLastPingResult) && (pingFailures >= db_get_w(0, KSMODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT)))) {
pingFailures = 0;
- int count;
- PROTOACCOUNT** protos;
- Proto_EnumAccounts(&count, &protos);
-
- for (int i = 0; i < count; i++) {
- if (!IsSuitableProto(protos[i]))
+ for (auto &pa : Accounts()) {
+ if (!IsSuitableProto(pa))
continue;
- if (IsStatusConnecting(CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0))) {
- log_debugA("CheckContinuouslyFunction: %s is connecting", protos[i]->szModuleName);
+ if (IsStatusConnecting(CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0))) {
+ log_debugA("CheckContinuouslyFunction: %s is connecting", pa->szModuleName);
continue; // connecting, leave alone
}
- if (IsProtocolEnabledService(0, (LPARAM)protos[i]->szModuleName)) {
- log_debugA("CheckContinuouslyFunction: forcing %s offline", protos[i]->szModuleName);
- CallProtoService(protos[i]->szModuleName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0);
+ if (IsProtocolEnabledService(0, (LPARAM)pa->szModuleName)) {
+ log_debugA("CheckContinuouslyFunction: forcing %s offline", pa->szModuleName);
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0);
}
}
+
if (StartTimer(IDT_CHECKCONN | IDT_PROCESSACK, -1, FALSE)) {// are our 'set offlines' noticed?
log_debugA("CheckContinuouslyFunction: currently checking");
return;
}
+
log_infoA("KeepStatus: connection lost! (continuesly check)");
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOST, 0);
ProcessPopup(KS_CONN_STATE_LOST, 0);