summaryrefslogtreecommitdiff
path: root/plugins/XSoundNotify/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-03 16:30:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-03 16:30:25 +0300
commit9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch)
treef8fe94a3efe7598a2af926f264d354f7a08fb943 /plugins/XSoundNotify/src
parent2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff)
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/XSoundNotify/src')
-rw-r--r--plugins/XSoundNotify/src/options.cpp10
-rw-r--r--plugins/XSoundNotify/src/xsn_main.cpp10
2 files changed, 7 insertions, 13 deletions
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp
index cc8f91796b..cc2d8a51ca 100644
--- a/plugins/XSoundNotify/src/options.cpp
+++ b/plugins/XSoundNotify/src/options.cpp
@@ -28,12 +28,10 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- int count;
- PROTOACCOUNT **protos;
- Proto_EnumAccounts(&count, &protos);
- for (int i = 0; i < count; i++)
- if (IsSuitableProto(protos[i]))
- SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_ADDSTRING, 0, (LPARAM)protos[i]->tszAccountName), (LPARAM)protos[i]);
+
+ for (auto &pa : Accounts())
+ if (IsSuitableProto(pa))
+ SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_ADDSTRING, 0, (LPARAM)pa->tszAccountName), (LPARAM)pa);
return TRUE;
case WM_COMMAND:
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp
index f5b87586cd..81a2482774 100644
--- a/plugins/XSoundNotify/src/xsn_main.cpp
+++ b/plugins/XSoundNotify/src/xsn_main.cpp
@@ -66,17 +66,13 @@ static selfSounds[] =
void InitSelfSounds()
{
// initializing self sounds for protocols
- int protoCount = 0;
- PROTOACCOUNT** protos = nullptr;
-
- Proto_EnumAccounts(&protoCount, &protos);
- for (int i = 0; i < protoCount; i++) {
+ for (auto &pa : Accounts()) {
for (int j = 0; j < _countof(selfSounds); j++) {
char namebuf[128];
- mir_snprintf(namebuf, "%s%s", protos[i]->szModuleName, selfSounds[j].szName);
+ mir_snprintf(namebuf, "%s%s", pa->szModuleName, selfSounds[j].szName);
wchar_t infobuf[256];
- mir_snwprintf(infobuf, L"%s [%s]", TranslateT("Self status"), protos[i]->tszAccountName);
+ mir_snwprintf(infobuf, L"%s [%s]", TranslateT("Self status"), pa->tszAccountName);
Skin_AddSound(namebuf, infobuf, pcli->pfnGetStatusModeDescription(selfSounds[j].iStatus, 0));
}
}