diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
commit | 9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch) | |
tree | f8fe94a3efe7598a2af926f264d354f7a08fb943 /plugins/Ping | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/Ping')
-rw-r--r-- | plugins/Ping/src/options.cpp | 11 | ||||
-rw-r--r-- | plugins/Ping/src/pingthread.cpp | 8 |
2 files changed, 4 insertions, 15 deletions
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index f8ee4ec831..f818782ec7 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -191,15 +191,8 @@ INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)TranslateT("<none>"));
SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)TranslateT("<all>"));
- {
- int num_protocols = 0;
- PROTOACCOUNT **pppDesc;
-
- Proto_EnumAccounts(&num_protocols, &pppDesc);
- for (int i = 0; i < num_protocols; i++)
- SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pppDesc[i]->tszAccountName);
-
- }
+ for (auto &pa : Accounts())
+ SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)pa->tszAccountName);
if (add_edit_addr.pszProto[0] == '\0') {
SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_SETCURSEL, 0, 0);
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 1cc8632675..0b21f6aac7 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -58,12 +58,8 @@ void set_list_changed(bool f) void SetProtoStatus(wchar_t *pszLabel, char *pszProto, int if_status, int new_status)
{
if (mir_strcmp(pszProto, Translate("<all>")) == 0) {
- int num_protocols;
- PROTOACCOUNT **pppDesc;
-
- Proto_EnumAccounts(&num_protocols, &pppDesc);
- for (int i = 0; i < num_protocols; i++)
- SetProtoStatus(pszLabel, pppDesc[i]->szModuleName, if_status, new_status);
+ for (auto &pa : Accounts())
+ SetProtoStatus(pszLabel, pa->szModuleName, if_status, new_status);
}
else {
if (ProtoServiceExists(pszProto, PS_GETSTATUS)) {
|