From 007b4c7301f0d26a72f89f74e9929f42e24eb3e6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 5 Apr 2013 22:27:16 +0000 Subject: - rest of menus cleared; - old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/addeditsettingsdlg.cpp | 36 +++++----- plugins/DbEditorPP/src/copymodule.cpp | 12 ++-- plugins/DbEditorPP/src/deletemodule.cpp | 9 +-- plugins/DbEditorPP/src/exportimport.cpp | 26 ++++---- plugins/DbEditorPP/src/findwindow.cpp | 26 ++++---- plugins/DbEditorPP/src/headers.h | 2 +- plugins/DbEditorPP/src/knownmodules.cpp | 6 +- plugins/DbEditorPP/src/main.cpp | 30 ++++----- plugins/DbEditorPP/src/main_window.cpp | 56 ++++++++-------- plugins/DbEditorPP/src/modules.cpp | 20 +++--- plugins/DbEditorPP/src/moduletree.cpp | 16 ++--- plugins/DbEditorPP/src/options.cpp | 44 ++++++------- plugins/DbEditorPP/src/settinglist.cpp | 94 +++++++++++++-------------- plugins/DbEditorPP/src/watchedvars.cpp | 12 ++-- 14 files changed, 190 insertions(+), 199 deletions(-) (limited to 'plugins/DbEditorPP/src') diff --git a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp index 968ee92bc0..1c0b10a32d 100644 --- a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp +++ b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp @@ -11,20 +11,20 @@ static BOOL Convert(HANDLE hContact, char* module, char* setting, int value, int if (value > 0xFF) Result = 0; else - DBWriteContactSettingByte(hContact, module, setting, (BYTE)value); + db_set_b(hContact, module, setting, (BYTE)value); break; case 1: if (value > 0xFFFF) Result = 0; else - DBWriteContactSettingWord(hContact, module, setting, (WORD)value); + db_set_w(hContact, module, setting, (WORD)value); break; case 2: - DBWriteContactSettingDword(hContact, module, setting, (DWORD)value); + db_set_dw(hContact, module, setting, (DWORD)value); break; case 3: - DBDeleteContactSetting(hContact, module, setting); - DBWriteContactSettingString(hContact, module, setting, itoa(value,temp,10)); + db_unset(hContact, module, setting); + db_set_s(hContact, module, setting, itoa(value,temp,10)); break; } return Result; @@ -56,7 +56,7 @@ BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // int len = (int)strlen(dbv.pszVal) + 1; WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, wc, len); - Result = !DBWriteContactSettingWString(hContact, module, setting, wc); + Result = !db_set_ws(hContact, module, setting, wc); } else if (strlen(dbv.pszVal) < 11 && toType != 3) { int val = atoi(dbv.pszVal); @@ -74,7 +74,7 @@ BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // WCHAR *wc = (WCHAR*)_alloca(len*sizeof(WCHAR)); MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len); WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL); - Result = !DBWriteContactSettingString(hContact, module, setting, sz); + Result = !db_set_s(hContact, module, setting, sz); } break; } @@ -82,7 +82,7 @@ BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // if (!Result) msg(Translate("Cannot Convert!"), modFullname); - DBFreeVariant(&dbv); + db_free(&dbv); } return Result; @@ -357,22 +357,22 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l // delete the old setting if (mir_strcmp(setting, dbsetting->setting) && dbsetting->setting && (dbsetting->setting)[0] != 0) - DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, dbsetting->setting); + db_unset(dbsetting->hContact, dbsetting->module, dbsetting->setting); // delete the setting if we are saving as a different type switch (dbsetting->dbv.type) { case DBVT_BYTE: - if (saveAsType(hwnd) != 0) DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, setting); + if (saveAsType(hwnd) != 0) db_unset(dbsetting->hContact, dbsetting->module, setting); break; case DBVT_WORD: - if (saveAsType(hwnd) != 1) DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, setting); + if (saveAsType(hwnd) != 1) db_unset(dbsetting->hContact, dbsetting->module, setting); break; case DBVT_DWORD: - if (saveAsType(hwnd) != 2) DBDeleteContactSetting(dbsetting->hContact, dbsetting->module, setting); + if (saveAsType(hwnd) != 2) db_unset(dbsetting->hContact, dbsetting->module, setting); break; //case DBVT_ASCIIZ: - //DBWriteContactSettingString(dbsetting->hContact, dbsetting->module, setting, value); + //db_set_s(dbsetting->hContact, dbsetting->module, setting, value); //break; } // write the setting @@ -381,25 +381,25 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 0: if (IsDlgButtonChecked(hwnd, CHK_HEX)) sscanf(value, "%x", &settingValue); else sscanf(value, "%d", &settingValue); - DBWriteContactSettingByte(dbsetting->hContact, dbsetting->module, setting, (BYTE)settingValue); + db_set_b(dbsetting->hContact, dbsetting->module, setting, (BYTE)settingValue); break; case 1: if (IsDlgButtonChecked(hwnd, CHK_HEX)) sscanf(value, "%x", &settingValue); else sscanf(value, "%d", &settingValue); - DBWriteContactSettingWord(dbsetting->hContact, dbsetting->module, setting, (WORD)settingValue); + db_set_w(dbsetting->hContact, dbsetting->module, setting, (WORD)settingValue); break; case 2: if (IsDlgButtonChecked(hwnd, CHK_HEX)) sscanf(value, "%x", &settingValue); else sscanf(value, "%d", &settingValue); - DBWriteContactSettingDword(dbsetting->hContact, dbsetting->module, setting, (DWORD)settingValue); + db_set_dw(dbsetting->hContact, dbsetting->module, setting, (DWORD)settingValue); break; case 3: if (dbsetting->dbv.type == DBVT_UTF8) - DBWriteContactSettingWString(dbsetting->hContact, dbsetting->module, setting, (WCHAR*)value); + db_set_ws(dbsetting->hContact, dbsetting->module, setting, (WCHAR*)value); else if (dbsetting->dbv.type == DBVT_BLOB) WriteBlobFromString(dbsetting->hContact,dbsetting->module,setting,value,valueLength); else if (dbsetting->dbv.type == DBVT_ASCIIZ) - DBWriteContactSettingString(dbsetting->hContact, dbsetting->module, setting, value); + db_set_s(dbsetting->hContact, dbsetting->module, setting, value); break; } diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 28ee01a696..50077160a8 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -16,26 +16,26 @@ void copyModule(char* module, HANDLE hContactFrom, HANDLE hContactTo) switch (dbv.type) { case DBVT_BYTE: - DBWriteContactSettingByte(hContactTo, module, setting->name, dbv.bVal); + db_set_b(hContactTo, module, setting->name, dbv.bVal); break; case DBVT_WORD: - DBWriteContactSettingWord(hContactTo, module, setting->name, dbv.wVal); + db_set_w(hContactTo, module, setting->name, dbv.wVal); break; case DBVT_DWORD: - DBWriteContactSettingDword(hContactTo, module, setting->name, dbv.dVal); + db_set_dw(hContactTo, module, setting->name, dbv.dVal); break; case DBVT_ASCIIZ: - DBWriteContactSettingString(hContactTo, module, setting->name, dbv.pszVal); + db_set_s(hContactTo, module, setting->name, dbv.pszVal); break; case DBVT_UTF8: - DBWriteContactSettingStringUtf(hContactTo, module, setting->name, dbv.pszVal); + db_set_utf(hContactTo, module, setting->name, dbv.pszVal); break; case DBVT_BLOB: DBWriteContactSettingBlob(hContactTo, module, setting->name, dbv.pbVal, dbv.cpbVal); break; } } - DBFreeVariant(&dbv); + db_free(&dbv); setting = (struct ModSetLinkLinkItem *)setting->next; } FreeModuleSettingLL(&msll); diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index e55845d7bb..15998e74ad 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -11,14 +11,11 @@ int deleteModule(char* module, HANDLE hContact, int fromMenu) if (!module) return 0; - if (!fromMenu) - { + if (!fromMenu) { mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete module \"%s\"?"), module); - if (DBGetContactSettingByte(NULL,modname, "WarnOnDelete",1)) - { + if (db_get_b(NULL,modname, "WarnOnDelete",1)) if (MessageBox(0,msg, Translate("Confirm Module Deletion"), MB_YESNO|MB_ICONEXCLAMATION) == IDNO) return 0; - } } if (!EnumSettings(hContact,module,&settinglist)) return 0; @@ -26,7 +23,7 @@ int deleteModule(char* module, HANDLE hContact, int fromMenu) setting = settinglist.first; while (setting) { - DBDeleteContactSetting(hContact, module, setting->name); + db_unset(hContact, module, setting->name); setting = (struct ModSetLinkLinkItem *)setting->next; } FreeModuleSettingLL(&settinglist); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 5f8006e9ec..4c978e28f2 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -101,15 +101,15 @@ void exportModule(HANDLE hContact, char* module, FILE* file) { case DBVT_BYTE: fprintf(file, "\n%s=b%s", setting->name, itoa(dbv.bVal,tmp,10)); - DBFreeVariant(&dbv); + db_free(&dbv); break; case DBVT_WORD: fprintf(file, "\n%s=w%s", setting->name, itoa(dbv.wVal,tmp,10)); - DBFreeVariant(&dbv); + db_free(&dbv); break; case DBVT_DWORD: fprintf(file, "\n%s=d%s", setting->name, itoa(dbv.dVal,tmp,10)); - DBFreeVariant(&dbv); + db_free(&dbv); break; case DBVT_ASCIIZ: case DBVT_UTF8: @@ -125,7 +125,7 @@ void exportModule(HANDLE hContact, char* module, FILE* file) fprintf(file, "\n%s=u%s", setting->name, dbv.pszVal); else fprintf(file, "\n%s=s%s", setting->name, dbv.pszVal); - DBFreeVariant(&dbv); + db_free(&dbv); break; case DBVT_BLOB: { @@ -143,7 +143,7 @@ void exportModule(HANDLE hContact, char* module, FILE* file) fprintf(file,"\n%s=n%s",setting->name , data); mir_free(data); } - DBFreeVariant(&dbv); + db_free(&dbv); break; } } @@ -372,10 +372,10 @@ HANDLE Clist_GroupExists(WCHAR *tszGroup) do { _itoa(i, str, 10); - result = DBGetContactSettingTString(0, "CListGroups", str, &dbv); + result = db_get_ts(0, "CListGroups", str, &dbv); if (!result) { match = (!lstrcmpW(tszGroup, (LPCWSTR)&dbv.ptszVal[1]) && (lstrlenW(tszGroup) == lstrlenW((LPCWSTR)&dbv.ptszVal[1]))); - DBFreeVariant(&dbv); + db_free(&dbv); if(match) return((HANDLE)(i + 1)); } @@ -501,21 +501,21 @@ void importSettings(HANDLE hContact, char *importstring ) case 'b': case 'B': if (sscanf((end+2), "%d", &value) == 1) - DBWriteContactSettingByte(hContact, module, setting, (BYTE)value); + db_set_b(hContact, module, setting, (BYTE)value); break; case 'w': case 'W': if (sscanf((end+2), "%d", &value) == 1) - DBWriteContactSettingWord(hContact, module, setting, (WORD)value); + db_set_w(hContact, module, setting, (WORD)value); break; case 'd': case 'D': if (sscanf((end+2), "%d", &value) == 1) - DBWriteContactSettingDword(hContact, module, setting, (DWORD)value); + db_set_dw(hContact, module, setting, (DWORD)value); break; case 's': case 'S': - DBWriteContactSettingString(hContact,module, setting, (end+2)); + db_set_s(hContact,module, setting, (end+2)); break; case 'g': case 'G': @@ -532,11 +532,11 @@ void importSettings(HANDLE hContact, char *importstring ) } } } case 'u': case 'U': - DBWriteContactSettingStringUtf(hContact,module, setting, (end+2)); + db_set_utf(hContact,module, setting, (end+2)); break; case 'l': case 'L': - DBDeleteContactSetting(hContact, module, setting); + db_unset(hContact, module, setting); break; case 'n': case 'N': diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index e8fd22aa70..08a9a3e5c4 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -353,7 +353,7 @@ int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *set if ((!cws.value.pszVal && !replace[0]) || (cws.value.pszVal && !cws.value.pszVal[0])) { ItemFound(hwnd,hContact,module,setting,NULL,FW_SETTINGNAME|FW_DELETED); - DBDeleteContactSetting(hContact,module,setting); + db_unset(hContact,module,setting); mir_free(myreplace); return 1; } @@ -390,7 +390,7 @@ int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *s if (cws.szSetting[0]==0) { ItemFound(hwnd,hContact,module,setting,NULL,FW_SETTINGNAME|FW_DELETED); - DBDeleteContactSetting(hContact,module,setting); + db_unset(hContact,module,setting); mir_free(myreplace); return 1; } @@ -410,12 +410,12 @@ int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *s if (!CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)) { count++; - DBDeleteContactSetting(hContact,module,setting); + db_unset(hContact,module,setting); ItemFound(hwnd,hContact,module,cws.szSetting,NULL,FW_SETTINGNAME|FW_REPLACED); } } else - DBFreeVariant(&dbv2); + db_free(&dbv2); mir_free(myreplace); @@ -465,27 +465,27 @@ int replaceModule(HWND hwnd, HANDLE hContact, const char *module, const char *fi switch (dbv.type) { case DBVT_BYTE: - DBWriteContactSettingByte(hContact, newModule, setting->name, dbv.bVal); + db_set_b(hContact, newModule, setting->name, dbv.bVal); break; case DBVT_WORD: - DBWriteContactSettingWord(hContact, newModule, setting->name, dbv.wVal); + db_set_w(hContact, newModule, setting->name, dbv.wVal); break; case DBVT_DWORD: - DBWriteContactSettingDword(hContact, newModule, setting->name, dbv.dVal); + db_set_dw(hContact, newModule, setting->name, dbv.dVal); break; case DBVT_ASCIIZ: - DBWriteContactSettingString(hContact, newModule, setting->name, dbv.pszVal); + db_set_s(hContact, newModule, setting->name, dbv.pszVal); break; case DBVT_UTF8: - DBWriteContactSettingStringUtf(hContact, newModule, setting->name, dbv.pszVal); + db_set_utf(hContact, newModule, setting->name, dbv.pszVal); break; case DBVT_BLOB: DBWriteContactSettingBlob(hContact, newModule, setting->name, dbv.pbVal, dbv.cpbVal); break; } - DBFreeVariant(&dbv); - DBDeleteContactSetting(hContact, module, setting->name); + db_free(&dbv); + db_unset(hContact, module, setting->name); } setting = (struct ModSetLinkLinkItem *)setting->next; @@ -645,7 +645,7 @@ void __cdecl FindSettings(LPVOID di) break; } - DBFreeVariant(&dbv); + db_free(&dbv); } } @@ -659,7 +659,7 @@ void __cdecl FindSettings(LPVOID di) if (!GetSetting(hContact,module->name,setting->name,&dbv)) { replaceCount += replaceSetting(hwnd, hContact, module->name, setting->name, &dbv, text, replace, mode); - DBFreeVariant(&dbv); + db_free(&dbv); } } else diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 2e8688d5b9..3789be8e32 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -61,7 +61,7 @@ int AddIconToList(HIMAGELIST hil, HICON hIcon); void AddProtoIconsToList(HIMAGELIST hil, int newshift); int GetProtoIcon(char *szProto); extern HANDLE hRestore; -extern HANDLE hUserMenu; +extern HGENMENU hUserMenu; ///////////////////// #ifndef NDEBUG diff --git a/plugins/DbEditorPP/src/knownmodules.cpp b/plugins/DbEditorPP/src/knownmodules.cpp index 13c4379f6b..4e44aa740c 100644 --- a/plugins/DbEditorPP/src/knownmodules.cpp +++ b/plugins/DbEditorPP/src/knownmodules.cpp @@ -60,7 +60,7 @@ void doOldKnownModulesList() setting = msll.first; while(setting) { - if (!DBGetContactSetting(NULL,"KnownModules",setting->name,&dbv) && dbv.type == DBVT_ASCIIZ) + if (!db_get(NULL,"KnownModules",setting->name,&dbv) && dbv.type == DBVT_ASCIIZ) { temp = (char*)mir_alloc((strlen(dbv.pszVal)+5)*sizeof(char)); if (!temp) break; @@ -75,10 +75,10 @@ void doOldKnownModulesList() } mir_free(temp); } - DBFreeVariant(&dbv); + db_free(&dbv); setting = (struct ModSetLinkLinkItem *)setting->next; } FreeModuleSettingLL(&msll); - UseKnownModList = DBGetContactSettingByte(NULL,modname,"UseKnownModList",0); + UseKnownModList = db_get_b(NULL,modname,"UseKnownModList",0); } diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 7bc8b290fa..3c36401da3 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -8,9 +8,9 @@ BOOL usePopUps; HWND hwnd2watchedVarsWindow; int hLangpack; BYTE nameOrder[NAMEORDERCOUNT]; -HANDLE hUserMenu; -HANDLE hRestore; +HGENMENU hUserMenu; WatchListArrayStruct WatchListArray; +HANDLE hRestore; HANDLE sMenuCommand, sRegisterModule, sRegisterSingleModule, sImport, sServicemodeLaunch; HANDLE hModulesLoadedHook = NULL, hSettingsChangedHook=NULL, hOptInitHook=NULL, hPreShutdownHook=NULL; @@ -166,7 +166,7 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = 1900000001; - mi.flags = DBGetContactSettingByte(NULL,modname,"UserMenuItem",0)?0:CMIF_HIDDEN; + mi.flags = db_get_b(NULL,modname,"UserMenuItem",0) ? 0 : CMIF_HIDDEN; mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGUSER)); mi.pszName = LPGEN("Open user tree in DBE++"); mi.pszService = "DBEditorpp/MenuCommand"; @@ -187,10 +187,10 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) char mod[64] = ""; TCHAR szModuleFileName[MAX_PATH]; int i=0, len; - if (!DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) + if (!db_get(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) mods = dbv.pszVal; else { - DBWriteContactSettingString(NULL,modname,"CoreModules",coreMods); + db_set_s(NULL,modname,"CoreModules",coreMods); mods = coreMods; } @@ -218,18 +218,18 @@ int ModulesLoaded(WPARAM wParam,LPARAM lParam) if (GetModuleFileName(hInst, szModuleFileName, MAX_PATH)) addIcons(szModuleFileName); - DBFreeVariant(&dbv); + db_free(&dbv); UnhookEvent(hModulesLoadedHook); - usePopUps = DBGetContactSettingByte(NULL,modname,"UsePopUps",0); + usePopUps = db_get_b(NULL,modname,"UsePopUps",0); // Load the name order for(i=0; i < NAMEORDERCOUNT; i++) nameOrder[i] = i; - if (!DBGetContactSetting(NULL,"Contact","NameOrder",&dbv)) { + if (!db_get(NULL,"Contact","NameOrder",&dbv)) { CopyMemory(nameOrder,dbv.pbVal,dbv.cpbVal); - DBFreeVariant(&dbv); + db_free(&dbv); } HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); @@ -311,21 +311,21 @@ extern "C" __declspec(dllexport) int Unload(void) //======================================================= -//DBGetContactSettingString (prob shouldnt use this unless u know how big the string is gonna be..) +//db_get_s (prob shouldnt use this unless u know how big the string is gonna be..) //======================================================= int DBGetContactSettingStringStatic(HANDLE hContact, char* szModule, char* szSetting, char* value, int maxLength) { DBVARIANT dbv; - if (!DBGetContactSetting(hContact, szModule, szSetting, &dbv)) + if (!db_get(hContact, szModule, szSetting, &dbv)) { strncpy(value, dbv.pszVal, maxLength); - DBFreeVariant(&dbv); + db_free(&dbv); return 1; } else { - DBFreeVariant(&dbv); + db_free(&dbv); return 0; } @@ -407,7 +407,7 @@ int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* break; } - DBFreeVariant(&dbv); + db_free(&dbv); Value[length-1] = 0; return 1; @@ -457,7 +457,7 @@ int GetValueW(HANDLE hContact, const char* szModule, const char* szSetting, WCHA break; } - DBFreeVariant(&dbv); + db_free(&dbv); Value[length-1] = 0; return 1; diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 814361037d..64b2534f94 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -122,7 +122,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM } } else if ((mtis->type == CONTACT) && hContact) { - if (DBGetContactSettingByte(NULL,"CList", "ConfirmDelete",1)) { + if (db_get_b(NULL,"CList", "ConfirmDelete",1)) { char msg[1024]; mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module); if (MessageBox(0,msg, Translate("Confirm Contact Delete"), MB_YESNO|MB_ICONEXCLAMATION) == IDNO) @@ -199,7 +199,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowText(hwnd, TranslateT("Database Editor++")); // setup the splitter - SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA,(LPARAM)DBGetContactSettingWord(NULL, modname, "Splitter", 300)); + SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA,(LPARAM)db_get_w(NULL, modname, "Splitter", 300)); SendMessage(hwnd, GC_SPLITTERMOVED, 0,0); mir_subclassWindow(GetDlgItem(hwnd,IDC_SPLITTER), SplitterSubclassProc); // module tree @@ -215,8 +215,8 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TranslateMenu(GetSubMenu(hMenu,i)); // move the dialog to the users position - MoveWindow(hwnd,DBGetContactSettingDword(NULL,modname,"x",0),DBGetContactSettingDword(NULL,modname,"y",0),DBGetContactSettingDword(NULL,modname,"width",500),DBGetContactSettingDword(NULL,modname,"height",250),0); - if (DBGetContactSettingByte(NULL,modname,"Maximised",0)) { + MoveWindow(hwnd,db_get_dw(NULL,modname,"x",0),db_get_dw(NULL,modname,"y",0),db_get_dw(NULL,modname,"width",500),db_get_dw(NULL,modname,"height",250),0); + if (db_get_b(NULL,modname,"Maximised",0)) { WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); wp.flags = WPF_RESTORETOMAXIMIZED; @@ -229,14 +229,14 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) Mode = MODE_ALL; CheckMenuItem(GetSubMenu(hMenu,5),MENU_FILTER_ALL,MF_BYCOMMAND|MF_CHECKED); - Hex = DBGetContactSettingByte(NULL,modname,"HexMode",0); + Hex = db_get_b(NULL,modname,"HexMode",0); CheckMenuItem(GetSubMenu(hMenu,5),MENU_BYTE_HEX,MF_BYCOMMAND|((Hex & HEX_BYTE)?MF_CHECKED:MF_UNCHECKED)); CheckMenuItem(GetSubMenu(hMenu,5),MENU_WORD_HEX,MF_BYCOMMAND|((Hex & HEX_WORD)?MF_CHECKED:MF_UNCHECKED)); CheckMenuItem(GetSubMenu(hMenu,5),MENU_DWORD_HEX,MF_BYCOMMAND|((Hex & HEX_DWORD)?MF_CHECKED:MF_UNCHECKED)); - CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SAVE_POSITION,MF_BYCOMMAND|(DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1)?MF_CHECKED:MF_UNCHECKED)); + CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SAVE_POSITION,MF_BYCOMMAND|(db_get_b(NULL,modname,"RestoreOnOpen",1)?MF_CHECKED:MF_UNCHECKED)); - Order = DBGetContactSettingByte(NULL,modname,"SortMode",1); + Order = db_get_b(NULL,modname,"SortMode",1); CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SORT_ORDER,MF_BYCOMMAND|(Order?MF_CHECKED:MF_UNCHECKED)); // image list @@ -298,7 +298,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int restore; if (hRestore) restore = 3; - else if (DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1)) + else if (db_get_b(NULL,modname,"RestoreOnOpen",1)) restore = 2; else restore = 0; @@ -327,7 +327,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (splitterPos<65) splitterPos=65; if (splitterPos > rc2.right-rc2.left-65) splitterPos=rc2.right-rc2.left-65; SetWindowLongPtr(GetDlgItem(hwnd,IDC_SPLITTER),GWLP_USERDATA, splitterPos); - DBWriteContactSettingWord(NULL, modname, "Splitter",(WORD)splitterPos); + db_set_w(NULL, modname, "Splitter",(WORD)splitterPos); } PostMessage(hwnd,WM_SIZE,0,0); } @@ -359,14 +359,14 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd); if (msg == WM_SIZE && wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED) - DBWriteContactSettingByte(NULL,modname,"Maximised",1); + db_set_b(NULL,modname,"Maximised",1); else if (msg == WM_SIZE && wParam == SIZE_RESTORED) - DBWriteContactSettingByte(NULL,modname,"Maximised",0); + db_set_b(NULL,modname,"Maximised",0); } break; case WM_DESTROY: // free our shit! - if (DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1)) { + if (db_get_b(NULL,modname,"RestoreOnOpen",1)) { HTREEITEM item; HWND hwnd2Tree = GetDlgItem(hwnd,IDC_MODULES); char module[256] = {0}; @@ -385,16 +385,16 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) type = mtis->type; } - DBWriteContactSettingDword(NULL,modname,"LastContact",(DWORD)hContact); + db_set_dw(NULL,modname,"LastContact",(DWORD)hContact); if (type == CONTACT) - DBWriteContactSettingString(NULL,modname,"LastModule",""); + db_set_s(NULL,modname,"LastModule",""); else - DBWriteContactSettingString(NULL,modname,"LastModule",module); + db_set_s(NULL,modname,"LastModule",module); } else { - DBDeleteContactSetting(NULL,modname,"LastContact"); - DBDeleteContactSetting(NULL,modname,"LastModule"); + db_unset(NULL,modname,"LastContact"); + db_unset(NULL,modname,"LastModule"); } HWND hwnd2Settings = GetDlgItem(hwnd, IDC_SETTINGS); @@ -403,13 +403,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (pos != -1) { char text[256]; ListView_GetItemText(hwnd2Settings, pos, 0, text, SIZEOF(text)); - DBWriteContactSettingString(NULL,modname,"LastSetting",text); + db_set_s(NULL,modname,"LastSetting",text); } - else DBDeleteContactSetting(NULL,modname,"LastSetting"); + else db_unset(NULL,modname,"LastSetting"); } } - DBWriteContactSettingByte(NULL,modname,"HexMode",(byte)Hex); - DBWriteContactSettingByte(NULL,modname,"SortMode",(byte)Order); + db_set_b(NULL,modname,"HexMode",(byte)Hex); + db_set_b(NULL,modname,"SortMode",(byte)Order); saveListSettings(GetDlgItem(hwnd,IDC_SETTINGS)); hwnd2mainWindow = 0; ClearListview(GetDlgItem(hwnd,IDC_SETTINGS)); @@ -419,13 +419,13 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (himl2) ImageList_Destroy(himl2); - if (!DBGetContactSettingByte(NULL,modname,"Maximised",0)) { + if (!db_get_b(NULL,modname,"Maximised",0)) { RECT rc; GetWindowRect(hwnd,&rc); - DBWriteContactSettingDword(NULL,modname,"x",rc.left); - DBWriteContactSettingDword(NULL,modname,"y",rc.top); - DBWriteContactSettingDword(NULL,modname,"width",rc.right-rc.left); - DBWriteContactSettingDword(NULL,modname,"height",rc.bottom-rc.top); + db_set_dw(NULL,modname,"x",rc.left); + db_set_dw(NULL,modname,"y",rc.top); + db_set_dw(NULL,modname,"width",rc.right-rc.left); + db_set_dw(NULL,modname,"height",rc.bottom-rc.top); } if (hwnd2importWindow) { @@ -543,9 +543,9 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case MENU_SAVE_POSITION: { - BOOL save = !DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1); + BOOL save = !db_get_b(NULL,modname,"RestoreOnOpen",1); CheckMenuItem(GetSubMenu(GetMenu(hwnd),5),MENU_SAVE_POSITION,MF_BYCOMMAND|(save?MF_CHECKED:MF_UNCHECKED)); - DBWriteContactSettingByte(NULL,modname,"RestoreOnOpen", (byte)save); + db_set_b(NULL,modname,"RestoreOnOpen", (byte)save); } break; case MENU_SORT_ORDER: diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index 2e650b2fe4..faeae05035 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -17,28 +17,28 @@ void renameModule(char* oldName, char* newName, HANDLE hContact) switch (dbv.type) { case DBVT_BYTE: - DBWriteContactSettingByte(hContact, newName, setting->name, dbv.bVal); + db_set_b(hContact, newName, setting->name, dbv.bVal); break; case DBVT_WORD: - DBWriteContactSettingWord(hContact, newName, setting->name, dbv.wVal); + db_set_w(hContact, newName, setting->name, dbv.wVal); break; case DBVT_DWORD: - DBWriteContactSettingDword(hContact, newName, setting->name, dbv.dVal); + db_set_dw(hContact, newName, setting->name, dbv.dVal); break; case DBVT_ASCIIZ: - DBWriteContactSettingString(hContact, newName, setting->name, dbv.pszVal); + db_set_s(hContact, newName, setting->name, dbv.pszVal); break; case DBVT_UTF8: - DBWriteContactSettingStringUtf(hContact, newName, setting->name, dbv.pszVal); + db_set_utf(hContact, newName, setting->name, dbv.pszVal); break; case DBVT_BLOB: DBWriteContactSettingBlob(hContact, newName, setting->name, dbv.pbVal, dbv.cpbVal); break; } - DBDeleteContactSetting(hContact, oldName, setting->name); + db_unset(hContact, oldName, setting->name); } - DBFreeVariant(&dbv); + db_free(&dbv); setting = (struct ModSetLinkLinkItem *)setting->next; } FreeModuleSettingLL(&settinglist); @@ -65,16 +65,16 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam { HANDLE hContact = db_find_first(); // null contact - DBWriteContactSettingByte(NULL, modulename, "(Default)", 0); + db_set_b(NULL, modulename, "(Default)", 0); while (hContact) { - DBWriteContactSettingByte(hContact, modulename, "(Default)", 0); + db_set_b(hContact, modulename, "(Default)", 0); hContact = db_find_next(hContact); } } else { - DBWriteContactSettingByte((HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA), modulename, "(Default)", 0); + db_set_b((HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA), modulename, "(Default)", 0); } refreshTree(1); } diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index ea520eacc2..4c6d4a0e47 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -379,7 +379,7 @@ void replaceTreeItem(HWND hwnd, HANDLE hContact, const char *module, const char void refreshTree(int restore) { - UseKnownModList = DBGetContactSettingByte(NULL,modname,"UseKnownModList",0); + UseKnownModList = db_get_b(NULL,modname,"UseKnownModList",0); if (populating) return; populating = 1; forkthread(PopulateModuleTreeThreadFunc,0,(HWND)restore); @@ -433,7 +433,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) } case 2: // restore saved if (GetValue(NULL,modname,"LastModule",SelectedModule,SIZEOF(SelectedModule))) { - hSelectedContact = (HANDLE)DBGetContactSettingDword(NULL,modname,"LastContact",(DWORD)INVALID_HANDLE_VALUE); + hSelectedContact = (HANDLE)db_get_dw(NULL,modname,"LastContact",(DWORD)INVALID_HANDLE_VALUE); if (hSelectedContact != INVALID_HANDLE_VALUE) Select = 1; GetValue(NULL,modname,"LastSetting",SelectedSetting,SIZEOF(SelectedSetting)); @@ -527,7 +527,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) module = (struct ModSetLinkLinkItem *)module->next; } - if (DBGetContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",0)) + if (db_get_b(NULL,modname,"ExpandSettingsOnOpen",0)) TreeView_Expand(hwnd2Tree,contact,TVE_EXPAND); if (Select && hSelectedContact == NULL) @@ -902,14 +902,14 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i else strncat(moduletemp,&module[i],1); } - if ( !DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) { + if ( !db_get(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) { int len = (int)strlen(dbv.pszVal) + 10 + (int)strlen(moduletemp); char* temp = (char*)_alloca(len); mir_snprintf(temp, len, "%s, %s", dbv.pszVal, moduletemp); - DBWriteContactSettingString(NULL,modname,"CoreModules",temp); - DBFreeVariant(&dbv); + db_set_s(NULL,modname,"CoreModules",temp); + db_free(&dbv); } - else DBWriteContactSettingString(NULL,modname,"CoreModules",moduletemp); + else db_set_s(NULL,modname,"CoreModules",moduletemp); RegisterSingleModule((WPARAM)module,0); } break; @@ -925,7 +925,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i break; case MENU_DELETE_CONTACT: - if (DBGetContactSettingByte(NULL,"CList", "ConfirmDelete",1)) { + if (db_get_b(NULL,"CList", "ConfirmDelete",1)) { char msg[1024]; mir_snprintf(msg, SIZEOF(msg), Translate("Are you sure you want to delete contact \"%s\"?"), module); if (MessageBox(0,msg, Translate("Confirm Contact Delete"), MB_YESNO|MB_ICONEXCLAMATION) == IDYES) { diff --git a/plugins/DbEditorPP/src/options.cpp b/plugins/DbEditorPP/src/options.cpp index ba822c7321..17d69981d6 100644 --- a/plugins/DbEditorPP/src/options.cpp +++ b/plugins/DbEditorPP/src/options.cpp @@ -9,17 +9,17 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { bInitDone = false; DBVARIANT dbv; - CheckDlgButton(hwnd,IDC_EXPANDSETTINGS,DBGetContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",0)); - CheckDlgButton(hwnd,IDC_RESTORESETTINGS,DBGetContactSettingByte(NULL,modname,"RestoreOnOpen",1)); - CheckDlgButton(hwnd,IDC_USEKNOWNMODS,DBGetContactSettingByte(NULL,modname,"UseKnownModList",0)); - CheckDlgButton(hwnd,IDC_WARNONDEL,DBGetContactSettingByte(NULL,modname,"WarnOnDelete",1)); - CheckDlgButton(hwnd,IDC_MENU,DBGetContactSettingByte(NULL,modname,"UserMenuItem",0)); + CheckDlgButton(hwnd,IDC_EXPANDSETTINGS,db_get_b(NULL,modname,"ExpandSettingsOnOpen",0)); + CheckDlgButton(hwnd,IDC_RESTORESETTINGS,db_get_b(NULL,modname,"RestoreOnOpen",1)); + CheckDlgButton(hwnd,IDC_USEKNOWNMODS,db_get_b(NULL,modname,"UseKnownModList",0)); + CheckDlgButton(hwnd,IDC_WARNONDEL,db_get_b(NULL,modname,"WarnOnDelete",1)); + CheckDlgButton(hwnd,IDC_MENU,db_get_b(NULL,modname,"UserMenuItem",0)); CheckDlgButton(hwnd,IDC_POPUPS,usePopUps); - if (!DBGetContactSetting(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) + if (!db_get(NULL,modname,"CoreModules",&dbv) && dbv.type == DBVT_ASCIIZ) SetDlgItemText(hwnd,IDC_MODULES,dbv.pszVal); - DBFreeVariant(&dbv); - SetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,DBGetContactSettingWord(NULL,modname,"PopupDelay",4),0); - SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)DBGetContactSettingDword(NULL,modname,"PopupColour",RGB(255,0,0))); + db_free(&dbv); + SetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,db_get_w(NULL,modname,"PopupDelay",4),0); + SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_SETCOLOUR, 0, (LPARAM)db_get_dw(NULL,modname,"PopupColour",RGB(255,0,0))); TranslateDialogDefault(hwnd); bInitDone = true; } @@ -52,25 +52,19 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case PSN_APPLY: { char mods[4096]; - DBWriteContactSettingByte(NULL,modname,"ExpandSettingsOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_EXPANDSETTINGS)); - DBWriteContactSettingByte(NULL,modname,"RestoreOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_RESTORESETTINGS)); - DBWriteContactSettingByte(NULL,modname,"WarnOnDelete",(BYTE)IsDlgButtonChecked(hwnd,IDC_WARNONDEL)); - DBWriteContactSettingByte(NULL,modname,"UserMenuItem",(BYTE)IsDlgButtonChecked(hwnd,IDC_MENU)); - DBWriteContactSettingByte(NULL,modname,"UseKnownModList",(BYTE)IsDlgButtonChecked(hwnd,IDC_USEKNOWNMODS)); + db_set_b(NULL,modname,"ExpandSettingsOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_EXPANDSETTINGS)); + db_set_b(NULL,modname,"RestoreOnOpen",(BYTE)IsDlgButtonChecked(hwnd,IDC_RESTORESETTINGS)); + db_set_b(NULL,modname,"WarnOnDelete",(BYTE)IsDlgButtonChecked(hwnd,IDC_WARNONDEL)); + db_set_b(NULL,modname,"UserMenuItem",(BYTE)IsDlgButtonChecked(hwnd,IDC_MENU)); + db_set_b(NULL,modname,"UseKnownModList",(BYTE)IsDlgButtonChecked(hwnd,IDC_USEKNOWNMODS)); usePopUps = IsDlgButtonChecked(hwnd,IDC_POPUPS); - DBWriteContactSettingByte(NULL,modname,"UsePopUps",(BYTE)usePopUps); + db_set_b(NULL,modname,"UsePopUps",(BYTE)usePopUps); if (GetDlgItemText(hwnd,IDC_MODULES,mods,4096)) - DBWriteContactSettingString(NULL,modname,"CoreModules",mods); - DBWriteContactSettingWord(NULL,modname,"PopupDelay",(WORD)GetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,NULL,0)); - DBWriteContactSettingDword(NULL,modname,"PopupColour",(DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0)); + db_set_s(NULL,modname,"CoreModules",mods); + db_set_w(NULL,modname,"PopupDelay",(WORD)GetDlgItemInt(hwnd,IDC_POPUPTIMEOUT,NULL,0)); + db_set_dw(NULL,modname,"PopupColour",(DWORD)SendDlgItemMessage(hwnd, IDC_COLOUR, CPM_GETCOLOUR, 0, 0)); - CLISTMENUITEM mi = { sizeof(mi) }; - if (!IsDlgButtonChecked(hwnd,IDC_MENU)) - mi.flags = CMIM_FLAGS | CMIF_HIDDEN; - else - mi.flags = CMIM_FLAGS; - - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hUserMenu, (LPARAM) & mi); + Menu_ShowItem(hUserMenu, IsDlgButtonChecked(hwnd,IDC_MENU)); } return TRUE; } diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 3afbc56629..816244d8ec 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -11,16 +11,16 @@ void setupSettingsList(HWND hwnd2List) sLC.mask = LVCF_FMT | LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH; sLC.pszText = Translate("Name"); - sLC.cx = DBGetContactSettingWord(NULL, modname, "Column0width", 145); + sLC.cx = db_get_w(NULL, modname, "Column0width", 145); ListView_InsertColumn(hwnd2List,0,&sLC); sLC.pszText = Translate("Data"); - sLC.cx = DBGetContactSettingWord(NULL, modname, "Column1width", 145); + sLC.cx = db_get_w(NULL, modname, "Column1width", 145); ListView_InsertColumn(hwnd2List,1,&sLC); sLC.pszText = Translate("Type"); - sLC.cx = DBGetContactSettingWord(NULL, modname, "Column2width", 60); + sLC.cx = db_get_w(NULL, modname, "Column2width", 60); ListView_InsertColumn(hwnd2List,2,&sLC); sLC.pszText = Translate("Size"); - sLC.cx = DBGetContactSettingWord(NULL, modname, "Column3width", 80); + sLC.cx = db_get_w(NULL, modname, "Column3width", 80); ListView_InsertColumn(hwnd2List,3,&sLC); } @@ -37,7 +37,7 @@ void saveListSettings(HWND hwnd2List) if (ListView_GetColumn(hwnd2List,i,&sLC)) { mir_snprintf(tmp, SIZEOF(tmp), "Column%dwidth", i); - DBWriteContactSettingWord(NULL, modname, tmp, (WORD)sLC.cx); + db_set_w(NULL, modname, tmp, (WORD)sLC.cx); } } @@ -68,7 +68,7 @@ void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char else if (count == 1) { - DBDeleteContactSetting(hContact,module,setting); + db_unset(hContact,module,setting); } else { @@ -81,7 +81,7 @@ void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char if (ListView_GetItemState(hSettings,i,LVIS_SELECTED)) { ListView_GetItemText(hSettings, i, 0, text, SIZEOF(text)); - DBDeleteContactSetting(hContact,module,text); + db_unset(hContact,module,text); items--; } else @@ -224,7 +224,7 @@ void additem(HWND hwnd2Settings,HANDLE hContact, char* module, char* setting, in else ListView_DeleteItem(hwnd2Settings,index); - DBFreeVariant(&dbv); + db_free(&dbv); mir_free(data); } @@ -322,14 +322,14 @@ typedef struct { void writeStandardTextfromLabel(EditLabelInfoStruct* info, char* value, WCHAR *wc, int type) { if (type != DBVT_ASCIIZ && type != DBVT_UTF8) - DBDeleteContactSetting(info->hContact,info->module,info->setting); + db_unset(info->hContact,info->module,info->setting); if (type == DBVT_UTF8 && wc) { - DBWriteContactSettingWString(info->hContact,info->module,info->setting,wc); + db_set_ws(info->hContact,info->module,info->setting,wc); mir_free(wc); } else - DBWriteContactSettingString(info->hContact,info->module,info->setting,value); + db_set_s(info->hContact,info->module,info->setting,value); } @@ -389,32 +389,32 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w case 0:// setting name if (!mir_strcmp(info->setting,value) || mir_strlen(value)>255) { - DBFreeVariant(&dbv); + db_free(&dbv); SendMessage(hwnd,WM_COMMAND,MAKEWPARAM(IDCANCEL,0),0); return 0; } switch (dbv.type) { case DBVT_UTF8: - DBWriteContactSettingStringUtf(info->hContact,info->module,value,dbv.pszVal); + db_set_utf(info->hContact,info->module,value,dbv.pszVal); break; case DBVT_ASCIIZ: - DBWriteContactSettingString(info->hContact,info->module,value,dbv.pszVal); + db_set_s(info->hContact,info->module,value,dbv.pszVal); break; case DBVT_BYTE: - DBWriteContactSettingByte(info->hContact,info->module,value,dbv.bVal); + db_set_b(info->hContact,info->module,value,dbv.bVal); break; case DBVT_WORD: - DBWriteContactSettingWord(info->hContact,info->module,value,dbv.wVal); + db_set_w(info->hContact,info->module,value,dbv.wVal); break; case DBVT_DWORD: - DBWriteContactSettingDword(info->hContact,info->module,value,dbv.dVal); + db_set_dw(info->hContact,info->module,value,dbv.dVal); break; case DBVT_BLOB: DBWriteContactSettingBlob(info->hContact,info->module,value,dbv.pbVal,dbv.cpbVal); break; } - DBDeleteContactSetting(info->hContact,info->module,info->setting); + db_unset(info->hContact,info->module,info->setting); { LVFINDINFO lvfi; int item; @@ -448,9 +448,9 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w { val = atoi(&value[1]); if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) - DBDeleteContactSetting(info->hContact,info->module,info->setting); + db_unset(info->hContact,info->module,info->setting); - DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val); + db_set_b(info->hContact,info->module,info->setting,(BYTE)val); } else writeStandardTextfromLabel(info, value, wc, dbv.type); @@ -463,8 +463,8 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w { val = atoi(&value[1]); if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) - DBDeleteContactSetting(info->hContact,info->module,info->setting); - DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val); + db_unset(info->hContact,info->module,info->setting); + db_set_w(info->hContact,info->module,info->setting,(WORD)val); } else writeStandardTextfromLabel(info, value, wc, dbv.type); @@ -477,8 +477,8 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w { val = atoi(&value[1]); if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) - DBDeleteContactSetting(info->hContact,info->module,info->setting); - DBWriteContactSettingDword(info->hContact,info->module,info->setting,val); + db_unset(info->hContact,info->module,info->setting); + db_set_dw(info->hContact,info->module,info->setting,val); } else writeStandardTextfromLabel(info, value, wc, dbv.type); @@ -498,13 +498,13 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, value, wc, dbv.type); break; case DBVT_BYTE: - DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val); + db_set_b(info->hContact,info->module,info->setting,(BYTE)val); break; case DBVT_WORD: - DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val); + db_set_w(info->hContact,info->module,info->setting,(WORD)val); break; case DBVT_DWORD: - DBWriteContactSettingDword(info->hContact,info->module,info->setting,(DWORD)val); + db_set_dw(info->hContact,info->module,info->setting,(DWORD)val); break; } } @@ -518,13 +518,13 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, value, wc, dbv.type); break; case DBVT_BYTE: - DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val); + db_set_b(info->hContact,info->module,info->setting,(BYTE)val); break; case DBVT_WORD: - DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val); + db_set_w(info->hContact,info->module,info->setting,(WORD)val); break; case DBVT_DWORD: - DBWriteContactSettingDword(info->hContact,info->module,info->setting,(DWORD)val); + db_set_dw(info->hContact,info->module,info->setting,(DWORD)val); break; } } @@ -563,13 +563,13 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w writeStandardTextfromLabel(info, value, wc, dbv.type); break; case DBVT_BYTE: - DBWriteContactSettingByte(info->hContact,info->module,info->setting,(BYTE)val); + db_set_b(info->hContact,info->module,info->setting,(BYTE)val); break; case DBVT_WORD: - DBWriteContactSettingWord(info->hContact,info->module,info->setting,(WORD)val); + db_set_w(info->hContact,info->module,info->setting,(WORD)val); break; case DBVT_DWORD: - DBWriteContactSettingDword(info->hContact,info->module,info->setting,(DWORD)val); + db_set_dw(info->hContact,info->module,info->setting,(DWORD)val); break; } break; @@ -580,7 +580,7 @@ static LRESULT CALLBACK SettingLabelEditSubClassProc(HWND hwnd,UINT msg,WPARAM w } break; // case 1: } - DBFreeVariant(&dbv); + db_free(&dbv); } // fall through case IDCANCEL: { @@ -706,7 +706,7 @@ void EditLabel(HWND hwnd2List, int item, int subitem) default: return; } - DBFreeVariant(&dbv); + db_free(&dbv); SettingLabelEditSubClass=(WNDPROC)SetWindowLongPtrW(info->hwnd2Edit,GWLP_WNDPROC,(LONG)SettingLabelEditSubClassProc); @@ -746,7 +746,7 @@ void SettingsListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) LVHITTESTINFO hti; hti.pt=((NMLISTVIEW*)lParam)->ptAction; - if (DBGetContactSettingByte(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()) /* fix for TioDuke and win98 */ + if (db_get_b(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()) /* fix for TioDuke and win98 */ break; if (info && ListView_SubItemHitTest(GetDlgItem(hwnd,IDC_SETTINGS),&hti) >-1) { @@ -790,7 +790,7 @@ void SettingsListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) hti.pt=((NMLISTVIEW*)lParam)->ptAction; if (info && ListView_SubItemHitTest(GetDlgItem(hwnd,IDC_SETTINGS),&hti) >-1) { - if ((hti.iSubItem > 1 || hti.flags == LVHT_ONITEMICON) || (DBGetContactSettingByte(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()/* fix for TioDuke and win98 */ )) + if ((hti.iSubItem > 1 || hti.flags == LVHT_ONITEMICON) || (db_get_b(NULL,modname,"DontAllowInLineEdit",0) || !IsWinVer2000Plus()/* fix for TioDuke and win98 */ )) { char setting[256]; SendMessage(info->hwnd2Edit,WM_COMMAND,MAKEWPARAM(IDOK,0),0); @@ -1093,7 +1093,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here ///////////////////////// convert to submenu case MENU_VIEWDECRYPT: - if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { + if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { if (lstrcmpA(setting, "LoginPassword")) { char *text = mir_strdup(dbv.pszVal); CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)lstrlenA(dbv.pszVal)+1, (LPARAM)text); @@ -1113,38 +1113,38 @@ void SettingsListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here mir_free(res); mir_free(str); } - DBFreeVariant(&dbv); + db_free(&dbv); } break; case MENU_VIEWENCRYPT: - if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { + if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { char *text = mir_tstrdup(dbv.pszVal); CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)strlen(dbv.pszVal)+1, (LPARAM)text); msg(text, Translate("Encoded string..")); mir_free(text); } - DBFreeVariant(&dbv); + db_free(&dbv); break; case MENU_DECRYPT: - if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { + if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { char *text = mir_tstrdup(dbv.pszVal); CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)strlen(dbv.pszVal)+1, (LPARAM)text); - DBWriteContactSettingString(hContact,module,setting,text); + db_set_s(hContact,module,setting,text); mir_free(text); } - DBFreeVariant(&dbv); + db_free(&dbv); break; case MENU_ENCRYPT: - if (!DBGetContactSetting(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { + if (!db_get(hContact,module,setting,&dbv) && dbv.type == DBVT_ASCIIZ) { char *text = mir_tstrdup(dbv.pszVal); CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)strlen(dbv.pszVal)+1, (LPARAM)text); - DBWriteContactSettingString(hContact,module,setting,text); + db_set_s(hContact,module,setting,text); mir_free(text); } - DBFreeVariant(&dbv); + db_free(&dbv); break; ///////////////////////// divider diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 66aef8654e..865029c358 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -8,7 +8,7 @@ int addSettingToWatchList(HANDLE hContact, char* module, char* setting) WatchListArray.item = (struct DBsetting*)mir_realloc(WatchListArray.item, sizeof(struct DBsetting)*WatchListArray.size); } if (!WatchListArray.item) return 0; - if (setting && DBGetContactSetting(hContact,module, setting, &(WatchListArray.item[WatchListArray.count].dbv))) return 0; + if (setting && db_get(hContact,module, setting, &(WatchListArray.item[WatchListArray.count].dbv))) return 0; WatchListArray.item[WatchListArray.count].hContact = hContact; WatchListArray.item[WatchListArray.count].module = mir_tstrdup(module); if (setting) WatchListArray.item[WatchListArray.count].setting = mir_tstrdup(setting); @@ -25,7 +25,7 @@ void freeWatchListItem(int item) WatchListArray.item[item].module = 0; if (WatchListArray.item[item].setting) mir_free(WatchListArray.item[item].setting); WatchListArray.item[item].setting = 0; - DBFreeVariant(&(WatchListArray.item[item].dbv)); + db_free(&(WatchListArray.item[item].dbv)); WatchListArray.item[item].hContact = 0; } @@ -64,7 +64,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam) FreeModuleSettingLL(&settinglist); return; } - DBFreeVariant(&(lParam->dbv)); + db_free(&(lParam->dbv)); if (GetSetting(hContact, module, setting, &(lParam->dbv))) return; if (!hContact) @@ -287,9 +287,9 @@ void popupWatchedVar(HANDLE hContact,const char* module,const char* setting) HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)); char lpzContactName[MAX_CONTACTNAME]; char lpzText[MAX_SECONDLINE]; - COLORREF colorBack = DBGetContactSettingDword(NULL,modname,"PopupColour",RGB(255,0,0)); + COLORREF colorBack = db_get_dw(NULL,modname,"PopupColour",RGB(255,0,0)); COLORREF colorText = RGB(0,0,0); - int timeout = DBGetContactSettingByte(NULL,modname,"PopupDelay",3); + int timeout = db_get_b(NULL,modname,"PopupDelay",3); if (hContact) { // contacts nick @@ -326,7 +326,7 @@ void popupWatchedVar(HANDLE hContact,const char* module,const char* setting) return; } - DBFreeVariant(&dbv); + db_free(&dbv); POPUPDATA ppd = { 0 }; ppd.lchContact = (HANDLE)hContact; -- cgit v1.2.3