summaryrefslogtreecommitdiff
path: root/plugins/RemovePersonalSettings
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/RemovePersonalSettings
parent2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff)
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/RemovePersonalSettings')
-rw-r--r--plugins/RemovePersonalSettings/src/rps.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp
index f48e3d4855..b1ec8ef5b2 100644
--- a/plugins/RemovePersonalSettings/src/rps.cpp
+++ b/plugins/RemovePersonalSettings/src/rps.cpp
@@ -164,20 +164,14 @@ INT_PTR RemoveAllService(WPARAM, LPARAM)
void SetProtocolsOffline()
{
if ( GetSettingBool("GlobalSettings", "SetProtocolsOffline", TRUE) ) {
- PROTOACCOUNT **accounts;
- int count;
- Proto_EnumAccounts(&count, &accounts);
-
- for (int i = 0; i < count; i++) {
- /*if (protos[i]->type != PROTOTYPE_PROTOCOL)
- continue;*/
- if (!accounts[i]->bIsEnabled)
+ for (auto &pa : Accounts()) {
+ if (!pa->bIsEnabled)
continue;
- if (accounts[i]->szModuleName == nullptr || accounts[i]->szModuleName[0] == '\0')
+ if (pa->szModuleName == nullptr || pa->szModuleName[0] == '\0')
continue;
- CallProtoService(accounts[i]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
+ CallProtoService(pa->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
// Give some time to make it really offline
@@ -288,24 +282,18 @@ void RemoveSettings()
// Delete protocol settings
if ( GetSettingBool("GlobalSettings", "RemoveProtocolSettings", TRUE) ) {
- PROTOACCOUNT **accounts;
- int i,count;
- Proto_EnumAccounts(&count, &accounts);
-
- for (i = 0; i < count; i++) {
- /*if (protos[i]->type != PROTOTYPE_PROTOCOL)
- continue;*/
- if (!accounts[i]->bIsEnabled)
+ for (auto &pa : Accounts()) {
+ if (!pa->bIsEnabled)
continue;
- if (accounts[i]->szModuleName == nullptr || accounts[i]->szModuleName[0] == '\0')
+ if (pa->szModuleName == nullptr || pa->szModuleName[0] == '\0')
continue;
- RemoveProtocolSettings(accounts[i]->szModuleName);
+ RemoveProtocolSettings(pa->szModuleName);
}
// Get disabled protocols
- if ( GetSettings("DisabledProtocols", buffer, sizeof(buffer)) ) {
+ if (GetSettings("DisabledProtocols", buffer, sizeof(buffer))) {
char *name;
char *value;
@@ -397,20 +385,14 @@ void RemoveDirectories()
// Remove protocol folders
if (GetSettingBool("GlobalSettings", "RemoveProtocolFolders", TRUE)) {
- PROTOACCOUNT **accounts;
- int count;
- Proto_EnumAccounts(&count, &accounts);
-
- for (int i = 0; i < count; i++) {
- /*if (protos[i]->type != PROTOTYPE_PROTOCOL)
- continue;*/
- if (!accounts[i]->bIsEnabled)
+ for (auto &pa : Accounts()) {
+ if (!pa->bIsEnabled)
continue;
- if (accounts[i]->szModuleName == nullptr || accounts[i]->szModuleName[0] == '\0')
+ if (pa->szModuleName == nullptr || pa->szModuleName[0] == '\0')
continue;
- mir_snprintf(dir, "%s%s", gMirandaDir, accounts[i]->szModuleName);
+ mir_snprintf(dir, "%s%s", gMirandaDir, pa->szModuleName);
DeleteFileOrFolder(dir);
}
}