summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-07 18:44:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-07 18:44:31 +0300
commit5565e5b9839eea8a57e9c46f87e611dd546c8b46 (patch)
tree97156edbfa1bff3d2a8e50e8ba828aa90298eb42 /plugins
parent05e6fa41a1eb29e07060cc540fdde3ba58686f6c (diff)
status caching moved from MenuItem to PROTOACCOUNT - this is very effective
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp19
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp5
-rw-r--r--plugins/SeenPlugin/src/utils.cpp8
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp2
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp3
-rw-r--r--plugins/StatusManager/src/commonstatus.cpp6
-rw-r--r--plugins/TipperYM/src/popwin.cpp11
7 files changed, 24 insertions, 30 deletions
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index 852998e235..5fc46485f4 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -84,19 +84,19 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM, LPARAM)
int connectingCount = 0;
g_bMultiConnectionMode = false;
- for (auto &it : *pcli->menuProtos) {
- if (!Clist_GetProtocolVisibility(it->szProto))
+ for (auto &it : Accounts()) {
+ if (!it->IsVisible())
continue;
- if (IsStatusConnecting(it->iStatus)) {
+ if (IsStatusConnecting(it->iRealStatus)) {
connectingCount++;
if (connectingCount == 1)
- g_szConnectingProto = it->szProto;
+ g_szConnectingProto = it->szModuleName;
else
g_bMultiConnectionMode = true;
}
- else if (GetStatusVal(it->iStatus) > GetStatusVal(curstatus))
- curstatus = it->iStatus;
+ else if (GetStatusVal(it->iRealStatus) > GetStatusVal(curstatus))
+ curstatus = it->iRealStatus;
}
return curstatus ? curstatus : ID_STATUS_OFFLINE;
@@ -276,14 +276,13 @@ static int GetGoodAccNum(bool *bDiffers, bool *bConn = nullptr)
continue;
res++;
- int iStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
if (!iPrevStatus)
- iPrevStatus = iStatus;
- else if (iPrevStatus != iStatus)
+ iPrevStatus = pa->iRealStatus;
+ else if (iPrevStatus != pa->iRealStatus)
*bDiffers = true;
if (bConn)
- if (IsStatusConnecting(iStatus))
+ if (IsStatusConnecting(pa->iRealStatus))
*bConn = true;
}
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index 378d4a0db1..512917ed51 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -45,8 +45,6 @@ int g_maxStatus = ID_STATUS_OFFLINE;
void CluiProtocolStatusChanged(int, const char*)
{
- int maxOnline = 0;
- WORD maxStatus = ID_STATUS_OFFLINE;
DBVARIANT dbv = { 0 };
int iIcon = 0;
HICON hIcon = nullptr;
@@ -124,7 +122,7 @@ void CluiProtocolStatusChanged(int, const char*)
x += textSize.cx + GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
- wchar_t* modeDescr = Clist_GetStatusModeDescription(CallProtoService(accs[i]->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ wchar_t* modeDescr = Clist_GetStatusModeDescription(accs[i]->iRealStatus, 0);
GetTextExtentPoint32(hdc, modeDescr, (int)mir_wstrlen(modeDescr), &textSize);
x += textSize.cx + GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
@@ -156,7 +154,6 @@ void CluiProtocolStatusChanged(int, const char*)
if (!pa->IsVisible())
continue;
- int status = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
PD->RealName = mir_strdup(pa->szModuleName);
PD->protopos = partCount;
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp
index 363da08e53..3a0a2065e8 100644
--- a/plugins/SeenPlugin/src/utils.cpp
+++ b/plugins/SeenPlugin/src/utils.cpp
@@ -683,10 +683,10 @@ int ModeChange(WPARAM, LPARAM lparam)
DBWriteTimeTS(time(nullptr), NULL);
- // isetting=CallProtoService(ack->szModule,PS_GETSTATUS,0,0);
WORD isetting = (WORD)ack->lParam;
- if (isetting < ID_STATUS_OFFLINE) isetting = ID_STATUS_OFFLINE;
- if ((isetting > ID_STATUS_OFFLINE) && ((WORD)ack->hProcess <= ID_STATUS_OFFLINE)) {
+ if (isetting < ID_STATUS_OFFLINE)
+ isetting = ID_STATUS_OFFLINE;
+ if ((isetting > ID_STATUS_OFFLINE) && ((UINT_PTR)ack->hProcess <= ID_STATUS_OFFLINE)) {
//we have just loged-in
db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
if (!Miranda_IsTerminated() && IsWatchedProtocol(ack->szModule)) {
@@ -698,7 +698,7 @@ int ModeChange(WPARAM, LPARAM lparam)
mir_forkthread(cleanThread, info);
}
}
- else if ((isetting == ID_STATUS_OFFLINE) && ((WORD)ack->hProcess > ID_STATUS_OFFLINE)) {
+ else if ((isetting == ID_STATUS_OFFLINE) && ((UINT_PTR)ack->hProcess > ID_STATUS_OFFLINE)) {
//we have just loged-off
if (IsWatchedProtocol(ack->szModule)) {
char str[MAXMODULELABELLENGTH + 9];
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index 95164b9d67..e9b45a9461 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -730,7 +730,7 @@ static void CheckContinuouslyFunction(void *)
if (!IsSuitableProto(pa))
continue;
- if (IsStatusConnecting(CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0))) {
+ if (IsStatusConnecting(pa->iRealStatus)) {
log_debugA("CheckContinuouslyFunction: %s is connecting", pa->szModuleName);
continue; // connecting, leave alone
}
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index 793276ff6a..1b0cdb1de5 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -237,8 +237,7 @@ static int OnOkToExit(WPARAM, LPARAM)
if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG))
continue;
- int status = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
- if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(pa->iRealStatus)))
continue;
// NewAwaySys
diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp
index 9bcfff4d89..d928e53bde 100644
--- a/plugins/StatusManager/src/commonstatus.cpp
+++ b/plugins/StatusManager/src/commonstatus.cpp
@@ -37,7 +37,7 @@ SMProto::SMProto(PROTOACCOUNT *pa)
{
m_szName = pa->szModuleName;
m_tszAccName = pa->tszAccountName;
- m_status = m_lastStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ m_status = m_lastStatus = pa->iRealStatus;
}
SMProto::SMProto(const SMProto &p)
@@ -161,11 +161,11 @@ static int equalsGlobalStatus(PROTOCOLSETTINGEX **ps)
pstatus = GetActualStatus(ps[j]);
if (pstatus == 0)
- pstatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ pstatus = pa->iRealStatus;
if (db_get_b(0, pa->szModuleName, "LockMainStatus", 0)) {
// if proto is locked, pstatus must be the current status
- if (pstatus != CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0))
+ if (pstatus != pa->iRealStatus)
return 0;
}
else {
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp
index efd68d09c7..f3fd175d27 100644
--- a/plugins/TipperYM/src/popwin.cpp
+++ b/plugins/TipperYM/src/popwin.cpp
@@ -1459,8 +1459,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
oldOrder = pa->iOrder;
- WORD wStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
- if (opt.bHideOffline && wStatus == ID_STATUS_OFFLINE)
+ if (opt.bHideOffline && pa->iRealStatus == ID_STATUS_OFFLINE)
continue;
if (!pa->IsEnabled() || !IsTrayProto(pa->tszAccountName, (BOOL)wParam))
@@ -1483,7 +1482,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
if (pa->IsLocked())
mir_snwprintf(swzProto, TranslateT("%s (locked)"), pa->tszAccountName);
- AddRow(pwd, swzProto, buff, nullptr, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, wStatus));
+ AddRow(pwd, swzProto, buff, nullptr, false, false, !bFirstItem, true, Skin_LoadProtoIcon(pa->szModuleName, pa->iRealStatus));
bFirstItem = false;
if (dwItems & TRAYTIP_LOGON) {
@@ -1503,14 +1502,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
if (dwItems & TRAYTIP_STATUS) {
- wchar_t *swzText = Clist_GetStatusModeDescription(wStatus, 0);
+ wchar_t *swzText = Clist_GetStatusModeDescription(pa->iRealStatus, 0);
if (swzText)
AddRow(pwd, TranslateT("Status:"), swzText, nullptr, false, false, false);
}
- if (wStatus >= ID_STATUS_ONLINE && wStatus <= ID_STATUS_OUTTOLUNCH) {
+ if (pa->iRealStatus >= ID_STATUS_ONLINE && pa->iRealStatus <= ID_STATUS_OUTTOLUNCH) {
if (dwItems & TRAYTIP_STATUS_MSG) {
- wchar_t *swzText = GetProtoStatusMessage(pa->szModuleName, wStatus);
+ wchar_t *swzText = GetProtoStatusMessage(pa->szModuleName, pa->iRealStatus);
if (swzText) {
StripBBCodesInPlace(swzText);
AddRow(pwd, TranslateT("Status message:"), swzText, pa->szModuleName, true, true, false);