diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-04 15:06:19 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-04 15:06:19 +0300 |
commit | f02ba61c1480c33b801aa7f7acefac9e3735c551 (patch) | |
tree | aa44e2ccfa277bb4b877f867d035e7cabded1f83 /plugins/StatusManager/src/StartupStatus | |
parent | c257e17520118623ef8ae6ec7cf57249b4fd9ba0 (diff) |
StatusManager:
- fixes #1150 (Status Manager no longer reconnects when connection breaks);
- hopefully also fixes #1139 (KeepStatus: option "Reconnect on APM resume" don't work);
- removed major clutch with assigning "" to a protocol name to disable it in the confirmdialog;
- another ancient evil destroyed that tried to save 4 bytes of memory by storing temporary status values in the main status field in AAA;
- version bump
Diffstat (limited to 'plugins/StatusManager/src/StartupStatus')
-rw-r--r-- | plugins/StatusManager/src/StartupStatus/startupstatus.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp index 0c44c09a9c..ab82c229db 100644 --- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp +++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp @@ -38,7 +38,7 @@ static BYTE showDialogOnStartup = 0; static PROTOCOLSETTINGEX* IsValidProtocol(TProtoSettings &protoSettings, const char *protoName) { for (auto &it : protoSettings) - if (!strncmp(it->m_szName, protoName, mir_strlen(it->m_szName))) + if (!it->ssDisabled && !strncmp(it->m_szName, protoName, mir_strlen(it->m_szName))) return it; return nullptr; @@ -143,7 +143,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam) for (auto &it : protoList) { if (!mir_strcmp(ack->szModule, it->m_szName)) { - it->m_szName = ""; + it->ssDisabled = true; log_debugA("StartupStatus: %s overridden by ME_PROTO_ACK, status will not be set", ack->szModule); } } @@ -160,14 +160,14 @@ static int StatusChange(WPARAM, LPARAM lParam) char *szProto = (char *)lParam; if (szProto == nullptr) { // global status change for (auto &it : protoList) { - it->m_szName = ""; + it->ssDisabled = true; log_debugA("StartupStatus: all protos overridden by ME_CLIST_STATUSMODECHANGE, status will not be set"); } } else { for (auto &it : protoList) { if (!mir_strcmp(it->m_szName, szProto)) { - it->m_szName = ""; + it->ssDisabled = true; log_debugA("StartupStatus: %s overridden by ME_CLIST_STATUSMODECHANGE, status will not be set", szProto); } } @@ -188,14 +188,13 @@ static int CSStatusChangeEx(WPARAM wParam, LPARAM) return -1; for (int i = 0; i < protoList.getCount(); i++) { - for (int j = 0; j < protoList.getCount(); j++) { - if (ps[i]->m_szName == nullptr || protoList[j].m_szName == nullptr) + for (auto &it : protoList) { + if (ps[i]->m_szName == nullptr || it->m_szName == nullptr) continue; - if (!mir_strcmp(ps[i]->m_szName, protoList[j].m_szName)) { + if (!mir_strcmp(ps[i]->m_szName, it->m_szName)) { log_debugA("StartupStatus: %s overridden by MS_CS_SETSTATUSEX, status will not be set", ps[i]->m_szName); - // use a hack to disable this proto - protoList[j].m_szName = ""; + it->ssDisabled = true; } } } @@ -210,7 +209,13 @@ static void CALLBACK SetStatusTimed(HWND, UINT, UINT_PTR, DWORD) UnhookEvent(hProtoAckHook); UnhookEvent(hCSStatusChangeHook); UnhookEvent(hStatusChangeHook); - CallService(MS_CS_SETSTATUSEX, (WPARAM)&protoList, 0); + + TProtoSettings ps(protoList); + for (auto &it : ps) + if (it->ssDisabled) + it->m_status = ID_STATUS_DISABLED; + + CallService(MS_CS_SETSTATUSEX, (WPARAM)ps.getArray(), 0); } static int OnOkToExit(WPARAM, LPARAM) |