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 /src/core/stdaway | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'src/core/stdaway')
-rw-r--r-- | src/core/stdaway/src/sendmsg.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 52b727f8fe..cbdfe8e782 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -172,12 +172,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar void ChangeAllProtoMessages(char *szProto, int statusMode, wchar_t *msg)
{
if (szProto == nullptr) {
- int nAccounts;
- PROTOACCOUNT **accounts;
- Proto_EnumAccounts(&nAccounts, &accounts);
-
- for (int i = 0; i < nAccounts; i++) {
- PROTOACCOUNT *pa = accounts[i];
+ for (auto &pa : Accounts()) {
if (!pa->IsEnabled())
continue;
@@ -536,15 +531,9 @@ static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) {
protoModeMsgFlags = 0;
- int nAccounts;
- PROTOACCOUNT **accounts;
- Proto_EnumAccounts(&nAccounts, &accounts);
- for (int i = 0; i < nAccounts; i++) {
- if (!accounts[i]->IsEnabled())
- continue;
-
- protoModeMsgFlags |= CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
- }
+ for (auto &pa : Accounts())
+ if (pa->IsEnabled())
+ protoModeMsgFlags |= CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
return 0;
}
|