diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-03 13:37:13 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-03 13:37:13 +0300 |
commit | 66b61f42871089f3962920924f9030cd6dff2ad8 (patch) | |
tree | bfa19d1db1c84a841dd1e6ea258ae1d9212d2ada /plugins | |
parent | dfe4c13573386072b6fcf177e8f52fafc81891f1 (diff) |
CLIST_INTERFACE:
- unused members removed (requires new History++ for people who compile Miranda themselves);
- useless helpers Proto_IsAccountEnabled & Proto_IsProtocolLocked replaced with direct calls of PROTOACCOUNT members IsEnabled & IsLocked respectively;
- static interface member pfnGetProtocolVisibility replaced with static function Clist_GetProtocolVisibility or PROTOACCOUNT::IsVisible when possible
Diffstat (limited to 'plugins')
23 files changed, 267 insertions, 237 deletions
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index fdd5c6dafc..479dfd3fed 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -84,7 +84,7 @@ bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) Proto_EnumAccounts(&iRealAccCount, &pAccounts);
for (int i = 0; i < iRealAccCount; i++) {
- if (!Proto_IsAccountEnabled(pAccounts[i]))
+ if (!pAccounts[i]->IsEnabled())
continue;
DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
@@ -113,7 +113,7 @@ bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) HDC hdc = GetDC(hdlg);
SelectObject(hdc, (HFONT)SendDlgItemMessage(hdlg, IDC_PROTO, WM_GETFONT, 0, 0));
for (int i = 0; i < iRealAccCount; i++) {
- if (!Proto_IsAccountEnabled(pAccounts[i])) continue;
+ if (!pAccounts[i]->IsEnabled()) continue;
DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(dwCaps & PF1_BASICSEARCH) && !(dwCaps & PF1_EXTSEARCH) && !(dwCaps & PF1_SEARCHBYEMAIL) && !(dwCaps & PF1_SEARCHBYNAME))
continue;
diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index ea7a8cc5db..9c80075431 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -79,7 +79,7 @@ static int OnAccListChanged(WPARAM, LPARAM) Proto_EnumAccounts(&iRealAccCount, &pAccounts);
for (int i = 0; i < iRealAccCount; i++) {
- if (!Proto_IsAccountEnabled(pAccounts[i]))
+ if (!pAccounts[i]->IsEnabled())
continue;
DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 71214413a2..f390b3463f 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -26,7 +26,7 @@ Avatar History Plugin bool ProtocolEnabled(const char *proto)
{
- return Proto_IsAccountEnabled(Proto_GetAccount(proto));
+ return Proto_GetAccount(proto)->IsEnabled();
}
bool ContactEnabled(MCONTACT hContact, char *setting, int def)
diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index 43af2f4867..05423af61c 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -94,7 +94,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP PROTOACCOUNT **accs;
Proto_EnumAccounts(&count, &accs);
for (int i = 0; i < count; i++) {
- if (!Proto_IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
+ if (!accs[i]->IsEnabled() || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
continue;
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 3ec5ff83e4..56b9b2ace6 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -470,14 +470,14 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar static int _GetNetVisibleProtoCount()
{
- int i, count, netProtoCount;
+ int count, netProtoCount;
PROTOACCOUNT **accs;
Proto_EnumAccounts(&count, &accs);
- for (i = 0, netProtoCount = 0; i < count; i++) {
- if (pcli->pfnGetProtocolVisibility(accs[i]->szModuleName) == 0)
- continue;
- netProtoCount++;
- }
+
+ for (int i = 0, netProtoCount = 0; i < count; i++)
+ if (accs[i]->IsVisible())
+ netProtoCount++;
+
return netProtoCount;
}
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index cc56258329..49d924a24b 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -90,7 +90,7 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM, LPARAM) int connectingCount = 0;
for (int i = 0; i < pcli->hClcProtoCount; i++) {
ClcProtoStatus &p = pcli->clcProto[i];
- if (!pcli->pfnGetProtocolVisibility(p.szProto))
+ if (!Clist_GetProtocolVisibility(p.szProto))
continue;
if (IsStatusConnecting(p.dwStatus)) {
@@ -285,7 +285,7 @@ static int GetGoodAccNum(bool *bDiffers, bool *bConn = nullptr) int iPrevStatus = 0, res = 0;
while (AccNum--) {
PROTOACCOUNT *pa = acc[AccNum];
- if (!pcli->pfnGetProtocolVisibility(pa->szModuleName))
+ if (!pa->IsVisible())
continue;
res++;
@@ -379,7 +379,7 @@ int cliTrayIconInit(HWND hwnd) for (int i = AccNum; i--;) {
PROTOACCOUNT *pa = acc[i];
- if (pcli->pfnGetProtocolVisibility(pa->szModuleName) && pa->ppro != nullptr)
+ if (pa->IsVisible() && pa->ppro != nullptr)
pcli->pfnTrayIconAdd(hwnd, pa->szModuleName, nullptr, pa->ppro->m_iStatus);
}
break;
@@ -396,7 +396,7 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) if (!pcli->trayIconCount)
return -1;
- if (!pcli->pfnGetProtocolVisibility(szChangedProto))
+ if (!Clist_GetProtocolVisibility(szChangedProto))
return -1;
bool bDiffers, bConn;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 1ebb35d4e7..7763e5c34a 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1058,7 +1058,7 @@ void CLUI_DisconnectAll() Proto_EnumAccounts(&nProtoCount, &accs);
for (int nProto = 0; nProto < nProtoCount; nProto++)
- if (Proto_IsAccountEnabled(accs[nProto]))
+ if (accs[nProto]->IsEnabled())
CallProtoService(accs[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 678faaa1cd..ccb7808d7b 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -179,10 +179,10 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if (i == -1)
continue;
- char *szProto = accs[i]->szModuleName;
- if (!pcli->pfnGetProtocolVisibility(szProto))
+ if (!accs[i]->IsVisible())
continue;
+ char *szProto = accs[i]->szModuleName;
char buf[256];
mir_snprintf(buf, "SBarAccountIsCustom_%s", szProto);
diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index 19a31cd3c7..d713c58080 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -93,7 +93,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP PROTOACCOUNT **accs;
Proto_EnumAccounts(&count, &accs);
for (int i = 0; i < count; i++) {
- if (!Proto_IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
+ if (!accs[i]->IsEnabled() || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
continue;
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index c58002ab00..bf76dfffae 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -263,7 +263,7 @@ static void InitIcoLib() int p_count = 0; Proto_EnumAccounts(&p_count, &accs); for (int k = 0; k < p_count; k++) { - if (!Proto_IsAccountEnabled(accs[k]) || CallProtoService(accs[k]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) + if (!accs[k]->IsEnabled() || CallProtoService(accs[k]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) continue; wchar_t szDescr[128]; diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 4d81e16761..2e84ed6039 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -79,12 +79,12 @@ void CluiProtocolStatusChanged(int, const char*) rc.right -= borders[0] * 2;
int toshow = 0;
for (int i = 0; i < protoCount; i++)
- if (pcli->pfnGetProtocolVisibility(accs[i]->szModuleName))
+ if (accs[i]->IsVisible())
toshow++;
if (toshow > 0) {
for (int part = 0, i = 0; i < protoCount; i++) {
- if (!pcli->pfnGetProtocolVisibility(accs[i]->szModuleName))
+ if (!accs[i]->IsVisible())
continue;
partWidths[part] = ((rc.right - rc.left - rdelta) / toshow)*(part + 1) + cfg::dat.bCLeft;
@@ -112,7 +112,7 @@ void CluiProtocolStatusChanged(int, const char*) continue;
PROTOACCOUNT *pa = accs[idx];
- if (!pcli->pfnGetProtocolVisibility(pa->szModuleName))
+ if (!pa->IsVisible())
continue;
int x = 2;
@@ -157,7 +157,7 @@ void CluiProtocolStatusChanged(int, const char*) continue;
PROTOACCOUNT *pa = accs[idx];
- if (!pcli->pfnGetProtocolVisibility(pa->szModuleName))
+ if (!pa->IsVisible())
continue;
int status = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index d77853da59..f3c32a4037 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -303,7 +303,7 @@ static void GetProtocolStrings(CMStringW &buffer) for (int i = 0; i < protoCountMy; i++)
if (!mir_strcmp(protoListMy[i], accList[j]->szProtoName)) {
protos[i].nloaded = accList[j]->bDynDisabled != 0;
- if (Proto_IsAccountEnabled(accList[j]))
+ if (accList[j]->IsEnabled())
++protos[i].countse;
else
++protos[i].countsd;
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index cc855a2cfc..e54b484de5 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -495,7 +495,7 @@ int GetContactName(MCONTACT hContact, const char *proto, wchar_t *value, int max else mir_wstrncpy(value, name, maxlen);
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (!Proto_IsAccountEnabled(pa)) {
+ if (!pa->IsEnabled()) {
mir_wstrncat(value, L" ", maxlen);
mir_wstrncat(value, TranslateT("[UNLOADED]"), maxlen);
}
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 067857dd7b..1637f3223e 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -814,8 +814,8 @@ static int BuildMenu(WPARAM wparam, LPARAM) }
else Menu_ShowItem(hmenuProto, false);
- Menu_ShowItem(hmenuAdded, (bShowAll || (flags & VF_ADD)) && bIsOnline && Proto_IsAccountEnabled(pa));
- Menu_ShowItem(hmenuAuthReq, (bShowAll || (flags & VF_REQ)) && bIsOnline && Proto_IsAccountEnabled(pa));
+ Menu_ShowItem(hmenuAdded, (bShowAll || (flags & VF_ADD)) && bIsOnline && pa->IsEnabled());
+ Menu_ShowItem(hmenuAuthReq, (bShowAll || (flags & VF_REQ)) && bIsOnline && pa->IsEnabled());
bEnabled = bShowAll || (flags & VF_CID);
Menu_ShowItem(hmenuCopyID, bEnabled);
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 7345ebb3e0..46660e1545 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1140,7 +1140,7 @@ int ModulesLoaded(WPARAM, LPARAM) PROTOACCOUNT **accounts = nullptr;
Proto_EnumAccounts(&count, &accounts);
for (int i = 0; i < count; i++)
- if (Proto_IsAccountEnabled(accounts[i]))
+ if (accounts[i]->IsEnabled())
db_set_b(NULL, MODULE, accounts[i]->szModuleName, 0);
return 0;
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 81406f3ed8..cbebb2bcf2 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -499,7 +499,7 @@ int RefreshAccountList(WPARAM, LPARAM) ssSMSSettings.ppaSMSAccounts = (PROTOACCOUNT**)MEMALLOC((dwAccCount*sizeof(LPVOID)));
if (ssSMSSettings.ppaSMSAccounts)
for (int i = 0; i < dwAccCount; i++)
- if (Proto_IsAccountEnabled(ppaAccounts[i]))
+ if (ppaAccounts[i]->IsEnabled())
if (ProtoServiceExists(ppaAccounts[i]->szModuleName, MS_ICQ_SENDSMS))
ssSMSSettings.ppaSMSAccounts[dwSMSAccountsCount++] = ppaAccounts[i];
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 0a9807348d..5782e39cb2 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -460,22 +460,23 @@ void SaveMessageToDB(const char *szProto, wchar_t *tszMsg, BOOL bIsFormat) {
for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(szSetting, bIsFormat ? "FCur%sMsg" : "Cur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, bIsFormat ? "FCur%sMsg" : "Cur%sMsg", pa->szModuleName);
DBWriteMessage(szSetting, tszMsg);
#ifdef _DEBUG
if (bIsFormat)
- log2file("SaveMessageToDB(): Set \"%S\" status message (without inserted vars) for %s.", tszMsg, accounts->pa[i]->szModuleName);
+ log2file("SaveMessageToDB(): Set \"%S\" status message (without inserted vars) for %s.", tszMsg, pa->szModuleName);
else
- log2file("SaveMessageToDB(): Set \"%S\" status message for %s.", tszMsg, accounts->pa[i]->szModuleName);
+ log2file("SaveMessageToDB(): Set \"%S\" status message for %s.", tszMsg, pa->szModuleName);
#endif
}
}
@@ -655,43 +656,44 @@ INT_PTR SetStatusModeFromExtern(WPARAM wParam, LPARAM lParam) for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
continue;
if (wParam == ID_STATUS_CURRENT || wParam == 0)
- newStatus = GetCurrentStatus(accounts->pa[i]->szModuleName);
+ newStatus = GetCurrentStatus(pa->szModuleName);
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
- CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, newStatus, 0);
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, newStatus, 0);
continue;
}
- int status_modes_msg = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ int status_modes_msg = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
if ((Proto_Status2Flag(newStatus) & status_modes_msg) || (newStatus == ID_STATUS_OFFLINE && (Proto_Status2Flag(ID_STATUS_INVISIBLE) & status_modes_msg)))
{
wchar_t *msg = nullptr;
- if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, GetCurrentStatus(accounts->pa[i]->szModuleName), newStatus))
+ if (HasProtoStaticStatusMsg(pa->szModuleName, GetCurrentStatus(pa->szModuleName), newStatus))
continue;
if (lParam)
- msg = InsertVarsIntoMsg((wchar_t *)lParam, accounts->pa[i]->szModuleName, newStatus, NULL);
+ msg = InsertVarsIntoMsg((wchar_t *)lParam, pa->szModuleName, newStatus, NULL);
- SaveMessageToDB(accounts->pa[i]->szModuleName, (wchar_t *)lParam, TRUE);
- SaveMessageToDB(accounts->pa[i]->szModuleName, msg, FALSE);
- Proto_SetStatus(accounts->pa[i]->szModuleName, GetCurrentStatus(accounts->pa[i]->szModuleName), newStatus, msg /*? msg : L""*/);
+ SaveMessageToDB(pa->szModuleName, (wchar_t *)lParam, TRUE);
+ SaveMessageToDB(pa->szModuleName, msg, FALSE);
+ Proto_SetStatus(pa->szModuleName, GetCurrentStatus(pa->szModuleName), newStatus, msg /*? msg : L""*/);
mir_free(msg);
}
else
- CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, newStatus, 0);
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, newStatus, 0);
}
return 0;
@@ -712,19 +714,20 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wcha int status;
for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- status = iStatus == ID_STATUS_CURRENT ? GetStartupStatus(accounts->pa[i]->szModuleName) : iStatus;
+ status = iStatus == ID_STATUS_CURRENT ? GetStartupStatus(pa->szModuleName) : iStatus;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) ||
- !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) ||
+ !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
- if (!(bOnStartup && status == ID_STATUS_OFFLINE) && GetCurrentStatus(accounts->pa[i]->szModuleName) != status)
- CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, (WPARAM)status, 0);
+ if (!(bOnStartup && status == ID_STATUS_OFFLINE) && GetCurrentStatus(pa->szModuleName) != status)
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, (WPARAM)status, 0);
}
}
}
@@ -749,59 +752,60 @@ void SetStatusMessage(const char *szProto, int iInitialStatus, int iStatus, wcha for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (!bOnStartup && db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (!bOnStartup && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
continue;
if (iProfileStatus)
{
int iProfileNumber = iStatus - 40083;
char szSetting[128];
- mir_snprintf(szSetting, "%d_%s", iProfileNumber, accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "%d_%s", iProfileNumber, pa->szModuleName);
iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
if (iStatus == ID_STATUS_IDLE) // the same as ID_STATUS_LAST in StartupStatus
{
- mir_snprintf(szSetting, "last_%s", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "last_%s", pa->szModuleName);
iStatus = db_get_w(NULL, "StartupStatus", szSetting, ID_STATUS_OFFLINE);
}
else if (iStatus == ID_STATUS_CURRENT)
- iStatus = GetCurrentStatus(accounts->pa[i]->szModuleName);
+ iStatus = GetCurrentStatus(pa->szModuleName);
}
if (bIsStatusCurrent)
- iStatus = bOnStartup ? GetStartupStatus(accounts->pa[i]->szModuleName) : GetCurrentStatus(accounts->pa[i]->szModuleName);
+ iStatus = bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName);
if (bIsInitialStatusCurrent)
- iInitialStatus = bOnStartup ? ID_STATUS_OFFLINE : GetCurrentStatus(accounts->pa[i]->szModuleName);
+ iInitialStatus = bOnStartup ? ID_STATUS_OFFLINE : GetCurrentStatus(pa->szModuleName);
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
- !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
+ !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
- if (!(bOnStartup && iStatus == ID_STATUS_OFFLINE) && GetCurrentStatus(accounts->pa[i]->szModuleName) != iStatus && iStatus != iInitialStatus)
+ if (!(bOnStartup && iStatus == ID_STATUS_OFFLINE) && GetCurrentStatus(pa->szModuleName) != iStatus && iStatus != iInitialStatus)
{
- CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, (WPARAM)iStatus, 0);
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, (WPARAM)iStatus, 0);
#ifdef _DEBUG
- log2file("SetStatusMessage(): Set %s status for %s.", StatusModeToDbSetting(iStatus, ""), accounts->pa[i]->szModuleName);
+ log2file("SetStatusMessage(): Set %s status for %s.", StatusModeToDbSetting(iStatus, ""), pa->szModuleName);
#endif
}
continue;
}
- if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, iInitialStatus, iStatus))
+ if (HasProtoStaticStatusMsg(pa->szModuleName, iInitialStatus, iStatus))
continue;
if (message)
- msg = InsertVarsIntoMsg(message, accounts->pa[i]->szModuleName, iStatus, NULL);
+ msg = InsertVarsIntoMsg(message, pa->szModuleName, iStatus, NULL);
- SaveMessageToDB(accounts->pa[i]->szModuleName, message, TRUE);
- SaveMessageToDB(accounts->pa[i]->szModuleName, msg, FALSE);
+ SaveMessageToDB(pa->szModuleName, message, TRUE);
+ SaveMessageToDB(pa->szModuleName, msg, FALSE);
- Proto_SetStatus(accounts->pa[i]->szModuleName, iInitialStatus, iStatus, msg);
+ Proto_SetStatus(pa->szModuleName, iInitialStatus, iStatus, msg);
mir_free(msg);
}
@@ -833,18 +837,19 @@ INT_PTR ShowStatusMessageDialogInternal(WPARAM, LPARAM lParam) {
for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- box_data->m_szProto = accounts->pa[i]->szModuleName;
- box_data->m_iStatusModes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
- box_data->m_iStatusMsgModes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ box_data->m_szProto = pa->szModuleName;
+ box_data->m_iStatusModes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
+ box_data->m_iStatusMsgModes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
break;
}
}
@@ -852,23 +857,24 @@ INT_PTR ShowStatusMessageDialogInternal(WPARAM, LPARAM lParam) {
for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- if (!accounts->pa[i]->bIsVisible)
+ if (!pa->bIsVisible)
continue;
if (hProtoStatusMenuItem[i] == (HANDLE)lParam)
{
- box_data->m_szProto = accounts->pa[i]->szModuleName;
- box_data->m_iStatusModes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
- box_data->m_iStatusMsgModes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ box_data->m_szProto = pa->szModuleName;
+ box_data->m_iStatusModes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
+ box_data->m_iStatusMsgModes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
idvstatusmsg = TRUE;
break;
@@ -902,23 +908,24 @@ INT_PTR ShowStatusMessageDialog(WPARAM, LPARAM lParam) for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- if (!accounts->pa[i]->bIsVisible)
+ if (!pa->bIsVisible)
continue;
- if (!mir_strcmp(accounts->pa[i]->szModuleName, (char *)lParam))
+ if (!mir_strcmp(pa->szModuleName, (char *)lParam))
{
- box_data->m_szProto = accounts->pa[i]->szModuleName;
- box_data->m_iStatusModes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
- box_data->m_iStatusMsgModes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ box_data->m_szProto = pa->szModuleName;
+ box_data->m_iStatusModes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
+ box_data->m_iStatusMsgModes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
idvstatusmsg = TRUE;
break;
@@ -958,18 +965,19 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) if (accounts->statusMsgCount == 1 && !szProto) {
for (int i = 0; i < accounts->count; ++i) {
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- szProto = accounts->pa[i]->szModuleName;
+ szProto = pa->szModuleName;
if (bOnStartup && iStatus == ID_STATUS_CURRENT) {
- iStatus = GetStartupStatus(accounts->pa[i]->szModuleName);
+ iStatus = GetStartupStatus(pa->szModuleName);
bGlobalStartupStatus = FALSE;
}
break;
@@ -1058,30 +1066,31 @@ int ChangeStatusMessage(WPARAM wParam, LPARAM lParam) int iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", "ProtoFlags", PROTO_DEFAULT);
if (!bShowDlg || bScreenSaverRunning || (iProtoFlags & PROTO_NOCHANGE && !bOnStartup)) {
for (int i = 0; i < accounts->count; ++i) {
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
- !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus)) ||
+ !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
wchar_t *msg;
if (iProtoFlags & PROTO_NOCHANGE) {
- mir_snprintf(szSetting, "FCur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "FCur%sMsg", pa->szModuleName);
msg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
}
else
msg = GetAwayMessageFormat(iStatus, nullptr);
#ifdef _DEBUG
- log2file("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, accounts->pa[i]->szModuleName);
+ log2file("ChangeStatusMessage(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), msg, pa->szModuleName);
#endif
- SetStatusMessage(accounts->pa[i]->szModuleName, iStatus, iStatus, msg, FALSE);
+ SetStatusMessage(pa->szModuleName, iStatus, iStatus, msg, FALSE);
if (msg)
mir_free(msg);
}
@@ -1133,49 +1142,51 @@ int SetStartupStatus(int i) {
char szSetting[80];
wchar_t *fmsg, *msg = nullptr;
- int iStatus = GetStartupStatus(accounts->pa[i]->szModuleName);
+
+ auto *pa = accounts->pa[i];
+ int iStatus = GetStartupStatus(pa->szModuleName);
if (iStatus == ID_STATUS_OFFLINE)
return -1;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) ||
- !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) ||
+ !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
- CallProtoService(accounts->pa[i]->szModuleName, PS_SETSTATUS, (WPARAM)iStatus, 0);
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, (WPARAM)iStatus, 0);
return -1;
}
- mir_snprintf(szSetting, "Proto%sFlags", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
int flags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT);
if (flags & PROTO_NO_MSG || flags & PROTO_THIS_MSG)
{
- if (HasProtoStaticStatusMsg(accounts->pa[i]->szModuleName, ID_STATUS_OFFLINE, iStatus))
+ if (HasProtoStaticStatusMsg(pa->szModuleName, ID_STATUS_OFFLINE, iStatus))
return 0;
else
fmsg = nullptr;
}
else if (flags & PROTO_NOCHANGE)
{
- mir_snprintf(szSetting, "FCur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "FCur%sMsg", pa->szModuleName);
fmsg = db_get_wsa(NULL, "SimpleStatusMsg", szSetting);
}
else
- fmsg = GetAwayMessageFormat(iStatus, accounts->pa[i]->szModuleName);
+ fmsg = GetAwayMessageFormat(iStatus, pa->szModuleName);
#ifdef _DEBUG
- log2file("SetStartupStatus(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), fmsg, accounts->pa[i]->szModuleName);
+ log2file("SetStartupStatus(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iStatus, ""), fmsg, pa->szModuleName);
#endif
if (fmsg)
- msg = InsertVarsIntoMsg(fmsg, accounts->pa[i]->szModuleName, iStatus, NULL);
+ msg = InsertVarsIntoMsg(fmsg, pa->szModuleName, iStatus, NULL);
- SaveMessageToDB(accounts->pa[i]->szModuleName, fmsg, TRUE);
- SaveMessageToDB(accounts->pa[i]->szModuleName, msg, FALSE);
+ SaveMessageToDB(pa->szModuleName, fmsg, TRUE);
+ SaveMessageToDB(pa->szModuleName, msg, FALSE);
if (fmsg)
mir_free(fmsg);
- Proto_SetStatus(accounts->pa[i]->szModuleName, ID_STATUS_OFFLINE, iStatus, msg /*? msg : L""*/);
+ Proto_SetStatus(pa->szModuleName, ID_STATUS_OFFLINE, iStatus, msg /*? msg : L""*/);
mir_free(msg);
return 0;
@@ -1191,13 +1202,14 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) // is global status mode going to be set?
for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- status_mode = GetStartupStatus(accounts->pa[i]->szModuleName);
+ status_mode = GetStartupStatus(pa->szModuleName);
if (status_mode != ID_STATUS_OFFLINE)
temp_status_mode = status_mode;
@@ -1226,10 +1238,11 @@ VOID CALLBACK SetStartupStatusGlobal(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
SetStartupStatus(i);
@@ -1243,10 +1256,11 @@ VOID CALLBACK SetStartupStatusProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) for (; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
if (g_uSetStatusTimer[i] == idEvent)
@@ -1279,28 +1293,29 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- iCurrentStatus = CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0);
+ iCurrentStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
if (iCurrentStatus < ID_STATUS_ONLINE)
continue;
- mir_snprintf(szBuffer, "FCur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szBuffer, "FCur%sMsg", pa->szModuleName);
wchar_t *tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szBuffer);
if (tszStatusMsg == nullptr)
continue;
- tszMsg = InsertVarsIntoMsg(tszStatusMsg, accounts->pa[i]->szModuleName, iCurrentStatus, NULL);
+ tszMsg = InsertVarsIntoMsg(tszStatusMsg, pa->szModuleName, iCurrentStatus, NULL);
mir_free(tszStatusMsg);
- mir_snprintf(szBuffer, "Cur%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(szBuffer, "Cur%sMsg", pa->szModuleName);
tszStatusMsg = db_get_wsa(NULL, "SimpleStatusMsg", szBuffer);
if ((tszMsg && tszStatusMsg && !mir_wstrcmp(tszMsg, tszStatusMsg)) || (!tszMsg && !tszStatusMsg))
@@ -1315,10 +1330,10 @@ VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD) if (tszMsg && mir_wstrlen(tszMsg))
{
#ifdef _DEBUG
- log2file("UpdateMsgTimerProc(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iCurrentStatus, ""), tszMsg, accounts->pa[i]->szModuleName);
+ log2file("UpdateMsgTimerProc(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iCurrentStatus, ""), tszMsg, pa->szModuleName);
#endif
- Proto_SetStatus(accounts->pa[i]->szModuleName, iCurrentStatus, iCurrentStatus, tszMsg);
- SaveMessageToDB(accounts->pa[i]->szModuleName, tszMsg, FALSE);
+ Proto_SetStatus(pa->szModuleName, iCurrentStatus, iCurrentStatus, tszMsg);
+ SaveMessageToDB(pa->szModuleName, tszMsg, FALSE);
}
mir_free(tszMsg);
}
@@ -1363,7 +1378,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) hProtoStatusMenuItem = (HANDLE *)mir_realloc(hProtoStatusMenuItem, sizeof(HANDLE) * count);
for (int i = 0; i < count; ++i)
{
- if (!Proto_IsAccountEnabled(pa[i]))
+ if (!pa[i]->IsEnabled())
continue;
if (CallProtoService(pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)
@@ -1393,7 +1408,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) for (int i = 0; i < count; ++i)
{
- if (!Proto_IsAccountEnabled(pa[i]))
+ if (!pa[i]->IsEnabled())
continue;
if (!CallProtoService(pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
@@ -1411,7 +1426,7 @@ static int ChangeStatusMsgPrebuild(WPARAM, LPARAM) if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG)
continue;
- if (Proto_IsAccountLocked(pa[i]))
+ if (pa[i]->IsLocked())
{
wchar_t szBuffer[256];
mir_snwprintf(szBuffer, TranslateT("%s (locked)"), pa[i]->tszAccountName);
@@ -1446,13 +1461,14 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (db_get_b(NULL, accounts->pa[i]->szModuleName, "LockMainStatus", 0))
+ if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0))
continue;
- int iStatusBits = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ int iStatusBits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
int iStatus = mii.aaStatus;
if (!(iStatusBits & Proto_Status2Flag(iStatus)))
{
@@ -1462,20 +1478,20 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) continue;
}
- int iCurrentStatus = CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0);
+ int iCurrentStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
if (iCurrentStatus < ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_INVISIBLE)
continue;
- if ((lParam & IDF_ISIDLE && (db_get_b(NULL, "AutoAway", accounts->pa[i]->szModuleName, 0) ||
+ if ((lParam & IDF_ISIDLE && (db_get_b(NULL, "AutoAway", pa->szModuleName, 0) ||
iCurrentStatus == ID_STATUS_ONLINE || iCurrentStatus == ID_STATUS_FREECHAT)) ||
(!(lParam & IDF_ISIDLE) && !mii.aaLock))
{
if (!(lParam & IDF_ISIDLE))
iStatus = ID_STATUS_ONLINE;
- wchar_t *tszMsg = GetAwayMessage(iStatus, accounts->pa[i]->szModuleName, FALSE, NULL);
- wchar_t *tszVarsMsg = InsertVarsIntoMsg(tszMsg, accounts->pa[i]->szModuleName, iStatus, NULL);
- SaveMessageToDB(accounts->pa[i]->szModuleName, tszMsg, TRUE);
- SaveMessageToDB(accounts->pa[i]->szModuleName, tszVarsMsg, FALSE);
+ wchar_t *tszMsg = GetAwayMessage(iStatus, pa->szModuleName, FALSE, NULL);
+ wchar_t *tszVarsMsg = InsertVarsIntoMsg(tszMsg, pa->szModuleName, iStatus, NULL);
+ SaveMessageToDB(pa->szModuleName, tszMsg, TRUE);
+ SaveMessageToDB(pa->szModuleName, tszVarsMsg, FALSE);
mir_free(tszMsg);
mir_free(tszVarsMsg);
}
@@ -1646,23 +1662,24 @@ static int OnAccListChanged(WPARAM, LPARAM) Proto_EnumAccounts(&accounts->count, &accounts->pa);
for (int i = 0; i < accounts->count; ++i) {
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!mir_strcmp(accounts->pa[i]->szProtoName, "ICQ"))
- HookProtoEvent(accounts->pa[i]->szModuleName, ME_ICQ_STATUSMSGREQ, OnICQStatusMsgRequest);
+ if (!mir_strcmp(pa->szProtoName, "ICQ"))
+ HookProtoEvent(pa->szModuleName, ME_ICQ_STATUSMSGREQ, OnICQStatusMsgRequest);
- accounts->statusFlags |= (CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0));
+ accounts->statusFlags |= (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0));
- if (CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))
+ if (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0))
accounts->statusCount++;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- accounts->statusMsgFlags |= CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3,0);
+ accounts->statusMsgFlags |= CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3,0);
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
accounts->statusMsgCount++;
@@ -1729,14 +1746,15 @@ static int OnModulesLoaded(WPARAM, LPARAM) else {
g_uSetStatusTimer = (UINT_PTR *)mir_alloc(sizeof(UINT_PTR) * accounts->count);
for (int i = 0; i < accounts->count; ++i) {
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
char szSetting[80];
- mir_snprintf(szSetting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Set%sStatusDelay", pa->szModuleName);
g_uSetStatusTimer[i] = SetTimer(nullptr, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), SetStartupStatusProc);
}
}
@@ -1751,14 +1769,15 @@ static int OnOkToExit(WPARAM, LPARAM) char szSetting[80];
for (int i = 0; i < accounts->count; ++i) {
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- mir_snprintf(szSetting, "Last%sStatus", accounts->pa[i]->szModuleName);
- db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(accounts->pa[i]->szModuleName, PS_GETSTATUS, 0, 0));
+ mir_snprintf(szSetting, "Last%sStatus", pa->szModuleName);
+ db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
}
if (g_ptszWinampSong && mir_wstrcmp(g_ptszWinampSong, L"SimpleStatusMsg") /*&& db_get_b(NULL, "SimpleStatusMsg", "AmpLeaveTitle", 1)*/)
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index d4d6232f16..cab220a553 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -644,16 +644,17 @@ void ClearHistory(struct MsgBoxData *data, int cur_sel) } db_set_s(NULL, "SimpleStatusMsg", "LastMsg", ""); for (i = 0; i < accounts->count; i++) { - if (!Proto_IsAccountEnabled(accounts->pa[i])) + auto *pa = accounts->pa[i]; + if (!pa->IsEnabled()) continue; - if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) + if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) + if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; - mir_snprintf(buff2, "Last%sMsg", accounts->pa[i]->szModuleName); + mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); db_set_s(NULL, "SimpleStatusMsg", buff2, ""); } db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)data->max_hist_msgs); @@ -1136,23 +1137,24 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA else { db_set_s(NULL, "SimpleStatusMsg", "LastMsg", ""); for (int j = 0; j < accounts->count; j++) { - if (!Proto_IsAccountEnabled(accounts->pa[j])) + auto *pa = accounts->pa[j]; + if (!pa->IsEnabled()) continue; - if (!CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) + if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0)) + if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) continue; - if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) + if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; - mir_snprintf(szSetting, "Last%sMsg", accounts->pa[j]->szModuleName); + mir_snprintf(szSetting, "Last%sMsg", pa->szModuleName); db_set_s(NULL, "SimpleStatusMsg", szSetting, ""); - mir_snprintf(szSetting, "%sMsg", accounts->pa[j]->szModuleName); - iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName); + mir_snprintf(szSetting, "%sMsg", pa->szModuleName); + iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, szSetting), L""); } @@ -1186,23 +1188,24 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA else { db_set_s(NULL, "SimpleStatusMsg", "LastMsg", buff); for (int j = 0; j < accounts->count; j++) { - if (!Proto_IsAccountEnabled(accounts->pa[j])) + auto *pa = accounts->pa[j]; + if (!pa->IsEnabled()) continue; - if (!CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) + if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0)) + if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) continue; - if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) + if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; - mir_snprintf(buff2, "Last%sMsg", accounts->pa[j]->szModuleName); + mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); db_set_s(NULL, "SimpleStatusMsg", buff2, buff); - mir_snprintf(buff2, "%sMsg", accounts->pa[j]->szModuleName); - iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName); + mir_snprintf(buff2, "%sMsg", pa->szModuleName); + iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); } } @@ -1234,23 +1237,24 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA else { db_set_s(NULL, "SimpleStatusMsg", "LastMsg", buff); for (int j = 0; j < accounts->count; j++) { - if (!Proto_IsAccountEnabled(accounts->pa[j])) + auto *pa = accounts->pa[j]; + if (!pa->IsEnabled()) continue; - if (!CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) + if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)) continue; - if (db_get_b(NULL, accounts->pa[j]->szModuleName, "LockMainStatus", 0)) + if (db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0)) continue; - if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) + if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)) continue; - mir_snprintf(buff2, "Last%sMsg", accounts->pa[j]->szModuleName); + mir_snprintf(buff2, "Last%sMsg", pa->szModuleName); db_set_s(NULL, "SimpleStatusMsg", buff2, buff); - mir_snprintf(buff2, "%sMsg", accounts->pa[j]->szModuleName); - iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(accounts->pa[j]->szModuleName) : GetCurrentStatus(accounts->pa[j]->szModuleName); + mir_snprintf(buff2, "%sMsg", pa->szModuleName); + iStatus = msgbox_data->m_bOnStartup ? GetStartupStatus(pa->szModuleName) : GetCurrentStatus(pa->szModuleName); db_set_ws(NULL, "SRAway", StatusModeToDbSetting(iStatus, buff2), tszMsg); } } diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 8bc927a164..22dcf788f7 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -143,13 +143,14 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (j = 0; j < accounts->count; j++)
{
- if (!Proto_IsAccountEnabled(accounts->pa[j]) || !CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ auto *pa = accounts->pa[j];
+ if (!pa->IsEnabled() || !CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(setting, "%sFlags", accounts->pa[j]->szModuleName);
+ mir_snprintf(setting, "%sFlags", pa->szModuleName);
val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, setting), STATUS_DEFAULT);
data->status_msg[j+1].flags[i-ID_STATUS_ONLINE] = val;
- mir_snprintf(setting, "%sDefault", accounts->pa[j]->szModuleName);
+ mir_snprintf(setting, "%sDefault", pa->szModuleName);
text = db_get_wsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
mir_wstrncpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
}
@@ -190,26 +191,27 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i])
- || !CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)
- || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled()
+ || !CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0)
+ || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
{
data->proto_msg[i+1].msg = nullptr;
continue;
}
- index = SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_ADDSTRING, 0, (LPARAM)accounts->pa[i]->tszAccountName);
+ index = SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_ADDSTRING, 0, (LPARAM)pa->tszAccountName);
// SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, index, (LPARAM)i + 1);
if (index != CB_ERR && index != CB_ERRSPACE)
{
- mir_snprintf(setting, "Proto%sDefault", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Proto%sDefault", pa->szModuleName);
data->proto_msg[i+1].msg = db_get_wsa(NULL, "SimpleStatusMsg", setting);
- mir_snprintf(setting, "Proto%sFlags", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Proto%sFlags", pa->szModuleName);
val = db_get_b(NULL, "SimpleStatusMsg", setting, PROTO_DEFAULT);
data->proto_msg[i+1].flags = val;
- mir_snprintf(setting, "Proto%sMaxLen", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Proto%sMaxLen", pa->szModuleName);
val = db_get_w(NULL, "SimpleStatusMsg", setting, 1024);
data->proto_msg[i+1].max_length = val;
SendDlgItemMessage(hwndDlg, IDC_CBOPTPROTO, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i + 1);
@@ -918,7 +920,8 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (int k = 0; k < accounts->count; k++)
{
- if (!Proto_IsAccountEnabled(accounts->pa[k]) || !CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ auto *pa = accounts->pa[k];
+ if (!pa->IsEnabled() || !CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
if (k != j - 1)
@@ -953,7 +956,7 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l {
for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
{
- if (CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
+ if (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
{
data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
@@ -1004,18 +1007,19 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (int j = 0; j < accounts->count; j++)
{
- if (!Proto_IsAccountEnabled(accounts->pa[j]))
+ auto *pa = accounts->pa[j];
+ if (!pa->IsEnabled())
continue;
- if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
+ if (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
{
- mir_snprintf(szSetting, "%sDefault", accounts->pa[j]->szModuleName);
+ mir_snprintf(szSetting, "%sDefault", pa->szModuleName);
db_set_ws(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
- mir_snprintf(szSetting, "%sFlags", accounts->pa[j]->szModuleName);
+ mir_snprintf(szSetting, "%sFlags", pa->szModuleName);
db_set_b(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
@@ -1030,25 +1034,26 @@ INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l for (int i = 0; i < accounts->count; i++)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
- mir_snprintf(szSetting, "Proto%sDefault", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sDefault", pa->szModuleName);
if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
db_set_ws(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
// else
// db_unset(NULL, "SimpleStatusMsg", szSetting);
- mir_snprintf(szSetting, "Proto%sMaxLen", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sMaxLen", pa->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
- mir_snprintf(szSetting, "Proto%sFlags", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Proto%sFlags", pa->szModuleName);
db_set_b(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
}
}
@@ -1336,17 +1341,18 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w db_set_s(NULL, "SimpleStatusMsg", "LastMsg", "");
for (int i = 0; i < accounts->count; i++) {
- if (!Proto_IsAccountEnabled(accounts->pa[i]))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled())
continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ if (!CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
continue;
char setting[80];
- mir_snprintf(setting, "Last%sMsg", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Last%sMsg", pa->szModuleName);
db_set_s(NULL, "SimpleStatusMsg", setting, "");
}
db_set_w(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
@@ -1433,16 +1439,17 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa data->setdelay = (int *)mir_alloc(sizeof(int) * accounts->count);
for (int i = 0; i < accounts->count; ++i)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled() || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) &~ CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
- int index = SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_ADDSTRING, 0, (LPARAM)accounts->pa[i]->tszAccountName);
+ int index = SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_ADDSTRING, 0, (LPARAM)pa->tszAccountName);
if (index != LB_ERR && index != LB_ERRSPACE)
{
char setting[80];
- mir_snprintf(setting, "Startup%sStatus", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Startup%sStatus", pa->szModuleName);
data->status[i] = db_get_w(NULL, "SimpleStatusMsg", setting, ID_STATUS_CURRENT);
- mir_snprintf(setting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ mir_snprintf(setting, "Set%sStatusDelay", pa->szModuleName);
data->setdelay[i] = db_get_w(NULL, "SimpleStatusMsg", setting, 300);
SendDlgItemMessage(hwndDlg, IDC_LISTPROTO, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
@@ -1565,7 +1572,8 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa int newindex = 0;
int i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
- int status_modes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
+ auto *pa = accounts->pa[i];
+ int status_modes = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
SendDlgItemMessage(hwndDlg, IDC_LISTSTATUS, LB_RESETCONTENT, 0, 0);
for (int l = ID_STATUS_OFFLINE; l <= ID_STATUS_OUTTOLUNCH; l++)
@@ -1618,14 +1626,15 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa {
for (int i = 0; i < accounts->count; i++)
{
- if (!Proto_IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ auto *pa = accounts->pa[i];
+ if (!pa->IsEnabled() || !(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
continue;
char szSetting[80];
- mir_snprintf(szSetting, "Startup%sStatus", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Startup%sStatus", pa->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
- mir_snprintf(szSetting, "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ mir_snprintf(szSetting, "Set%sStatusDelay", pa->szModuleName);
db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
}
db_set_w(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index 7559abaea1..6c061d5fab 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -681,7 +681,7 @@ bool SmileyCategoryListType::DeleteCustomCategory(int index) void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStringW &defaultFile)
{
- if (Proto_IsAccountEnabled(acc) && acc->szProtoName && IsSmileyProto(acc->szModuleName)) {
+ if (acc->IsEnabled() && acc->szProtoName && IsSmileyProto(acc->szModuleName)) {
CMStringW displayName(acc->tszAccountName ? acc->tszAccountName : _A2T(acc->szModuleName));
CMStringW PhysProtoName, paths;
DBVARIANT dbv;
diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp index a0e7e0f7a4..a35b8496da 100644 --- a/plugins/StatusManager/src/commonstatus.cpp +++ b/plugins/StatusManager/src/commonstatus.cpp @@ -308,7 +308,7 @@ static INT_PTR GetProtocolCountService(WPARAM, LPARAM) bool IsSuitableProto(PROTOACCOUNT *pa) { - return (pa == nullptr) ? false : (pcli->pfnGetProtocolVisibility(pa->szModuleName) != 0); + return (pa == nullptr) ? false : pa->IsVisible(); } static int CreateServices() diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index da64a57d50..158f0f5acd 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -121,7 +121,7 @@ public: for (int i = 0; i < n; i++) {
PROTOACCOUNT *p = pa[i];
- if (!Proto_IsAccountEnabled(p) || p->bIsVirtual)
+ if (!p->IsEnabled() || p->bIsVirtual)
continue;
item.lParam = (LPARAM)p->szModuleName;
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 5425e098aa..9fa2057686 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -72,14 +72,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->iSidebarWidth = opt.iSidebarWidth; PROTOACCOUNT *pa = Proto_GetAccount(pwd->clcit.szProto); - if (pa) + if (pa) { mir_wstrcpy(pwd->swzTitle, pa->tszAccountName); - - if (mir_wstrlen(pwd->swzTitle) == 0) - a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); - - if (Proto_IsAccountLocked(pa)) - mir_snwprintf(pwd->swzTitle, TranslateT("%s (locked)"), pwd->swzTitle); + if (pa->IsLocked()) + mir_snwprintf(pwd->swzTitle, TranslateT("%s (locked)"), pwd->swzTitle); + } + else a2t(pwd->clcit.szProto, pwd->swzTitle, TITLE_TEXT_LEN); // protocol status WORD wStatus = (WORD)CallProtoService(pwd->clcit.szProto, PS_GETSTATUS, 0, 0); @@ -1465,7 +1463,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (opt.bHideOffline && wStatus == ID_STATUS_OFFLINE) continue; - if (!Proto_IsAccountEnabled(pa) || !IsTrayProto(pa->tszAccountName, (BOOL)wParam)) + if (!pa->IsEnabled() || !IsTrayProto(pa->tszAccountName, (BOOL)wParam)) continue; if (dwItems & TRAYTIP_NUMCONTACTS) { @@ -1482,7 +1480,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t swzProto[256]; mir_wstrcpy(swzProto, pa->tszAccountName); if (dwItems & TRAYTIP_LOCKSTATUS) - if (Proto_IsAccountLocked(pa)) + 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)); |