summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_clistint.h1
-rw-r--r--include/m_protocols.h1
-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
-rw-r--r--src/core/stdautoaway/src/autoaway.cpp5
-rw-r--r--src/mir_app/src/clc.cpp10
-rw-r--r--src/mir_app/src/clcidents.cpp23
-rw-r--r--src/mir_app/src/clisttray.cpp9
-rw-r--r--src/mir_app/src/menu_clist.cpp12
-rw-r--r--src/mir_app/src/proto_accs.cpp8
-rw-r--r--src/mir_app/src/proto_opts.cpp5
-rw-r--r--src/mir_app/src/protocols.cpp1
17 files changed, 61 insertions, 68 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h
index 594fa70546..5b98e79ca8 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -192,7 +192,6 @@ struct MenuProto
ptrA szProto;
HGENMENU pMenu;
HICON hIcon;
- int iStatus;
};
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/include/m_protocols.h b/include/m_protocols.h
index 7ae638bf58..884ca2c5c3 100644
--- a/include/m_protocols.h
+++ b/include/m_protocols.h
@@ -279,6 +279,7 @@ struct MIR_APP_EXPORT PROTOACCOUNT
char* szUniqueId; // setting's unique id for any contact in the account
int iIconBase; // index of the first icon in ClistImages
+ int iRealStatus; // last status reported by protocol
bool IsEnabled(void) const;
bool IsLocked(void) const;
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);
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp
index af0a60e441..3dda6e2d87 100644
--- a/src/core/stdautoaway/src/autoaway.cpp
+++ b/src/core/stdautoaway/src/autoaway.cpp
@@ -61,7 +61,6 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam)
if (!pa->IsEnabled() || pa->IsLocked())
continue;
- int currentstatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
int statusbits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
int status = mii.aaStatus;
if (!(statusbits & Proto_Status2Flag(status))) {
@@ -70,11 +69,11 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam)
status = ID_STATUS_AWAY;
}
if (lParam & IDF_ISIDLE) {
- if (currentstatus != ID_STATUS_ONLINE && currentstatus != ID_STATUS_FREECHAT)
+ if (pa->iRealStatus != ID_STATUS_ONLINE && pa->iRealStatus != ID_STATUS_FREECHAT)
continue;
// save old status of account and set to given status
- db_set_w(NULL, AA_MODULE, pa->szModuleName, currentstatus);
+ db_set_w(NULL, AA_MODULE, pa->szModuleName, pa->iRealStatus);
Proto_SetStatus(pa->szModuleName, status);
}
else {
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index 8c0014d50d..5b72ddb2ab 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -152,12 +152,10 @@ static int ClcProtoAck(WPARAM, LPARAM lParam)
WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0);
if (ack->result == ACKRESULT_SUCCESS) {
- for (auto &it : g_menuProtos) {
- if (!mir_strcmp(it->szProto, ack->szModule)) {
- it->iStatus = (WORD)ack->lParam;
- Clist_TrayIconUpdateBase(ack->szModule);
- break;
- }
+ PROTOACCOUNT *pa = Proto_GetAccount(ack->szModule);
+ if (pa) {
+ pa->iRealStatus = ack->lParam;
+ Clist_TrayIconUpdateBase(ack->szModule);
}
}
}
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp
index fbd5e8d245..0a56e15131 100644
--- a/src/mir_app/src/clcidents.cpp
+++ b/src/mir_app/src/clcidents.cpp
@@ -221,11 +221,9 @@ MIR_APP_DLL(HANDLE) Clist_ContactToItemHandle(ClcContact *cc, DWORD *nmFlags)
MIR_APP_DLL(int) Clist_GetRealStatus(ClcContact *cc, int iDefaultValue)
{
- char *szProto = cc->proto;
- if (szProto != nullptr)
- for (auto &it : g_menuProtos)
- if (!mir_strcmp(it->szProto, szProto))
- return it->iStatus;
+ PROTOACCOUNT *pa = Proto_GetAccount(cc->proto);
+ if (pa)
+ return pa->iRealStatus;
return iDefaultValue;
}
@@ -237,12 +235,15 @@ MIR_APP_DLL(int) Clist_GetGeneralizedStatus(char **szProto)
int status = ID_STATUS_OFFLINE;
int statusOnlineness = 0;
- for (auto &it : g_menuProtos) {
- if (it->iStatus == ID_STATUS_INVISIBLE)
+ for (auto &pa : accounts) {
+ if (!pa->IsVisible())
+ continue;
+
+ if (pa->iRealStatus == ID_STATUS_INVISIBLE)
return ID_STATUS_INVISIBLE;
int iStatusWeight;
- switch (it->iStatus) {
+ switch (pa->iRealStatus) {
case ID_STATUS_FREECHAT: iStatusWeight = 110; break;
case ID_STATUS_ONLINE: iStatusWeight = 100; break;
case ID_STATUS_OCCUPIED: iStatusWeight = 60; break;
@@ -253,14 +254,14 @@ MIR_APP_DLL(int) Clist_GetGeneralizedStatus(char **szProto)
case ID_STATUS_NA: iStatusWeight = 10; break;
case ID_STATUS_INVISIBLE: iStatusWeight = 5; break;
default:
- iStatusWeight = IsStatusConnecting(it->iStatus) ? 120 : 0;
+ iStatusWeight = IsStatusConnecting(pa->iRealStatus) ? 120 : 0;
break;
}
if (iStatusWeight > statusOnlineness) {
if (szProto != nullptr)
- *szProto = it->szProto;
- status = it->iStatus;
+ *szProto = pa->szModuleName;
+ status = pa->iRealStatus;
statusOnlineness = iStatusWeight;
}
}
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp
index 3789bd7ce3..202661df18 100644
--- a/src/mir_app/src/clisttray.cpp
+++ b/src/mir_app/src/clisttray.cpp
@@ -101,7 +101,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c
if (!pa->IsVisible())
continue;
- wchar_t *szStatus = Clist_GetStatusModeDescription(CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ wchar_t *szStatus = Clist_GetStatusModeDescription(pa->iRealStatus, 0);
if (!szStatus)
continue;
@@ -126,7 +126,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa != nullptr) {
ptrW ProtoXStatus(sttGetXStatus(szProto));
- wchar_t *szStatus = Clist_GetStatusModeDescription(CallProtoServiceInt(0, szProto, PS_GETSTATUS, 0, 0), 0);
+ wchar_t *szStatus = Clist_GetStatusModeDescription(pa->iRealStatus, 0);
if (szPrefix && szPrefix[0]) {
if (db_get_b(0, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (hasTips()) {
@@ -251,7 +251,7 @@ int fnTrayIconInit(HWND hwnd)
if (j >= 0) {
PROTOACCOUNT *pa = accounts[j];
if (pa->IsVisible())
- Clist_TrayIconAdd(hwnd, pa->szModuleName, nullptr, CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0));
+ Clist_TrayIconAdd(hwnd, pa->szModuleName, nullptr, pa->iRealStatus);
}
}
}
@@ -446,8 +446,7 @@ static VOID CALLBACK TrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD)
if (i) {
DestroyIcon(cli.trayIcon[0].hBaseIcon);
- cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(0, accounts[cli.cycleStep]->szModuleName,
- CallProtoServiceInt(0, accounts[cli.cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
+ cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(0, accounts[cli.cycleStep]->szModuleName, accounts[cli.cycleStep]->iRealStatus);
if (cli.trayIcon[0].isBase)
TrayIconUpdate(cli.trayIcon[0].hBaseIcon, nullptr, nullptr, 1);
}
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index a44c800dc2..af5047e9ba 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -479,7 +479,6 @@ static INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
pimi->mi.flags &= ~CMIF_CHECKED;
}
else if ((!smep || smep->szProto) && pimi->mi.name.a) {
- int curProtoStatus = 0;
BOOL IconNeedDestroy = FALSE;
char* prot;
if (smep)
@@ -489,14 +488,12 @@ static INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
prot = NEWSTR_ALLOCA(prn);
if (prn) mir_free(prn);
}
- if (Proto_GetAccount(prot) == nullptr)
+ PROTOACCOUNT *pa = Proto_GetAccount(prot);
+ if (pa == nullptr)
return TRUE;
- if ((curProtoStatus = CallProtoServiceInt(0, prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND)
- curProtoStatus = 0;
-
- if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
- pimi->mi.hIcolibItem = Skin_LoadProtoIcon(prot, curProtoStatus);
+ if (pa->iRealStatus >= ID_STATUS_OFFLINE && pa->iRealStatus < ID_STATUS_IDLE)
+ pimi->mi.hIcolibItem = Skin_LoadProtoIcon(prot, pa->iRealStatus);
else {
pimi->mi.hIcolibItem = (HICON)CallProtoServiceInt(0, prot, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (pimi->mi.hIcolibItem == (HICON)CALLSERVICE_NOTFOUND)
@@ -792,7 +789,6 @@ void RebuildMenuOrder(void)
pMenu->hIcon = nullptr;
pMenu->pMenu = rootmenu;
pMenu->szProto = mir_strdup(pa->szModuleName);
- pMenu->iStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
g_menuProtos.insert(pMenu);
char buf[256];
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index 1143ab5590..8343314e05 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -55,6 +55,8 @@ static int EnumDbModules(const char *szModuleName, void*)
pa->bIsVisible = true;
pa->bIsEnabled = false;
pa->iOrder = accounts.getCount();
+ pa->iIconBase = -1;
+ pa->iRealStatus = ID_STATUS_OFFLINE;
accounts.insert(pa);
}
}
@@ -77,6 +79,8 @@ void LoadDbAccounts(void)
if (pa == nullptr) {
pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
pa->szModuleName = szModuleName;
+ pa->iIconBase = -1;
+ pa->iRealStatus = ID_STATUS_OFFLINE;
accounts.insert(pa);
}
else {
@@ -312,8 +316,8 @@ MIR_APP_DLL(int) Proto_GetAverageStatus(int *pAccountNumber)
netProtoCount++;
if (averageMode == 0)
- averageMode = CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0);
- else if (averageMode > 0 && averageMode != CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0)) {
+ averageMode = pa->iRealStatus;
+ else if (averageMode > 0 && averageMode != pa->iRealStatus) {
averageMode = -1;
if (pAccountNumber == nullptr)
break;
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index 1ded064a65..87032ad73f 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -61,6 +61,8 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const ch
pa->bIsEnabled = pa->bIsVisible = true;
pa->iOrder = accounts.getCount();
pa->szProtoName = mir_strdup(pszBaseProto);
+ pa->iRealStatus = ID_STATUS_OFFLINE;
+ pa->iIconBase = -1;
// if the internal name is empty, generate new one
if (mir_strlen(pszInternal) == 0) {
@@ -456,8 +458,7 @@ public:
}
}
else {
- DWORD dwStatus = CallProtoServiceInt(0, pa->szModuleName, PS_GETSTATUS, 0, 0);
- if (dwStatus >= ID_STATUS_ONLINE) {
+ if (pa->iRealStatus >= ID_STATUS_ONLINE) {
wchar_t buf[200];
mir_snwprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
if (IDNO == ::MessageBox(m_hwnd, TranslateT("Account is online. Disable account?"), buf, MB_ICONWARNING | MB_DEFBUTTON2 | MB_YESNO))
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 7d9c992a94..0179f80bde 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -130,6 +130,7 @@ MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
pa->bIsVisible = pa->bIsEnabled = true;
pa->iOrder = accounts.getCount();
pa->iIconBase = -1;
+ pa->iRealStatus = ID_STATUS_OFFLINE;
accounts.insert(pa);
}
pa->bOldProto = true;