diff options
author | George Hazan <ghazan@miranda.im> | 2021-03-24 19:16:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-03-24 19:16:58 +0300 |
commit | f352e7958b6a97887da1db0aa75092fc4772cb23 (patch) | |
tree | d2434b6015222e198b7c2a6e776a1247102d9327 | |
parent | 9575f7da8eee269334e1baece5ef11d48d4f8445 (diff) |
code cleaning
-rw-r--r-- | src/mir_app/src/clcidents.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/clistmod.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/clisttray.cpp | 36 | ||||
-rw-r--r-- | src/mir_app/src/clui.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/findadd.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/menu_clist.cpp | 18 | ||||
-rw-r--r-- | src/mir_app/src/miranda.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/pluginopts.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_accs.cpp | 38 | ||||
-rw-r--r-- | src/mir_app/src/proto_opts.cpp | 20 | ||||
-rw-r--r-- | src/mir_app/src/proto_order.cpp | 36 | ||||
-rw-r--r-- | src/mir_app/src/protocols.cpp | 14 | ||||
-rw-r--r-- | src/mir_app/src/searchresults.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/skinicons.cpp | 2 |
14 files changed, 95 insertions, 95 deletions
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp index 4eca24cc37..38782a50ec 100644 --- a/src/mir_app/src/clcidents.cpp +++ b/src/mir_app/src/clcidents.cpp @@ -238,7 +238,7 @@ MIR_APP_DLL(int) Clist_GetGeneralizedStatus(char **szProto) int status = ID_STATUS_OFFLINE;
int statusOnlineness = 0;
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (!pa->IsVisible())
continue;
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index a1de6c705d..a4e31d49cc 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -162,7 +162,7 @@ static int ContactListModulesLoaded(WPARAM, LPARAM) ScheduleMenuUpdate();
RebuildMenuOrder();
- for (auto &it : accounts)
+ for (auto &it : g_arAccounts)
AddProtoIconIndex(it);
Clist_LoadContactTree();
@@ -205,7 +205,7 @@ static int CListIconsChanged(WPARAM, LPARAM) ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, Skin_LoadIcon(SKINICON_OTHER_GROUPOPEN));
ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, Skin_LoadIcon(SKINICON_OTHER_GROUPSHUT));
- for (auto &it : accounts) {
+ for (auto &it : g_arAccounts) {
if (it->iIconBase == -1)
continue;
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 814d3e1fe7..01113088b2 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -74,11 +74,11 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c wchar_t *szSeparator = L"\n";
if (szProto == nullptr) {
- if (accounts.getCount() == 0)
+ if (g_arAccounts.getCount() == 0)
return nullptr;
- if (accounts.getCount() == 1)
- return Clist_TrayIconMakeTooltip(szPrefix, accounts[0]->szModuleName);
+ if (g_arAccounts.getCount() == 1)
+ return Clist_TrayIconMakeTooltip(szPrefix, g_arAccounts[0]->szModuleName);
CMStringW tszTip;
@@ -90,12 +90,12 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c tszTip.Append(szPrefix);
}
- for (int t = 0; t < accounts.getCount(); t++) {
+ for (int t = 0; t < g_arAccounts.getCount(); t++) {
int i = Clist_GetAccountIndex(t);
if (i == -1)
continue;
- PROTOACCOUNT *pa = accounts[i];
+ PROTOACCOUNT *pa = g_arAccounts[i];
if (!pa->IsVisible())
continue;
@@ -228,7 +228,7 @@ int fnTrayIconInit(HWND hwnd) g_clistApi.trayIconCount = 1;
if (netProtoCount) {
- g_clistApi.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * accounts.getCount());
+ g_clistApi.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * g_arAccounts.getCount());
int trayIconSetting = db_get_b(0, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT);
if (trayIconSetting == SETTING_TRAYICON_SINGLE) {
@@ -244,10 +244,10 @@ int fnTrayIconInit(HWND hwnd) }
else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(0, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) {
g_clistApi.trayIconCount = netProtoCount;
- for (int i = 0; i < accounts.getCount(); i++) {
+ for (int i = 0; i < g_arAccounts.getCount(); i++) {
int j = Clist_GetAccountIndex(i);
if (j >= 0) {
- PROTOACCOUNT *pa = accounts[j];
+ PROTOACCOUNT *pa = g_arAccounts[j];
if (pa->IsVisible())
Clist_TrayIconAdd(hwnd, pa->szModuleName, nullptr, pa->iRealStatus);
}
@@ -307,7 +307,7 @@ static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD) RefreshTimerId = 0;
}
- for (auto &it : accounts)
+ for (auto &it : g_arAccounts)
Clist_TrayIconUpdateBase(it->szModuleName);
}
@@ -436,15 +436,15 @@ static VOID CALLBACK TrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) mir_cslock lck(trayLockCS);
int i;
- for (i = accounts.getCount() + 1; --i;) {
- g_clistApi.cycleStep = (g_clistApi.cycleStep + 1) % accounts.getCount();
- if (accounts[g_clistApi.cycleStep]->IsVisible())
+ for (i = g_arAccounts.getCount() + 1; --i;) {
+ g_clistApi.cycleStep = (g_clistApi.cycleStep + 1) % g_arAccounts.getCount();
+ if (g_arAccounts[g_clistApi.cycleStep]->IsVisible())
break;
}
if (i) {
DestroyIcon(g_clistApi.trayIcon[0].hBaseIcon);
- g_clistApi.trayIcon[0].hBaseIcon = g_clistApi.pfnGetIconFromStatusMode(0, accounts[g_clistApi.cycleStep]->szModuleName, accounts[g_clistApi.cycleStep]->iRealStatus);
+ g_clistApi.trayIcon[0].hBaseIcon = g_clistApi.pfnGetIconFromStatusMode(0, g_arAccounts[g_clistApi.cycleStep]->szModuleName, g_arAccounts[g_clistApi.cycleStep]->iRealStatus);
if (g_clistApi.trayIcon[0].isBase)
TrayIconUpdate(g_clistApi.trayIcon[0].hBaseIcon, nullptr, nullptr, 1);
}
@@ -472,9 +472,9 @@ MIR_APP_DLL(void) Clist_TrayIconUpdateBase(const char *szChangedProto) CycleTimerId = 0;
}
- for (auto &it : accounts)
+ for (auto &it : g_arAccounts)
if (!mir_strcmp(szChangedProto, it->szModuleName))
- g_clistApi.cycleStep = accounts.indexOf(&it);
+ g_clistApi.cycleStep = g_arAccounts.indexOf(&it);
int changed = g_clistApi.pfnTrayCalcChanged(szChangedProto, averageMode, netProtoCount);
if (changed != -1 && g_clistApi.trayIcon[changed].isBase)
@@ -687,16 +687,16 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) break;
int ind = 0;
- for (int j = 0; j < accounts.getCount(); j++) {
+ for (int j = 0; j < g_arAccounts.getCount(); j++) {
int k = Clist_GetAccountIndex(j);
if (k >= 0) {
- if (!mir_strcmp(g_clistApi.trayIcon[i].szProto, accounts[k]->szModuleName)) {
+ if (!mir_strcmp(g_clistApi.trayIcon[i].szProto, g_arAccounts[k]->szModuleName)) {
HMENU hm = GetSubMenu(hMenu, ind);
if (hm) hMenu = hm;
break;
}
- if (accounts[k]->IsVisible())
+ if (g_arAccounts[k]->IsVisible())
++ind;
}
}
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 39435ec19d..4c7bcd492a 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -77,7 +77,7 @@ static int CluiModulesLoaded(WPARAM, LPARAM) // Happens on shutdown and standby.
static void DisconnectAll()
{
- for (auto &it : accounts)
+ for (auto &it : g_arAccounts)
CallProtoServiceInt(0, it->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index bdd1834288..f031684b75 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -369,7 +369,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP szProto = NEWWSTR_ALLOCA(tszLast); int index = 0, cbwidth = 0, netProtoCount = 0; - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { if (!pa->IsEnabled()) continue; @@ -396,7 +396,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP cbei.iItem++; } - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { if (!pa->IsEnabled()) continue; @@ -472,7 +472,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (szProto == (char *)CB_ERR) break; if (szProto == nullptr) { - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { if (pa->IsEnabled()) { DWORD protoCaps = (DWORD)CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1; @@ -979,7 +979,7 @@ static INT_PTR FindAddCommand(WPARAM, LPARAM) // One alternative would be to only create the service if we have network // protocols loaded but that would delay the creation until MODULE_LOADED and // that is not good either... - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { if (!pa->IsEnabled()) continue; @@ -1024,7 +1024,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) int netProtoCount = 0; // Make sure we have some networks to search on. - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { int protoCaps = CallProtoServiceInt(0, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (protoCaps & PF1_ANYSEARCH) netProtoCount++; diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 82f0c3fd03..7856789ed4 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -550,13 +550,13 @@ static INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) int MenusProtoCount = 0;
- for (auto &pa : accounts)
+ for (auto &pa : g_arAccounts)
if (pa->IsVisible())
MenusProtoCount++;
g_clistApi.currentDesiredStatusMode = smep->status;
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (!pa->IsEnabled())
continue;
if (MenusProtoCount > 1 && pa->IsLocked())
@@ -672,9 +672,9 @@ MIR_APP_DLL(bool) Clist_GetProtocolVisibility(const char *szModuleName) MIR_APP_DLL(int) Clist_GetAccountIndex(int Pos)
{
- for (auto &it : accounts)
+ for (auto &it : g_arAccounts)
if (it->iOrder == Pos)
- return accounts.indexOf(&it);
+ return g_arAccounts.indexOf(&it);
return -1;
}
@@ -693,12 +693,12 @@ void RebuildMenuOrder(void) g_menuProtos.destroy();
- for (int s = 0; s < accounts.getCount(); s++) {
+ for (int s = 0; s < g_arAccounts.getCount(); s++) {
int i = Clist_GetAccountIndex(s);
if (i == -1)
continue;
- PROTOACCOUNT *pa = accounts[i];
+ PROTOACCOUNT *pa = g_arAccounts[i];
if (!pa->IsVisible())
continue;
@@ -796,7 +796,7 @@ void RebuildMenuOrder(void) // add to root menu
for (auto &it : g_statuses) {
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (!pa->IsVisible())
continue;
@@ -842,7 +842,7 @@ void RebuildMenuOrder(void) void BuildProtoMenus()
{
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (!pa->IsVisible())
continue;
@@ -920,7 +920,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) currentStatusMenuItem = 0;
}
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (!mir_strcmp(pa->szModuleName, ack->szModule)) {
int iOldStatus = (INT_PTR)ack->hProcess;
if ((iOldStatus >= ID_STATUS_OFFLINE || iOldStatus == 0) && iOldStatus < ID_STATUS_OFFLINE + _countof(g_statuses)) {
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index e423eca211..da93858769 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -135,7 +135,7 @@ extern MStatus g_statuses[MAX_STATUS_COUNT]; #define OFFSET_ENABLED 600
#define OFFSET_NAME 800
-extern LIST<PROTOACCOUNT> accounts;
+extern LIST<PROTOACCOUNT> g_arAccounts;
struct MBaseProto : public PROTOCOLDESCRIPTOR, public MZeroedObject
{
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index f0c805f1f4..edafbd5a28 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -226,7 +226,7 @@ static bool LoadPluginDynamically(PluginListItemData *dat) if (pd->hInst != ppb->getInst())
continue;
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (pa->ppro == nullptr && !mir_strcmp(pa->szProtoName, pd->szName)) {
if (pa->bIsEnabled) {
if (ActivateAccount(pa, true))
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index a3072a87c5..f6f08a420e 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -39,7 +39,7 @@ static int CompareAccounts(const PROTOACCOUNT* p1, const PROTOACCOUNT* p2) return mir_strcmp(p1->szModuleName, p2->szModuleName); } -LIST<PROTOACCOUNT> accounts(10, CompareAccounts); +LIST<PROTOACCOUNT> g_arAccounts(10, CompareAccounts); ///////////////////////////////////////////////////////////////////////////////////////// @@ -53,8 +53,8 @@ static int EnumDbModules(const char *szModuleName, void*) pa->tszAccountName = mir_a2u(szModuleName); pa->bIsVisible = true; pa->bIsEnabled = false; - pa->iOrder = accounts.getCount(); - accounts.insert(pa); + pa->iOrder = g_arAccounts.getCount(); + g_arAccounts.insert(pa); } } return 0; @@ -75,7 +75,7 @@ void LoadDbAccounts(void) PROTOACCOUNT *pa = Proto_GetAccount(szModuleName); if (pa == nullptr) { pa = new PROTOACCOUNT(szModuleName); - accounts.insert(pa); + g_arAccounts.insert(pa); } _itoa(OFFSET_VISIBLE + i, buf, 10); @@ -110,9 +110,9 @@ void LoadDbAccounts(void) if (CheckProtocolOrder()) WriteDbAccounts(); - int anum = accounts.getCount(); + int anum = g_arAccounts.getCount(); db_enum_modules(EnumDbModules); - if (anum != accounts.getCount()) + if (anum != g_arAccounts.getCount()) WriteDbAccounts(); } @@ -124,8 +124,8 @@ void WriteDbAccounts() db_delete_module(0, "Protocols"); // write new data - for (int i = 0; i < accounts.getCount(); i++) { - PROTOACCOUNT *pa = accounts[i]; + for (int i = 0; i < g_arAccounts.getCount(); i++) { + PROTOACCOUNT *pa = g_arAccounts[i]; char buf[20]; _itoa(i, buf, 10); @@ -144,7 +144,7 @@ void WriteDbAccounts() db_set_ws(0, "Protocols", buf, pa->tszAccountName); } - db_set_dw(0, "Protocols", "ProtoCount", accounts.getCount()); + db_set_dw(0, "Protocols", "ProtoCount", g_arAccounts.getCount()); db_set_dw(0, "Protocols", "PrVer", 4); } @@ -168,7 +168,7 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) { int count = 0; - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { if (!pa->ppro || !pa->IsEnabled()) continue; @@ -185,7 +185,7 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) db_set_b(0, "FirstRun", "AccManager", 1); CallService(MS_PROTO_SHOWACCMGR, 0, 0); } - // This is for pack creators with a profile with predefined accounts + // This is for pack creators with a profile with predefined g_arAccounts else if (db_get_b(0, "FirstRun", "ForceShowAccManager", 0)) { CallService(MS_PROTO_SHOWACCMGR, 0, 0); db_unset(0, "FirstRun", "ForceShowAccManager"); @@ -196,13 +196,13 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) static int UninitializeStaticAccounts(WPARAM, LPARAM) { // request permission to exit first - for (auto &pa : accounts) + for (auto &pa : g_arAccounts) if (pa->ppro && pa->IsEnabled()) if (!pa->ppro->IsReadyToExit()) return 1; // okay, all protocols are ready, exiting - for (auto &pa : accounts) + for (auto &pa : g_arAccounts) if (pa->ppro && pa->IsEnabled()) pa->ppro->OnShutdown(); @@ -213,7 +213,7 @@ int LoadAccountsModule(void) { bModuleInitialized = true; - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { pa->bDynDisabled = !Proto_IsProtocolLoaded(pa->szProtoName); if (pa->ppro) continue; @@ -273,7 +273,7 @@ MIR_APP_DLL(int) Proto_GetAverageStatus(int *pAccountNumber) { int netProtoCount = 0, averageMode = 0; - for (auto &pa : accounts) { + for (auto &pa : g_arAccounts) { if (!pa->IsVisible() || pa->IsLocked()) continue; @@ -372,7 +372,7 @@ void KillModuleAccounts(HINSTANCE hInst) if (pd->hInst != hInst) continue; - for (auto &pa : accounts.rev_iter()) { + for (auto &pa : g_arAccounts.rev_iter()) { if (!mir_strcmp(pa->szProtoName, pd->szName)) { pa->bDynDisabled = true; DeactivateAccount(pa, DAF_DYNAMIC); @@ -421,12 +421,12 @@ void UnloadAccountsModule() if (!bModuleInitialized) return; - auto T = accounts.rev_iter(); + auto T = g_arAccounts.rev_iter(); for (auto &it : T) { UnloadAccount(it, 0); - accounts.removeItem(&it); + g_arAccounts.removeItem(&it); } - accounts.destroy(); + g_arAccounts.destroy(); for (auto &it : hHooks) UnhookEvent(it); diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index ff72e1c805..6c3784d9e7 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -71,12 +71,12 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const ch PROTOACCOUNT *pa = new PROTOACCOUNT(szProto);
pa->bIsEnabled = pa->bIsVisible = true;
- pa->iOrder = accounts.getCount();
+ pa->iOrder = g_arAccounts.getCount();
pa->szProtoName = mir_strdup(pszBaseProto);
pa->tszAccountName = mir_wstrdup(tszAccountName);
db_set_s(0, pa->szModuleName, "AM_BaseProto", pszBaseProto);
- accounts.insert(pa);
+ g_arAccounts.insert(pa);
ActivateAccount(pa, true);
WriteDbAccounts();
@@ -89,7 +89,7 @@ static bool FindAccountByName(const char *szModuleName) if (!mir_strlen(szModuleName))
return false;
- for (auto &pa : accounts)
+ for (auto &pa : g_arAccounts)
if (_stricmp(szModuleName, pa->szModuleName) == 0)
return true;
@@ -318,7 +318,7 @@ public: PSHNOTIFY pshn;
pshn.hdr.idFrom = 0;
pshn.hdr.code = PSN_APPLY;
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (pa->hwndAccMgrUI && pa->bAccMgrUIChanged) {
pshn.hdr.hwndFrom = pa->hwndAccMgrUI;
SendMessage(pa->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -333,7 +333,7 @@ public: PSHNOTIFY pshn;
pshn.hdr.idFrom = 0;
pshn.hdr.code = PSN_RESET;
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (pa->hwndAccMgrUI && pa->bAccMgrUIChanged) {
pshn.hdr.hwndFrom = pa->hwndAccMgrUI;
SendMessage(pa->hwndAccMgrUI, WM_NOTIFY, 0, (LPARAM)&pshn);
@@ -344,7 +344,7 @@ public: void OnDestroy() override
{
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
pa->bAccMgrUIChanged = FALSE;
if (pa->hwndAccMgrUI) {
::DestroyWindow(pa->hwndAccMgrUI);
@@ -544,7 +544,7 @@ public: m_accList.SetItemData(idx, 0);
- accounts.remove(pa);
+ g_arAccounts.remove(pa);
CheckProtocolOrder();
@@ -597,7 +597,7 @@ public: PROTOACCOUNT *acc = (i == LB_ERR) ? nullptr : (PROTOACCOUNT *)m_accList.GetItemData(i);
m_accList.ResetContent();
- for (auto &p : accounts) {
+ for (auto &p : g_arAccounts) {
PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(p->szProtoName);
if (pd != nullptr && pd->type != PROTOTYPE_PROTOWITHACCS && pd->type != PROTOTYPE_PROTOCOL)
continue;
@@ -876,9 +876,9 @@ bool CAccountFormDlg::OnApply() BOOL oldProto = m_pa->bOldProto;
wchar_t szPlugin[MAX_PATH];
mir_snwprintf(szPlugin, L"%S.dll", m_pa->szProtoName);
- int idx = accounts.getIndex(m_pa);
+ int idx = g_arAccounts.getIndex(m_pa);
UnloadAccount(m_pa, 0);
- accounts.remove(idx);
+ g_arAccounts.remove(idx);
if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
wchar_t szNewName[MAX_PATH];
mir_snwprintf(szNewName, L"%s~", szPlugin);
diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index 33282638ad..554004330a 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -47,7 +47,7 @@ bool CheckProtocolOrder(void) for (;;) {
// Find account with this id
bool bFound = false;
- for (auto &pa : accounts)
+ for (auto &pa : g_arAccounts)
if (pa->iOrder == id) {
bFound = true;
break;
@@ -56,7 +56,7 @@ bool CheckProtocolOrder(void) // Account with id not found
if (!bFound) {
// Check if this is skipped id, if it is decrement all other ids
- for (auto &pa : accounts) {
+ for (auto &pa : g_arAccounts) {
if (pa->iOrder < 1000000 && pa->iOrder > id) {
--pa->iOrder;
bFound = true;
@@ -70,22 +70,22 @@ bool CheckProtocolOrder(void) else id++;
}
- if (id < accounts.getCount()) {
+ if (id < g_arAccounts.getCount()) {
// Remove huge ids
- for (auto &pa : accounts)
+ for (auto &pa : g_arAccounts)
if (pa->iOrder >= 1000000)
pa->iOrder = id++;
changed = true;
}
- if (id < accounts.getCount()) {
+ if (id < g_arAccounts.getCount()) {
// Remove duplicate ids
- for (int i = 0; i < accounts.getCount(); i++) {
+ for (int i = 0; i < g_arAccounts.getCount(); i++) {
bool found = false;
- for (int j = 0; j < accounts.getCount(); j++) {
- if (accounts[j]->iOrder == i) {
- if (found) accounts[j]->iOrder = id++;
+ for (int j = 0; j < g_arAccounts.getCount(); j++) {
+ if (g_arAccounts[j]->iOrder == i) {
+ if (found) g_arAccounts[j]->iOrder = id++;
else found = true;
}
}
@@ -118,12 +118,12 @@ class CProtocolOrderOpts : public CDlgBase tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- for (int i = 0; i < accounts.getCount(); i++) {
+ for (int i = 0; i < g_arAccounts.getCount(); i++) {
int idx = Clist_GetAccountIndex(i);
if (idx == -1)
continue;
- PROTOACCOUNT *pa = accounts[idx];
+ PROTOACCOUNT *pa = g_arAccounts[idx];
if (!ProtoToInclude(pa))
continue;
@@ -166,13 +166,13 @@ public: bool OnApply() override
{
- // assume all accounts are disabled
- for (auto &it : accounts)
+ // assume all g_arAccounts are disabled
+ for (auto &it : g_arAccounts)
it->iOrder = -1;
int idx = 0;
- // scan chosen accounts and apply the order
+ // scan chosen g_arAccounts and apply the order
TVITEMEX tvi;
tvi.hItem = m_order.GetRoot();
tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_IMAGE;
@@ -192,8 +192,8 @@ public: tvi.hItem = m_order.GetNextSibling(tvi.hItem);
}
- // all accounts in the rest are disabled, so order doesn't matter
- for (auto &it : accounts)
+ // all g_arAccounts in the rest are disabled, so order doesn't matter
+ for (auto &it : g_arAccounts)
if (it->iOrder == -1)
it->iOrder = idx++;
@@ -207,8 +207,8 @@ public: void onReset_Click(CCtrlButton*)
{
- for (int i = 0; i < accounts.getCount(); i++)
- accounts[i]->iOrder = i;
+ for (int i = 0; i < g_arAccounts.getCount(); i++)
+ g_arAccounts[i]->iOrder = i;
FillTree();
NotifyChange();
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index d53f005106..87be16993b 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -122,8 +122,8 @@ MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_RegisterModule(int type, const char *szNa pa->szProtoName = mir_strdup(szName);
pa->tszAccountName = mir_a2u(szName);
pa->bIsVisible = pa->bIsEnabled = true;
- pa->iOrder = accounts.getCount();
- accounts.insert(pa);
+ pa->iOrder = g_arAccounts.getCount();
+ g_arAccounts.insert(pa);
}
pa->bOldProto = true;
pa->bIsVirtual = (pd->type == PROTOTYPE_VIRTUAL);
@@ -294,7 +294,7 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *accName) if (accName == nullptr)
return nullptr;
- return accounts.find((PROTOACCOUNT*)&accName);
+ return g_arAccounts.find((PROTOACCOUNT*)&accName);
}
MIR_APP_DLL(int) Proto_GetStatus(const char *accName)
@@ -302,7 +302,7 @@ MIR_APP_DLL(int) Proto_GetStatus(const char *accName) if (accName == nullptr)
return ID_STATUS_OFFLINE;
- PROTOACCOUNT *pa = accounts.find((PROTOACCOUNT*)&accName);
+ PROTOACCOUNT *pa = g_arAccounts.find((PROTOACCOUNT*)&accName);
return (pa) ? pa->iRealStatus : ID_STATUS_OFFLINE;
}
@@ -310,13 +310,13 @@ MIR_APP_DLL(int) Proto_GetStatus(const char *accName) MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs)
{
- if (nAccs) *nAccs = accounts.getCount();
- if (pAccs) *pAccs = accounts.getArray();
+ if (nAccs) *nAccs = g_arAccounts.getCount();
+ if (pAccs) *pAccs = g_arAccounts.getArray();
}
MIR_APP_DLL(LIST<PROTOACCOUNT>&) Accounts(void)
{
- return accounts;
+ return g_arAccounts;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 6dfb11cf0b..edf93b0ff8 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -190,8 +190,8 @@ int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const cha if (szProto == nullptr) {
int failures = 0;
dat->searchCount = 0;
- dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * accounts.getCount());
- for (auto &pa : accounts) {
+ dat->search = (struct ProtoSearchInfo*)mir_calloc(sizeof(struct ProtoSearchInfo) * g_arAccounts.getCount());
+ for (auto &pa : g_arAccounts) {
if (!pa->IsEnabled())
continue;
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index eaebcb0435..e74b6cffde 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -260,7 +260,7 @@ MIR_APP_DLL(HANDLE) Skin_GetProtoIcon(const char *szProto, int status) if (!szProto) {
// Only return a protocol specific icon if there is only one protocol
// Otherwise return the global icon. This affects the global status menu mainly.
- if (accounts.getCount() == 1) {
+ if (g_arAccounts.getCount() == 1) {
// format: core_status_%proto%statusindex
mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, statusIndx);
|