summaryrefslogtreecommitdiff
path: root/plugins/StatusManager
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-07 20:14:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-07 20:14:21 +0300
commitf60c78abfbd5f279b30de729046b805bba8e00b0 (patch)
tree1120bba828b2151604e98163aa7a3fe221264068 /plugins/StatusManager
parent26a653ecae7edbeefb7966e08714e152c73b78eb (diff)
Proto_GetStatus is used everywhere instead of PS_GETSTATUS
Diffstat (limited to 'plugins/StatusManager')
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp16
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp14
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp2
-rw-r--r--plugins/StatusManager/src/commonstatus.cpp7
-rw-r--r--plugins/StatusManager/src/confirmdialog.cpp6
5 files changed, 23 insertions, 22 deletions
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
index 96213f8cc7..5ca571ec9d 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
@@ -222,7 +222,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
int sts1Time = it->awayTime * SECS_PER_MINUTE;
int sts2Time = it->naTime * SECS_PER_MINUTE;
int sts1setTime = it->sts1setTimer == 0 ? 0 : (GetTickCount() - it->sts1setTimer) / 1000;
- int currentMode = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ int currentMode = Proto_GetStatus(it->m_szName);
if (it->optionFlags & FLAG_ONSAVER)
bTrigger |= IsScreenSaverRunning();
@@ -235,7 +235,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
if (it->curState == ACTIVE) {
if (((mouseStationaryTimer >= sts1Time && (it->optionFlags & FLAG_ONMOUSE)) || bTrigger) && currentMode != it->lv1Status && it->statusFlags&StatusModeToProtoFlag(currentMode)) {
/* from ACTIVE to STATUS1_SET */
- it->m_lastStatus = it->originalStatusMode = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = it->originalStatusMode = Proto_GetStatus(it->m_szName);
it->aaaStatus = it->lv1Status;
it->sts1setTimer = GetTickCount();
sts1setTime = 0;
@@ -244,7 +244,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
}
else if (mouseStationaryTimer >= sts2Time && currentMode == it->lv1Status && currentMode != it->lv2Status && (it->optionFlags & FLAG_SETNA) && (it->statusFlags & StatusModeToProtoFlag(currentMode))) {
/* from ACTIVE to STATUS2_SET */
- it->m_lastStatus = it->originalStatusMode = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = it->originalStatusMode = Proto_GetStatus(it->m_szName);
it->aaaStatus = it->lv2Status;
it->bStatusChanged = statusChanged = true;
changeState(*it, STATUS2_SET);
@@ -255,7 +255,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
if ((mouseStationaryTimer < sts1Time && !bTrigger) && !(it->optionFlags & FLAG_RESET)) {
/* from STATUS1_SET to HIDDEN_ACTIVE */
changeState(*it, HIDDEN_ACTIVE);
- it->m_lastStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = Proto_GetStatus(it->m_szName);
}
else if (((mouseStationaryTimer < sts1Time) && !bTrigger) &&
((it->optionFlags & FLAG_LV2ONINACTIVE) || (!(it->optionFlags&FLAG_SETNA))) &&
@@ -266,7 +266,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
else if ((it->optionFlags & FLAG_SETNA) && sts1setTime >= sts2Time) {
/* when set STATUS2, currentMode doesn't have to be in the selected status list (statusFlags) */
/* from STATUS1_SET to STATUS2_SET */
- it->m_lastStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = Proto_GetStatus(it->m_szName);
it->aaaStatus = it->lv2Status;
it->bStatusChanged = statusChanged = true;
changeState(*it, STATUS2_SET);
@@ -282,7 +282,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
/* from STATUS2_SET to HIDDEN_ACTIVE */
/* Remember: after status1 is set, and "only on inactive" is NOT set, it implies !reset. */
changeState(*it, HIDDEN_ACTIVE);
- it->m_lastStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = Proto_GetStatus(it->m_szName);
}
}
@@ -298,7 +298,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
currentMode != it->lv2Status && (it->statusFlags & StatusModeToProtoFlag(currentMode)) &&
(mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(it->optionFlags & FLAG_LV2ONINACTIVE)))) {
/* HIDDEN_ACTIVE to STATUS2_SET */
- it->m_lastStatus = it->originalStatusMode = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = it->originalStatusMode = Proto_GetStatus(it->m_szName);
it->aaaStatus = it->lv2Status;
it->bStatusChanged = statusChanged = true;
changeState(*it, STATUS2_SET);
@@ -306,7 +306,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD)
}
if (it->curState == SET_ORGSTATUS) {
/* SET_ORGSTATUS to ACTIVE */
- it->m_lastStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ it->m_lastStatus = Proto_GetStatus(it->m_szName);
it->aaaStatus = it->originalStatusMode;
confirm = (it->optionFlags & FLAG_CONFIRM) ? TRUE : confirm;
it->bStatusChanged = statusChanged = true;
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index e9b45a9461..1b13ad2dfc 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -168,7 +168,7 @@ int SMProto::GetStatus() const
{
switch (m_status) {
case ID_STATUS_CURRENT:
- return CallProtoService(m_szName, PS_GETSTATUS, 0, 0);
+ return Proto_GetStatus(m_szName);
case ID_STATUS_LAST:
return m_lastStatus;
default:
@@ -180,7 +180,7 @@ static int SetCurrentStatus()
{
TProtoSettings ps(protoList);
for (auto &p : ps) {
- int realStatus = CallProtoService(p->m_szName, PS_GETSTATUS, 0, 0);
+ int realStatus = Proto_GetStatus(p->m_szName);
int curStatus = p->GetStatus();
if (curStatus == ID_STATUS_DISABLED)
continue;
@@ -523,7 +523,7 @@ static VOID CALLBACK CheckAckStatusTimer(HWND, UINT, UINT_PTR, DWORD)
StopTimer(IDT_PROCESSACK);
for (auto &it : protoList) {
int curStatus = it->GetStatus();
- int newStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ int newStatus = Proto_GetStatus(it->m_szName);
// ok, np
if (curStatus == ID_STATUS_CURRENT || curStatus == ID_STATUS_DISABLED || curStatus == newStatus || newStatus > MAX_STATUS)
continue;
@@ -558,7 +558,7 @@ static VOID CALLBACK CheckConnectionTimer(HWND, UINT, UINT_PTR, DWORD)
bool setStatus = false;
for (auto &it : protoList) {
- int realStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ int realStatus = Proto_GetStatus(it->m_szName);
int shouldBeStatus = it->GetStatus();
if (shouldBeStatus == ID_STATUS_LAST)
shouldBeStatus = it->m_lastStatus;
@@ -601,7 +601,7 @@ static int StopChecking()
BOOL isOk = TRUE;
for (auto &it : protoList) {
int curStatus = it->GetStatus();
- int newStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ int newStatus = Proto_GetStatus(it->m_szName);
if (newStatus != curStatus) {
it->AssignStatus(newStatus);
isOk = FALSE;
@@ -626,7 +626,7 @@ static VOID CALLBACK AfterCheckTimer(HWND, UINT, UINT_PTR, DWORD)
bool setStatus = false;
for (auto &it : protoList) {
- int realStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0);
+ int realStatus = Proto_GetStatus(it->m_szName);
int shouldBeStatus = it->GetStatus();
if (shouldBeStatus == ID_STATUS_LAST) // this should never happen
shouldBeStatus = it->m_lastStatus;
@@ -953,7 +953,7 @@ INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam)
for (auto &it : protoList) {
if (!mir_strcmp(szProto, it->m_szName)) {
if (wParam)
- it->AssignStatus(CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0));
+ it->AssignStatus(Proto_GetStatus(it->m_szName));
else
it->AssignStatus(ID_STATUS_DISABLED);
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index 1b0cdb1de5..6eb6bb820a 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -230,7 +230,7 @@ static int OnOkToExit(WPARAM, LPARAM)
char lastName[128], lastMsg[128];
mir_snprintf(lastName, "%s%s", PREFIX_LAST, pa->szModuleName);
- db_set_w(0, SSMODULENAME, lastName, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
+ db_set_w(0, SSMODULENAME, lastName, pa->iRealStatus);
mir_snprintf(lastMsg, "%s%s", PREFIX_LASTMSG, pa->szModuleName);
db_unset(0, SSMODULENAME, lastMsg);
diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp
index d928e53bde..13e7108af6 100644
--- a/plugins/StatusManager/src/commonstatus.cpp
+++ b/plugins/StatusManager/src/commonstatus.cpp
@@ -117,12 +117,13 @@ int GetActualStatus(PROTOCOLSETTINGEX *protoSetting)
{
if (protoSetting->m_status == ID_STATUS_LAST) {
if ((protoSetting->m_lastStatus < MIN_STATUS) || (protoSetting->m_lastStatus > MAX_STATUS))
- return CallProtoService(protoSetting->m_szName, PS_GETSTATUS, 0, 0);
+ return Proto_GetStatus(protoSetting->m_szName);
+
return protoSetting->m_lastStatus;
}
if (protoSetting->m_status == ID_STATUS_CURRENT)
- return CallProtoService(protoSetting->m_szName, PS_GETSTATUS, 0, 0);
+ return Proto_GetStatus(protoSetting->m_szName);
if ((protoSetting->m_status < ID_STATUS_OFFLINE) || (protoSetting->m_status > ID_STATUS_OUTTOLUNCH)) {
log_debugA("invalid status detected: %d", protoSetting->m_status);
@@ -243,7 +244,7 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM)
log_debugA("CommonStatus: incorrect status for %s (%d)", p->m_szName, p->m_status);
continue;
}
- int oldstatus = CallProtoService(p->m_szName, PS_GETSTATUS, 0, 0);
+ int oldstatus = Proto_GetStatus(p->m_szName);
// set last status
p->m_lastStatus = oldstatus;
if (IsStatusConnecting(oldstatus)) {
diff --git a/plugins/StatusManager/src/confirmdialog.cpp b/plugins/StatusManager/src/confirmdialog.cpp
index f0bed4fa15..a833408839 100644
--- a/plugins/StatusManager/src/confirmdialog.cpp
+++ b/plugins/StatusManager/src/confirmdialog.cpp
@@ -120,7 +120,7 @@ static int SetStatusList(HWND hwndDlg)
int actualStatus;
switch (it->m_status) {
case ID_STATUS_LAST: actualStatus = it->m_lastStatus; break;
- case ID_STATUS_CURRENT: actualStatus = CallProtoService(it->m_szName, PS_GETSTATUS, 0, 0); break;
+ case ID_STATUS_CURRENT: actualStatus = Proto_GetStatus(it->m_szName); break;
default: actualStatus = it->m_status;
}
wchar_t *status = Clist_GetStatusModeDescription(actualStatus, 0);
@@ -272,7 +272,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
// CURRENT STATUS
else if (proto->m_status == ID_STATUS_CURRENT) {
- int currentStatus = CallProtoService(proto->m_szName, PS_GETSTATUS, 0, 0);
+ int currentStatus = Proto_GetStatus(proto->m_szName);
wchar_t current[80];
mir_snwprintf(current, L"%s (%s)", TranslateT("<current>"), Clist_GetStatusModeDescription(currentStatus, 0));
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, current);
@@ -349,7 +349,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
// current
- int currentStatus = CallProtoService(proto->m_szName, PS_GETSTATUS, 0, 0);
+ int currentStatus = Proto_GetStatus(proto->m_szName);
mir_snwprintf(buf, L"%s (%s)", TranslateT("<current>"), Clist_GetStatusModeDescription(currentStatus, 0));
item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_CURRENT);