From 7f35b5c32df443cf13dbb476c641e01f30db1d6c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Jan 2014 15:19:47 +0000 Subject: encrypted settings are not displayed in dbeditor git-svn-id: http://svn.miranda-ng.org/main/trunk@7631 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/modules.cpp | 105 +++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 56 deletions(-) (limited to 'plugins/DbEditorPP/src/modules.cpp') diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index aa4b77b6e5..603b601307 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -1,80 +1,71 @@ #include "headers.h" - void renameModule(char* oldName, char* newName, HANDLE hContact) { DBVARIANT dbv; ModuleSettingLL settinglist; - struct ModSetLinkLinkItem *setting; + ModSetLinkLinkItem *setting; - if (!EnumSettings(hContact,oldName,&settinglist)) { msg(Translate("Error Loading Setting List"),modFullname); return;} + if (!EnumSettings(hContact, oldName, &settinglist)) { msg(Translate("Error Loading Setting List"), modFullname); return; } setting = settinglist.first; - while (setting) - { - if (!GetSetting(hContact,oldName,setting->name,&dbv)) - { - switch (dbv.type) - { - case DBVT_BYTE: - db_set_b(hContact, newName, setting->name, dbv.bVal); + while (setting) { + if (!GetSetting(hContact, oldName, setting->name, &dbv)) { + switch (dbv.type) { + case DBVT_BYTE: + db_set_b(hContact, newName, setting->name, dbv.bVal); break; - case DBVT_WORD: - db_set_w(hContact, newName, setting->name, dbv.wVal); + case DBVT_WORD: + db_set_w(hContact, newName, setting->name, dbv.wVal); break; - case DBVT_DWORD: - db_set_dw(hContact, newName, setting->name, dbv.dVal); + case DBVT_DWORD: + db_set_dw(hContact, newName, setting->name, dbv.dVal); break; - case DBVT_ASCIIZ: - db_set_s(hContact, newName, setting->name, dbv.pszVal); + case DBVT_ASCIIZ: + db_set_s(hContact, newName, setting->name, dbv.pszVal); break; - case DBVT_UTF8: - db_set_utf(hContact, newName, setting->name, dbv.pszVal); + case DBVT_UTF8: + db_set_utf(hContact, newName, setting->name, dbv.pszVal); break; - case DBVT_BLOB: - db_set_blob(hContact, newName, setting->name, dbv.pbVal, dbv.cpbVal); + case DBVT_BLOB: + db_set_blob(hContact, newName, setting->name, dbv.pbVal, dbv.cpbVal); break; } db_unset(hContact, oldName, setting->name); } db_free(&dbv); - setting = (struct ModSetLinkLinkItem *)setting->next; + setting = (ModSetLinkLinkItem *)setting->next; } FreeModuleSettingLL(&settinglist); } INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (msg == WM_INITDIALOG) - { - SetWindowLongPtr(hwnd,GWLP_USERDATA,lParam); + if (msg == WM_INITDIALOG) { + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); } - if (msg == WM_COMMAND) - { - switch(LOWORD(wParam)) - { - case IDOK: - { - if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) - { - char modulename[256]; - GetDlgItemText(hwnd, IDC_MODNAME, modulename, 256); - if (IsDlgButtonChecked(hwnd,CHK_ADD2ALL)) { - // null contact - db_set_b(NULL, modulename, "(Default)", 0); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) - db_set_b(hContact, modulename, "(Default)", 0); - } - else db_set_b((HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA), modulename, "(Default)", 0); - refreshTree(1); + if (msg == WM_COMMAND) { + switch (LOWORD(wParam)) { + case IDOK: + if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) { + char modulename[256]; + GetDlgItemText(hwnd, IDC_MODNAME, modulename, 256); + if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) { + // null contact + db_set_b(NULL, modulename, "(Default)", 0); + for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + db_set_b(hContact, modulename, "(Default)", 0); } + else db_set_b((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); + + refreshTree(1); } // fall through - case IDCANCEL: - DestroyWindow(hwnd); + case IDCANCEL: + DestroyWindow(hwnd); break; } } @@ -83,20 +74,22 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam int CloneContact(HANDLE hContact) { - HANDLE newContact = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0); + HANDLE newContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + if (!newContact) + return 0; - ModuleSettingLL modlist; - struct ModSetLinkLinkItem *mod; - if (!newContact) return 0; // enum all the modules - if (!EnumModules(&modlist)) { msg(Translate("Error Loading Module List"),modFullname); return 0;} + ModuleSettingLL modlist; + if (!EnumModules(&modlist)) { + msg(Translate("Error Loading Module List"), modFullname); + return 0; + } - mod = modlist.first; - while (mod) - { - copyModule(mod->name,hContact,newContact); - mod = (struct ModSetLinkLinkItem *)mod->next; + ModSetLinkLinkItem *mod = modlist.first; + while (mod) { + copyModule(mod->name, hContact, newContact); + mod = (ModSetLinkLinkItem *)mod->next; } FreeModuleSettingLL(&modlist); return 1; -} \ No newline at end of file +} -- cgit v1.2.3