summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp14
-rw-r--r--plugins/Clist_nicer/src/clistevents.cpp14
-rw-r--r--plugins/CloudFile/src/srmm.cpp6
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp28
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp26
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp14
-rw-r--r--plugins/SmileyAdd/src/SmileyBase.cpp6
-rw-r--r--plugins/SpellChecker/src/dictionary.cpp6
-rw-r--r--plugins/SpellChecker/src/spellchecker.cpp5
-rw-r--r--plugins/SpellChecker/src/utils.cpp27
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_options.cpp35
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp4
-rw-r--r--plugins/TopToolBar/src/toolbar.cpp8
-rw-r--r--plugins/Weather/src/weather_data.cpp53
14 files changed, 117 insertions, 129 deletions
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 0caf90b0d7..a336f326f9 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -158,19 +158,19 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle)
int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
{
// Find the event that should be removed
- int i;
- for (i = 0; i < pcli->events->getCount(); i++) {
- CListEvent &e = (*pcli->events)[i];
- if (e.hContact == hContact && e.hDbEvent == hDbEvent)
+ CListEvent *pEvent = nullptr;
+ for (auto &it : *pcli->events)
+ if (it->hContact == hContact && it->hDbEvent == hDbEvent) {
+ pEvent = it;
break;
- }
+ }
// Event was not found
- if (i == pcli->events->getCount())
+ if (pEvent == nullptr)
return 1;
// remove event from the notify menu
- int iMenuId = (*pcli->events)[i].menuId;
+ int iMenuId = pEvent->menuId;
if (iMenuId > 0) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp
index 288d55cdcc..d9856cec30 100644
--- a/plugins/Clist_nicer/src/clistevents.cpp
+++ b/plugins/Clist_nicer/src/clistevents.cpp
@@ -315,19 +315,19 @@ CListEvent* AddEvent(CLISTEVENT *cle)
int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
{
// Find the event that should be removed
- int i;
- for (i = 0; i < pcli->events->getCount(); i++) {
- CListEvent &e = (*pcli->events)[i];
- if (e.hContact == hContact && e.hDbEvent == hDbEvent)
+ CListEvent *e = nullptr;
+ for (auto &it : *pcli->events)
+ if (it->hContact == hContact && it->hDbEvent == hDbEvent) {
+ e = it;
break;
- }
+ }
// Event was not found
- if (i == pcli->events->getCount())
+ if (e == nullptr)
return 1;
// remove event from the notify menu
- int iMenuId = (*pcli->events)[i].menuId;
+ int iMenuId = e->menuId;
if (iMenuId > 0) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
diff --git a/plugins/CloudFile/src/srmm.cpp b/plugins/CloudFile/src/srmm.cpp
index 68c2cca0cb..8e400bbdbf 100644
--- a/plugins/CloudFile/src/srmm.cpp
+++ b/plugins/CloudFile/src/srmm.cpp
@@ -54,10 +54,8 @@ int OnSrmmButtonPressed(WPARAM, LPARAM lParam)
}
HMENU hMenu = CreatePopupMenu();
- for (int i = 0; i < Services.getCount(); i++) {
- CCloudService *service = Services[i];
- AppendMenu(hMenu, MF_STRING, i + 1, TranslateW(service->GetUserName()));
- }
+ for (auto &it : Services)
+ AppendMenu(hMenu, MF_STRING, Services.indexOf(&it) + 1, TranslateW(it->GetUserName()));
int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, nullptr);
DestroyMenu(hMenu);
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 81f40481b7..7151781255 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -224,24 +224,22 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
///
bool enableOk = false;
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)lParam;
- for (int i = 0; i < todo.getCount(); i++) {
- auto &p = todo[i];
-
+ for (auto &p : todo) {
LVITEM lvi = { 0 };
lvi.mask = LVIF_PARAM | LVIF_GROUPID | LVIF_TEXT | LVIF_IMAGE;
int groupId = 4;
- if (wcschr(p.tszOldName, L'\\') != nullptr)
- groupId = (wcsstr(p.tszOldName, L"Plugins") != nullptr) ? 1 : ((wcsstr(p.tszOldName, L"Languages") != nullptr) ? 3 : 2);
+ if (wcschr(p->tszOldName, L'\\') != nullptr)
+ groupId = (wcsstr(p->tszOldName, L"Plugins") != nullptr) ? 1 : ((wcsstr(p->tszOldName, L"Languages") != nullptr) ? 3 : 2);
- lvi.iItem = i;
- lvi.lParam = (LPARAM)&todo[i];
+ lvi.iItem = todo.indexOf(&p);
+ lvi.lParam = (LPARAM)p;
lvi.iGroupId = groupId;
lvi.iImage = ((groupId == 1) ? 0 : -1);
- lvi.pszText = p.tszOldName;
+ lvi.pszText = p->tszOldName;
ListView_InsertItem(hwndList, &lvi);
- if (p.bEnabled) {
+ if (p->bEnabled) {
enableOk = true;
ListView_SetCheckState(hwndList, lvi.iItem, 1);
}
@@ -273,8 +271,8 @@ INT_PTR CALLBACK DlgList(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
p->bEnabled = ListView_GetCheckState(hwndList, nmlv->iItem);
bool enableOk = false;
- for (int i = 0; i < todo.getCount(); ++i) {
- if (p->bEnabled) {
+ for (auto &it : todo) {
+ if (it->bEnabled) {
enableOk = true;
break;
}
@@ -396,14 +394,12 @@ static void GetList(void *)
FILELIST *UpdateFiles = new FILELIST(20);
VARSW dirname(L"%miranda_path%");
- for (int i = 0; i < hashes.getCount(); i++) {
- ServListEntry &hash = hashes[i];
-
+ for (auto &it : hashes) {
wchar_t tszPath[MAX_PATH];
- mir_snwprintf(tszPath, L"%s\\%s", dirname, hash.m_name);
+ mir_snwprintf(tszPath, L"%s\\%s", dirname, it->m_name);
if (GetFileAttributes(tszPath) == INVALID_FILE_ATTRIBUTES) {
- FILEINFO *FileInfo = ServerEntryToFileInfo(hash, baseUrl, tszPath);
+ FILEINFO *FileInfo = ServerEntryToFileInfo(*it, baseUrl, tszPath);
UpdateFiles->insert(FileInfo);
}
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 467e7e44ce..f5058c63a0 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -30,9 +30,9 @@ static void SelectAll(HWND hDlg, bool bEnable)
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES);
- for (int i=0; i < todo.getCount(); i++) {
- ListView_SetCheckState(hwndList, i, bEnable);
- db_set_b(NULL, DB_MODULE_FILES, StrToLower(_T2A(todo[i].tszOldName)), todo[i].bEnabled = bEnable);
+ for (auto &it : todo) {
+ ListView_SetCheckState(hwndList, todo.indexOf(&it), bEnable);
+ db_set_b(NULL, DB_MODULE_FILES, StrToLower(_T2A(it->tszOldName)), it->bEnabled = bEnable);
}
}
@@ -266,23 +266,23 @@ static INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM
bool enableOk = false;
OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)lParam;
- for (int i = 0; i < todo.getCount(); ++i) {
+ for (auto &it : todo) {
LVITEM lvI = {0};
lvI.mask = LVIF_TEXT | LVIF_PARAM | LVIF_GROUPID | LVIF_NORECOMPUTE;
- lvI.iGroupId = (wcsstr(todo[i].tszOldName, L"Plugins") != nullptr) ? 1 :
- ((wcsstr(todo[i].tszOldName, L"Languages") != nullptr) ? 3 :
- ((wcsstr(todo[i].tszOldName, L"Icons") != nullptr) ? 4 : 2));
+ lvI.iGroupId = (wcsstr(it->tszOldName, L"Plugins") != nullptr) ? 1 :
+ ((wcsstr(it->tszOldName, L"Languages") != nullptr) ? 3 :
+ ((wcsstr(it->tszOldName, L"Icons") != nullptr) ? 4 : 2));
lvI.iSubItem = 0;
- lvI.lParam = (LPARAM)&todo[i];
- lvI.pszText = todo[i].tszOldName;
- lvI.iItem = i;
+ lvI.lParam = (LPARAM)it;
+ lvI.pszText = it->tszOldName;
+ lvI.iItem = todo.indexOf(&it);
ListView_InsertItem(hwndList, &lvI);
- ListView_SetCheckState(hwndList, lvI.iItem, todo[i].bEnabled);
- if (todo[i].bEnabled)
+ ListView_SetCheckState(hwndList, lvI.iItem, it->bEnabled);
+ if (it->bEnabled)
enableOk = true;
- SetStringText(hwndList,i,todo[i].bDeleteOnly ? TranslateT("Deprecated!") : TranslateT("Update found!"));
+ SetStringText(hwndList, lvI.iItem, it->bDeleteOnly ? TranslateT("Deprecated!") : TranslateT("Update found!"));
}
if(enableOk)
EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index d0c720b2e7..9f864e2bc7 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -404,12 +404,8 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
SortArray();
SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_RESETCONTENT, 0, 0);
- for (int loop = 0; loop < contacts.getCount(); loop++) {
- SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETITEMDATA,
- (WPARAM)SendDlgItemMessage(hwndDlg, IDC_USERNAME,
- CB_ADDSTRING, 0, (LPARAM)GetListName(contacts[loop])),
- (LPARAM)loop);
- }
+ for (int loop = 0; loop < contacts.getCount(); loop++)
+ SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_ADDSTRING, 0, (LPARAM)GetListName(contacts[loop])), loop);
}
@@ -511,9 +507,9 @@ MCONTACT GetSelectedContact(HWND hwndDlg)
// get array position from handle
int GetItemPos(MCONTACT hcontact)
{
- for (int loop = 0; loop < contacts.getCount(); loop++)
- if (hcontact == contacts[loop]->hcontact)
- return loop;
+ for (auto &it : contacts)
+ if (hcontact == it->hcontact)
+ return contacts.indexOf(&it);
return -1;
}
diff --git a/plugins/SmileyAdd/src/SmileyBase.cpp b/plugins/SmileyAdd/src/SmileyBase.cpp
index e9ef6722d8..6394a9ba6a 100644
--- a/plugins/SmileyAdd/src/SmileyBase.cpp
+++ b/plugins/SmileyAdd/src/SmileyBase.cpp
@@ -376,9 +376,9 @@ void CloseSmileys(void)
int CheckForTip(int x, int y, HWND hwnd, wchar_t **smltxt)
{
- for (int i = 0; i < regSmileys.getCount(); i++)
- if (regSmileys[i]->QueryHitPointSpecial(x, y, hwnd, smltxt))
- return i;
+ for (auto &it : regSmileys)
+ if (it->QueryHitPointSpecial(x, y, hwnd, smltxt))
+ return regSmileys.indexOf(&it);
return -1;
}
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp
index 98178f0a23..0bb88d0482 100644
--- a/plugins/SpellChecker/src/dictionary.cpp
+++ b/plugins/SpellChecker/src/dictionary.cpp
@@ -836,9 +836,11 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, wchar_t *path, w
// Check if dict is new
bool exists = false;
- for (int i = 0; i < dicts.getCount() && !exists; i++)
- if (mir_wstrcmp(dicts[i]->language, lang) == 0)
+ for (auto &it : dicts)
+ if (mir_wstrcmp(it->language, lang) == 0) {
exists = true;
+ break;
+ }
if (!exists) {
found = TRUE;
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp
index 4b495303c1..9770861c9c 100644
--- a/plugins/SpellChecker/src/spellchecker.cpp
+++ b/plugins/SpellChecker/src/spellchecker.cpp
@@ -144,12 +144,11 @@ static int ModulesLoaded(WPARAM, LPARAM)
sid.section.w = LPGENW("Spell Checker") L"/" LPGENW("Flags");
// Get language flags
- for (int i = 0; i < languages.getCount(); i++) {
- auto *p = languages[i];
+ for (auto &p : languages) {
sid.description.w = p->full_name;
char lang[32];
- mir_snprintf(lang, "spell_lang_%d", i);
+ mir_snprintf(lang, "spell_lang_%d", languages.indexOf(&p));
sid.pszName = lang;
HICON hFlag = nullptr, hFlagIcoLib = nullptr;
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp
index 7dfcd12884..4fd399f44f 100644
--- a/plugins/SpellChecker/src/utils.cpp
+++ b/plugins/SpellChecker/src/utils.cpp
@@ -668,39 +668,38 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
int GetClosestLanguage(wchar_t *lang_name)
{
- int i;
-
// Search the language by name
- for (i = 0; i < languages.getCount(); i++)
- if (mir_wstrcmpi(languages[i]->language, lang_name) == 0)
- return i;
+ for (auto &it : languages)
+ if (mir_wstrcmpi(it->language, lang_name) == 0)
+ return languages.indexOf(&it);
// Try searching by the prefix only
wchar_t lang[128];
mir_wstrncpy(lang, lang_name, _countof(lang));
{
wchar_t *p = wcschr(lang, '_');
- if (p != nullptr) *p = '\0';
+ if (p != nullptr)
+ *p = '\0';
}
// First check if there is a language that is only the prefix
- for (i = 0; i < languages.getCount(); i++)
- if (mir_wstrcmpi(languages[i]->language, lang) == 0)
- return i;
+ for (auto &it : languages)
+ if (mir_wstrcmpi(it->language, lang) == 0)
+ return languages.indexOf(&it);
// Now try any suffix
size_t len = mir_wstrlen(lang);
- for (i = 0; i < languages.getCount(); i++) {
- wchar_t *p = wcschr(languages[i]->language, '_');
+ for (auto &it : languages) {
+ wchar_t *p = wcschr(it->language, '_');
if (p == nullptr)
continue;
- size_t prefix_len = p - languages[i]->language;
+ size_t prefix_len = p - it->language;
if (prefix_len != len)
continue;
- if (wcsnicmp(languages[i]->language, lang_name, len) == 0)
- return i;
+ if (wcsnicmp(it->language, lang_name, len) == 0)
+ return languages.indexOf(&it);
}
return -1;
diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
index af4e8f79c9..1b401cdca7 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
@@ -502,8 +502,8 @@ class CSSAdvancedOptDlg : public CDlgBase
{
// creates profile combo box according to 'dat'
cmbProfile.ResetContent();
- for (int i = 0; i < arProfiles.getCount(); i++)
- cmbProfile.AddString(arProfiles[i].tszName, i);
+ for (auto &it : arProfiles)
+ cmbProfile.AddString(it->tszName, arProfiles.indexOf(&it));
cmbProfile.SetCurSel(0);
SetProfile();
@@ -695,24 +695,23 @@ public:
}
}
- for (int i = 0; i < arProfiles.getCount(); i++) {
- PROFILEOPTIONS& po = arProfiles[i];
- db_set_b(0, SSMODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), po.showDialog);
- db_set_b(0, SSMODULENAME, OptName(i, SETTING_CREATETTBBUTTON), po.createTtb);
- db_set_b(0, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), po.createMmi);
- db_set_b(0, SSMODULENAME, OptName(i, SETTING_INSUBMENU), po.inSubMenu);
- db_set_b(0, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), po.regHotkey);
- db_set_w(0, SSMODULENAME, OptName(i, SETTING_HOTKEY), po.hotKey);
- db_set_ws(0, SSMODULENAME, OptName(i, SETTING_PROFILENAME), po.tszName);
-
- TProtoSettings &ar = po.ps;
- for (int j = 0; j < ar.getCount(); j++) {
- if (ar[j].m_szMsg != nullptr) {
+ for (auto &it : arProfiles) {
+ int i = arProfiles.indexOf(&it);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), it->showDialog);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_CREATETTBBUTTON), it->createTtb);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), it->createMmi);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_INSUBMENU), it->inSubMenu);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), it->regHotkey);
+ db_set_w(0, SSMODULENAME, OptName(i, SETTING_HOTKEY), it->hotKey);
+ db_set_ws(0, SSMODULENAME, OptName(i, SETTING_PROFILENAME), it->tszName);
+
+ for (auto jt : it->ps) {
+ if (jt->m_szMsg != nullptr) {
char setting[128];
- mir_snprintf(setting, "%s_%s", ar[j].m_szName, SETTING_PROFILE_STSMSG);
- db_set_ws(0, SSMODULENAME, OptName(i, setting), ar[j].m_szMsg);
+ mir_snprintf(setting, "%s_%s", jt->m_szName, SETTING_PROFILE_STSMSG);
+ db_set_ws(0, SSMODULENAME, OptName(i, setting), jt->m_szMsg);
}
- db_set_w(0, SSMODULENAME, OptName(i, ar[j].m_szName), ar[j].m_status);
+ db_set_w(0, SSMODULENAME, OptName(i, jt->m_szName), jt->m_status);
}
}
db_set_w(0, SSMODULENAME, SETTING_PROFILECOUNT, (WORD)arProfiles.getCount());
diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
index 628f4f192c..63e914b60a 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
@@ -33,8 +33,8 @@ static IconItem iconList[] =
void RemoveTopToolbarButtons()
{
- for (int i = ttbButtons.getCount() - 1; i >= 0; i--)
- CallService(MS_TTB_REMOVEBUTTON, (WPARAM)ttbButtons[i], 0);
+ for (auto &it : ttbButtons.rev_iter())
+ CallService(MS_TTB_REMOVEBUTTON, (WPARAM)it, 0);
ttbButtons.destroy();
}
diff --git a/plugins/TopToolBar/src/toolbar.cpp b/plugins/TopToolBar/src/toolbar.cpp
index 380daf02dd..a0a77b8536 100644
--- a/plugins/TopToolBar/src/toolbar.cpp
+++ b/plugins/TopToolBar/src/toolbar.cpp
@@ -25,11 +25,11 @@ LIST<TopButtonInt> Buttons(8, sortfunc);
TopButtonInt *idtopos(int id, int *pPos)
{
- for (int i = 0; i < Buttons.getCount(); i++)
- if (Buttons[i]->id == id) {
+ for (auto &it : Buttons)
+ if (it->id == id) {
if (pPos)
- *pPos = i;
- return Buttons[i];
+ *pPos = Buttons.indexOf(&it);
+ return it;
}
if (pPos)
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp
index dfcfc642d2..28fa9a622d 100644
--- a/plugins/Weather/src/weather_data.cpp
+++ b/plugins/Weather/src/weather_data.cpp
@@ -408,33 +408,32 @@ void DBDataManage(MCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM)
db_enum_settings(hContact, GetWeatherDataFromDB, WEATHERCONDITION, &arSettings);
// begin deleting settings
- for (int i = arSettings.getCount() - 1; i >= 0; i--) {
- char *szSetting = arSettings[i];
-
- DBVARIANT dbv;
- if (!db_get_ws(hContact, WEATHERCONDITION, szSetting, &dbv)) {
- switch (Mode) {
- case WDBM_REMOVE:
- db_unset(hContact, WEATHERCONDITION, szSetting);
- break;
-
- case WDBM_DETAILDISPLAY:
- // skip the "WeatherInfo" variable
- if (!mir_strcmp(szSetting, "WeatherInfo") || !mir_strcmp(szSetting, "Ignore") || szSetting[0] == '#')
- continue;
-
- HWND hList = GetDlgItem((HWND)wParam, IDC_DATALIST);
- LV_ITEM lvi = { 0 };
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.lParam = i;
- lvi.pszText = TranslateW(_A2T(szSetting));
- lvi.iItem = ListView_InsertItem(hList, &lvi);
- lvi.pszText = dbv.ptszVal;
- ListView_SetItemText(hList, lvi.iItem, 1, dbv.ptszVal);
- break;
- }
- db_free(&dbv);
+ auto T = arSettings.rev_iter();
+ for (auto &str : T) {
+ ptrW wszText(db_get_wsa(hContact, WEATHERCONDITION, str));
+ if (wszText == nullptr)
+ continue;
+
+ switch (Mode) {
+ case WDBM_REMOVE:
+ db_unset(hContact, WEATHERCONDITION, str);
+ break;
+
+ case WDBM_DETAILDISPLAY:
+ // skip the "WeatherInfo" variable
+ if (!mir_strcmp(str, "WeatherInfo") || !mir_strcmp(str, "Ignore") || str[0] == '#')
+ continue;
+
+ HWND hList = GetDlgItem((HWND)wParam, IDC_DATALIST);
+ LV_ITEM lvi = { 0 };
+ lvi.mask = LVIF_TEXT | LVIF_PARAM;
+ lvi.lParam = T.indexOf(&str);
+ lvi.pszText = TranslateW(_A2T(str));
+ lvi.iItem = ListView_InsertItem(hList, &lvi);
+ lvi.pszText = wszText;
+ ListView_SetItemText(hList, lvi.iItem, 1, wszText);
+ break;
}
- mir_free(szSetting);
+ mir_free(str);
}
}