summaryrefslogtreecommitdiff
path: root/plugins/StatusManager
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-04 15:34:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-04 15:34:41 +0300
commitad28480e2efbe5f2ae573f22a28433147f48bf81 (patch)
treee7069faa76995a096df42d3050939de2310cbb5e /plugins/StatusManager
parentf02ba61c1480c33b801aa7f7acefac9e3735c551 (diff)
code cleaning
Diffstat (limited to 'plugins/StatusManager')
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp2
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp30
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_profiles.cpp8
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp2
4 files changed, 21 insertions, 21 deletions
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
index 80f3d8be37..96213f8cc7 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
@@ -317,7 +317,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
}
if (confirm || statusChanged) {
- TProtoSettings ps = protoList; // make a copy of data not to pollute main array
+ TProtoSettings ps(protoList); // make a copy of data not to pollute main array
for (auto &it : ps)
it->m_status = it->aaaStatus;
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index ceb12f56d4..32aef32206 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -199,7 +199,7 @@ static int SetCurrentStatus()
}
}
ProcessPopup(KS_CONN_STATE_RETRY, (LPARAM)ps.getArray());
- return CallService(MS_CS_SETSTATUSEX, (WPARAM)ps.getArray(), 0);
+ return CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0);
}
static int StatusChange(WPARAM wParam, LPARAM lParam)
@@ -822,25 +822,25 @@ static int ProcessPopup(int reason, LPARAM lParam)
if (lParam) {
PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX **)lParam;
- wchar_t protoInfoLine[512], protoInfo[MAX_SECONDLINE];
- memset(protoInfoLine, '\0', sizeof(protoInfoLine));
- memset(protoInfo, '\0', sizeof(protoInfo));
- mir_wstrcpy(protoInfo, L"\r\n");
+
+ CMStringW wszProtoInfo(L"\r\n");
for (int i = 0; i < protoList.getCount(); i++) {
- if (mir_wstrlen(ps[i]->m_tszAccName) > 0 && mir_strlen(ps[i]->m_szName) > 0) {
- if (db_get_b(0, KSMODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
- mir_snwprintf(protoInfoLine, TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->m_tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->m_status, 0));
- mir_wstrncat(protoInfo, protoInfoLine, _countof(protoInfo) - mir_wstrlen(protoInfo) - 1);
- }
- }
+ PROTOCOLSETTINGEX *p = ps[i];
+ if (p->m_status == ID_STATUS_DISABLED)
+ continue;
+
+ if (mir_wstrlen(p->m_tszAccName) > 0)
+ if (db_get_b(0, KSMODULENAME, SETTING_PUSHOWEXTRA, TRUE))
+ wszProtoInfo.AppendFormat(TranslateT("%s\t(will be set to %s)\r\n"), p->m_tszAccName, pcli->pfnGetStatusModeDescription(p->m_status, 0));
}
+
hIcon = Skin_LoadProtoIcon(ps[0]->m_szName, SKINICON_STATUS_OFFLINE);
+ wszProtoInfo.TrimRight();
- rtrimw(protoInfo);
- if (retryCount == (maxRetries - 1))
- mir_snwprintf(text, TranslateT("Resetting status... (last try (%d))%s"), retryCount + 1, protoInfo);
+ if (retryCount == maxRetries - 1)
+ mir_snwprintf(text, TranslateT("Resetting status... (last try (%d))%s"), retryCount + 1, wszProtoInfo.c_str());
else
- mir_snwprintf(text, TranslateT("Resetting status... (next retry (%d) in %d s)%s"), retryCount + 2, currentDelay / 1000, protoInfo);
+ mir_snwprintf(text, TranslateT("Resetting status... (next retry (%d) in %d s)%s"), retryCount + 2, currentDelay / 1000, wszProtoInfo.c_str());
}
break;
diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
index 608cface96..2aba9ad8d8 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
@@ -197,16 +197,16 @@ INT_PTR LoadAndSetProfile(WPARAM iProfileNo, LPARAM)
{
// wParam == profile no.
int profile = (int)iProfileNo;
- TProtoSettings profileSettings = protoList;
- if (!GetProfile(profile, profileSettings)) {
+ TProtoSettings ps(protoList);
+ if (!GetProfile(profile, ps)) {
profile = (profile >= 0) ? profile : db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
char setting[64];
mir_snprintf(setting, "%d_%s", profile, SETTING_SHOWCONFIRMDIALOG);
if (!db_get_b(0, SSMODULENAME, setting, 0))
- CallService(MS_CS_SETSTATUSEX, (WPARAM)&profileSettings, 0);
+ CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0);
else
- ShowConfirmDialogEx((TProtoSettings*)&profileSettings, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
+ ShowConfirmDialogEx(&ps, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
}
// add timer here
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index ab82c229db..2a72f80300 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -215,7 +215,7 @@ static void CALLBACK SetStatusTimed(HWND, UINT, UINT_PTR, DWORD)
if (it->ssDisabled)
it->m_status = ID_STATUS_DISABLED;
- CallService(MS_CS_SETSTATUSEX, (WPARAM)ps.getArray(), 0);
+ CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0);
}
static int OnOkToExit(WPARAM, LPARAM)