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/Ping/src/icmp.cpp | 4 +-- plugins/Ping/src/log.cpp | 6 ++-- plugins/Ping/src/options.cpp | 48 +++++++++++++++--------------- plugins/Ping/src/ping.cpp | 8 ++--- plugins/Ping/src/pinggraph.cpp | 22 +++++++------- plugins/Ping/src/pinglist.cpp | 66 ++++++++++++++++++++--------------------- plugins/Ping/src/pingthread.cpp | 30 +++++++++---------- plugins/Ping/src/utils.cpp | 22 +++++++------- 8 files changed, 103 insertions(+), 103 deletions(-) (limited to 'plugins/Ping') diff --git a/plugins/Ping/src/icmp.cpp b/plugins/Ping/src/icmp.cpp index bdf8776d22..eeab3cf567 100644 --- a/plugins/Ping/src/icmp.cpp +++ b/plugins/Ping/src/icmp.cpp @@ -25,9 +25,9 @@ ICMP::ICMP(): if (hDLL == 0 || pIcmpCreateFile == 0 || pIcmpCloseHandle == 0 || pIcmpSendEcho2 == 0) return; else - DBWriteContactSettingString(0, PLUG, "PingLib", "ICMP.DLL"); // for debugging + db_set_s(0, PLUG, "PingLib", "ICMP.DLL"); // for debugging } else - DBWriteContactSettingString(0, PLUG, "PingLib", "IPHLPAPI.DLL"); // for debugging + db_set_s(0, PLUG, "PingLib", "IPHLPAPI.DLL"); // for debugging WSAData wsaData; if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) { diff --git a/plugins/Ping/src/log.cpp b/plugins/Ping/src/log.cpp index c95c49a910..ce4d90d752 100644 --- a/plugins/Ping/src/log.cpp +++ b/plugins/Ping/src/log.cpp @@ -31,13 +31,13 @@ INT_PTR Log(WPARAM wParam, LPARAM lParam) { INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; char *filename = (char *)lParam; - if(DBGetContactSetting(0, PLUG, "LogFilename", &dbv)) { + if(db_get(0, PLUG, "LogFilename", &dbv)) { CallService(MS_DB_GETPROFILEPATH, (WPARAM)wParam, (LPARAM)filename); strcat(filename, "\\"); strcat(filename, "ping_log.txt"); } else { strncpy(filename, dbv.pszVal, wParam); - DBFreeVariant(&dbv); + db_free(&dbv); } ((char *)lParam)[wParam - 1] = 0; @@ -46,7 +46,7 @@ INT_PTR GetLogFilename(WPARAM wParam, LPARAM lParam) { } INT_PTR SetLogFilename(WPARAM wParam, LPARAM lParam) { - DBWriteContactSettingString(0, PLUG, "LogFilename", (char *)lParam); + db_set_s(0, PLUG, "LogFilename", (char *)lParam); return 0; } diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index c4433e7a9d..34e93a4c0e 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -580,50 +580,50 @@ int PingOptInit(WPARAM wParam,LPARAM lParam) } void LoadOptions() { - options.ping_period = DBGetContactSettingDword(NULL, PLUG, "PingPeriod", DEFAULT_PING_PERIOD); + options.ping_period = db_get_dw(NULL, PLUG, "PingPeriod", DEFAULT_PING_PERIOD); - options.ping_timeout = DBGetContactSettingDword(NULL, PLUG, "PingTimeout", DEFAULT_PING_TIMEOUT); + options.ping_timeout = db_get_dw(NULL, PLUG, "PingTimeout", DEFAULT_PING_TIMEOUT); CallService(PLUG "/SetPingTimeout", (WPARAM)options.ping_timeout, 0); - options.show_popup = (DBGetContactSettingByte(NULL, PLUG, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1); - options.show_popup2 = (DBGetContactSettingByte(NULL, PLUG, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1); - options.block_reps = (DBGetContactSettingByte(NULL, PLUG, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1); - options.logging = (DBGetContactSettingByte(NULL, PLUG, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1); + options.show_popup = (db_get_b(NULL, PLUG, "ShowPopup", DEFAULT_SHOW_POPUP ? 1 : 0) == 1); + options.show_popup2 = (db_get_b(NULL, PLUG, "ShowPopup2", DEFAULT_SHOW_POPUP2 ? 1 : 0) == 1); + options.block_reps = (db_get_b(NULL, PLUG, "BlockReps", DEFAULT_BLOCK_REPS ? 1 : 0) == 1); + options.logging = (db_get_b(NULL, PLUG, "LoggingEnabled", DEFAULT_LOGGING_ENABLED ? 1 : 0) == 1); - options.no_test_icon = (DBGetContactSettingByte(NULL, PLUG, "NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1); + options.no_test_icon = (db_get_b(NULL, PLUG, "NoTestStatus", DEFAULT_NO_TEST_ICON ? 1 : 0) == 1); - options.indent = DBGetContactSettingWord(NULL, PLUG, "Indent", 0); - options.row_height = DBGetContactSettingWord(NULL, PLUG, "RowHeight", GetSystemMetrics(SM_CYSMICON)); + options.indent = db_get_w(NULL, PLUG, "Indent", 0); + options.row_height = db_get_w(NULL, PLUG, "RowHeight", GetSystemMetrics(SM_CYSMICON)); - options.retries = DBGetContactSettingDword(NULL, PLUG, "Retries", 0); + options.retries = db_get_dw(NULL, PLUG, "Retries", 0); CallService(PLUG "/GetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename); ICMP::get_instance()->set_timeout(options.ping_timeout * 1000); - options.attach_to_clist = (DBGetContactSettingByte(NULL, PLUG, "AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1); - options.log_csv = (DBGetContactSettingByte(NULL, PLUG, "LogCSV", 0) == 1); + options.attach_to_clist = (db_get_b(NULL, PLUG, "AttachToClist", DEFAULT_ATTACH_TO_CLIST ? 1 : 0) == 1); + options.log_csv = (db_get_b(NULL, PLUG, "LogCSV", 0) == 1); } void SaveOptions() { - DBWriteContactSettingDword(NULL, PLUG, "PingPeriod", options.ping_period); - DBWriteContactSettingDword(NULL, PLUG, "PingTimeout", options.ping_timeout); + db_set_dw(NULL, PLUG, "PingPeriod", options.ping_period); + db_set_dw(NULL, PLUG, "PingTimeout", options.ping_timeout); CallService(PLUG "/SetPingTimeout", (WPARAM)options.ping_timeout, 0); - DBWriteContactSettingByte(NULL, PLUG, "ShowPopup", options.show_popup ? 1 : 0); - DBWriteContactSettingByte(NULL, PLUG, "ShowPopup2", options.show_popup2 ? 1 : 0); - DBWriteContactSettingByte(NULL, PLUG, "BlockReps", options.block_reps ? 1 : 0); - DBWriteContactSettingByte(NULL, PLUG, "LoggingEnabled", options.logging ? 1 : 0); + db_set_b(NULL, PLUG, "ShowPopup", options.show_popup ? 1 : 0); + db_set_b(NULL, PLUG, "ShowPopup2", options.show_popup2 ? 1 : 0); + db_set_b(NULL, PLUG, "BlockReps", options.block_reps ? 1 : 0); + db_set_b(NULL, PLUG, "LoggingEnabled", options.logging ? 1 : 0); - DBWriteContactSettingByte(NULL, PLUG, "NoTestStatus", options.no_test_icon ? 1 : 0); + db_set_b(NULL, PLUG, "NoTestStatus", options.no_test_icon ? 1 : 0); - DBWriteContactSettingWord(NULL, PLUG, "Indent", options.indent); - DBWriteContactSettingWord(NULL, PLUG, "RowHeight", options.row_height); + db_set_w(NULL, PLUG, "Indent", options.indent); + db_set_w(NULL, PLUG, "RowHeight", options.row_height); - DBWriteContactSettingDword(NULL, PLUG, "Retries", (DWORD)options.retries); + db_set_dw(NULL, PLUG, "Retries", (DWORD)options.retries); CallService(PLUG "/SetLogFilename", (WPARAM)MAX_PATH, (LPARAM)options.log_filename); ICMP::get_instance()->set_timeout(options.ping_timeout * 1000); - DBWriteContactSettingByte(NULL, PLUG, "AttachToClist", options.attach_to_clist ? 1 : 0); - DBWriteContactSettingByte(NULL, PLUG, "LogCSV", options.log_csv ? 1 : 0); + db_set_b(NULL, PLUG, "AttachToClist", options.attach_to_clist ? 1 : 0); + db_set_b(NULL, PLUG, "LogCSV", options.log_csv ? 1 : 0); } diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 7a2ba0a188..f107f5a9d3 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -101,10 +101,10 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { hFillListEvent = HookEvent(PLUG "/ListReload", FillList); - if(!DBGetContactSettingByte(0, PLUG, "PingPlugImport", 0)) { - if(DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0)) { + if(!db_get_b(0, PLUG, "PingPlugImport", 0)) { + if(db_get_dw(0, "PingPlug", "NumEntries", 0)) { import_ping_addresses(); - DBWriteContactSettingByte(0, PLUG, "PingPlugImport", 1); + db_set_b(0, PLUG, "PingPlugImport", 1); } } @@ -126,7 +126,7 @@ extern "C" __declspec(dllexport) int Load(void) //return 1; use_raw_ping = false; //} - DBWriteContactSettingByte(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping); + db_set_b(0, PLUG, "UsingRawSockets", (BYTE)use_raw_ping); DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 ); hWakeEvent = CreateEvent(NULL, FALSE, FALSE, _T("Local\\ThreadWaitEvent")); diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index c7edf260ef..b655cdc24f 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -243,7 +243,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { char buff[30]; sprintf(buff, "WindowHandle%d", wd->item_id); - DBWriteContactSettingDword(0, PLUG, buff, 0); + db_set_dw(0, PLUG, buff, 0); } delete wd; } @@ -256,7 +256,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { char buff[30]; sprintf(buff, "WindowHandle%d", (DWORD)wParam); - HWND hGraphWnd = (HWND)DBGetContactSettingDword(0, PLUG, buff, 0); + HWND hGraphWnd = (HWND)db_get_dw(0, PLUG, buff, 0); if(hGraphWnd) { ShowWindow(hGraphWnd, SW_SHOW); SetWindowPos(hGraphWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); @@ -292,10 +292,10 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { wd->item_id = (DWORD)wParam; // wParam is destination id wd->hwnd_chk_grid = 0; wd->hwnd_chk_stat = 0; - wd->show_grid = DBGetContactSettingByte(0, PLUG, "ShowGridLines", 0) ? true : false; - wd->show_stat = DBGetContactSettingByte(0, PLUG, "ShowStats", 1) ? true : false; + wd->show_grid = db_get_b(0, PLUG, "ShowGridLines", 0) ? true : false; + wd->show_stat = db_get_b(0, PLUG, "ShowStats", 1) ? true : false; - DBWriteContactSettingDword(0, PLUG, buff, (DWORD)hGraphWnd); + db_set_dw(0, PLUG, buff, (DWORD)hGraphWnd); SetWindowLongPtr(hGraphWnd, GWLP_USERDATA, (LONG_PTR)wd); @@ -316,11 +316,11 @@ void graphs_cleanup() { for(int i = 0; i < list_size; i++) { sprintf(buff, "WindowHandle%d", i); - if(hwnd = (HWND)DBGetContactSettingDword(0, PLUG, buff, 0)) { + if(hwnd = (HWND)db_get_dw(0, PLUG, buff, 0)) { DestroyWindow(hwnd); - DBWriteContactSettingDword(0, PLUG, buff, 0); + db_set_dw(0, PLUG, buff, 0); sprintf(buff, "WindowWasOpen%d", i); - DBWriteContactSettingByte(0, PLUG, buff, 1); + db_set_b(0, PLUG, buff, 1); } } } @@ -332,10 +332,10 @@ void graphs_init() { CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); for(pinglist_it i = pl.begin(); i != pl.end(); ++i) { sprintf(buff, "WindowHandle%d", i->item_id); // clean up from possible crash - DBWriteContactSettingDword(0, PLUG, buff, 0); + db_set_dw(0, PLUG, buff, 0); sprintf(buff, "WindowWasOpen%d", i->item_id); // restore windows that were open on shutdown - if(DBGetContactSettingByte(0, PLUG, buff, 0)) { - DBWriteContactSettingByte(0, PLUG, buff, 0); + if(db_get_b(0, PLUG, buff, 0)) { + db_set_b(0, PLUG, buff, 0); ShowGraph((WPARAM)i->item_id, (LPARAM)i->pszLabel); } } diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp index 45873da685..517e984490 100644 --- a/plugins/Ping/src/pinglist.cpp +++ b/plugins/Ping/src/pinglist.cpp @@ -61,26 +61,26 @@ void write_ping_address(PINGADDRESS &i) if(i.item_id == 0) { i.item_id = NextID++; - DBWriteContactSettingDword(0, PLUG, "NextID", NextID); + db_set_dw(0, PLUG, "NextID", NextID); } - DBWriteContactSettingDword(0, buff, "Id", i.item_id); - DBWriteContactSettingString(0, buff, "Address", i.pszName); - DBWriteContactSettingString(0, buff, "Label", i.pszLabel); - DBWriteContactSettingWord(0, buff, "Status", i.status); - DBWriteContactSettingDword(0, buff, "Port", i.port); - DBWriteContactSettingString(0, buff, "Proto", i.pszProto); + db_set_dw(0, buff, "Id", i.item_id); + db_set_s(0, buff, "Address", i.pszName); + db_set_s(0, buff, "Label", i.pszLabel); + db_set_w(0, buff, "Status", i.status); + db_set_dw(0, buff, "Port", i.port); + db_set_s(0, buff, "Proto", i.pszProto); if(strlen(i.pszCommand)) - DBWriteContactSettingString(0, buff, "Command", i.pszCommand); + db_set_s(0, buff, "Command", i.pszCommand); else - DBDeleteContactSetting(0, buff, "Command"); + db_unset(0, buff, "Command"); if(strlen(i.pszParams)) - DBWriteContactSettingString(0, buff, "CommandParams", i.pszParams); + db_set_s(0, buff, "CommandParams", i.pszParams); else - DBDeleteContactSetting(0, buff, "CommandParams"); - DBWriteContactSettingWord(0, buff, "SetStatus", i.set_status); - DBWriteContactSettingWord(0, buff, "GetStatus", i.get_status); - DBWriteContactSettingWord(0, buff, "Index", i.index); + db_unset(0, buff, "CommandParams"); + db_set_w(0, buff, "SetStatus", i.set_status); + db_set_w(0, buff, "GetStatus", i.get_status); + db_set_w(0, buff, "Index", i.index); } // call with list_cs locked @@ -100,9 +100,9 @@ void write_ping_addresses() do { found = false; sprintf(buff, "PING_DEST_%d", index++); - if(DBGetContactSettingDword(0, buff, "Id", 0) != 0) { + if(db_get_dw(0, buff, "Id", 0) != 0) { found = true; - DBWriteContactSettingDword(0, buff, "Id", 0); + db_set_dw(0, buff, "Id", 0); } } while(found); } @@ -114,52 +114,52 @@ bool read_ping_address(PINGADDRESS &pa) { sprintf(buff, "PING_DEST_%d", index); // return if not more contacts, or only deleted contacts remaining - if((pa.item_id = DBGetContactSettingDword(0, buff, "Id", 0)) == 0) return false; + if((pa.item_id = db_get_dw(0, buff, "Id", 0)) == 0) return false; DBVARIANT dbv; - if(!DBGetContactSetting(0, buff, "Address", &dbv)) { + if(!db_get(0, buff, "Address", &dbv)) { strncpy(pa.pszName, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH); - DBFreeVariant(&dbv); + db_free(&dbv); } else return false; - if(!DBGetContactSetting(0, buff, "Label", &dbv)) { + if(!db_get(0, buff, "Label", &dbv)) { strncpy(pa.pszLabel, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH); - DBFreeVariant(&dbv); + db_free(&dbv); } else return false; - pa.status = DBGetContactSettingWord(0, buff, "Status", PS_NOTRESPONDING); + pa.status = db_get_w(0, buff, "Status", PS_NOTRESPONDING); if(pa.status != PS_DISABLED) pa.status = PS_NOTRESPONDING; - pa.port = (int)DBGetContactSettingDword(0, buff, "Port", -1); + pa.port = (int)db_get_dw(0, buff, "Port", -1); - if(!DBGetContactSetting(0, buff, "Proto", &dbv)) { + if(!db_get(0, buff, "Proto", &dbv)) { strncpy(pa.pszProto, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH); - DBFreeVariant(&dbv); + db_free(&dbv); } else pa.pszProto[0] = '\0'; - if(!DBGetContactSetting(0, buff, "Command", &dbv)) { + if(!db_get(0, buff, "Command", &dbv)) { strncpy(pa.pszCommand, dbv.pszVal, MAX_PATH); - DBFreeVariant(&dbv); + db_free(&dbv); } else pa.pszCommand[0] = '\0'; - if(!DBGetContactSetting(0, buff, "CommandParams", &dbv)) { + if(!db_get(0, buff, "CommandParams", &dbv)) { strncpy(pa.pszParams, dbv.pszVal, MAX_PATH); - DBFreeVariant(&dbv); + db_free(&dbv); } else pa.pszParams[0] = '\0'; - pa.set_status = DBGetContactSettingWord(0, buff, "SetStatus", ID_STATUS_ONLINE); - pa.get_status = DBGetContactSettingWord(0, buff, "GetStatus", ID_STATUS_OFFLINE); + pa.set_status = db_get_w(0, buff, "SetStatus", ID_STATUS_ONLINE); + pa.get_status = db_get_w(0, buff, "GetStatus", ID_STATUS_OFFLINE); pa.responding = false; pa.round_trip_time = 0; pa.miss_count = 0; - pa.index = DBGetContactSettingWord(0, buff, "Index", 0); + pa.index = db_get_w(0, buff, "Index", 0); pa.index = index; if(pa.item_id >= NextID) { NextID = pa.item_id + 1; - DBWriteContactSettingDword(0, PLUG, "NextID", NextID); + db_set_dw(0, PLUG, "NextID", NextID); } return true; diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index bf2e0053c8..41ed11239a 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -399,18 +399,18 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if((dis->itemState & ODS_SELECTED && dis->itemState & ODS_FOCUS) || (context_point_valid && (x >= dis->rcItem.left && x <= dis->rcItem.right) && (y >= dis->rcItem.top && y <= dis->rcItem.bottom))) { - tcol = DBGetContactSettingDword(NULL,"CLC","SelBkColour", GetSysColor(COLOR_HIGHLIGHT)); + tcol = db_get_dw(NULL,"CLC","SelBkColour", GetSysColor(COLOR_HIGHLIGHT)); SetBkColor(dis->hDC, tcol); FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol))); - tcol = DBGetContactSettingDword(NULL,"CLC","SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT)); + tcol = db_get_dw(NULL,"CLC","SelTextColour", GetSysColor(COLOR_HIGHLIGHTTEXT)); SetTextColor(dis->hDC, tcol); } else { tcol = bk_col; SetBkColor(dis->hDC, tcol); FillRect(dis->hDC, &dis->rcItem, (ttbrush = CreateSolidBrush(tcol))); - tcol = DBGetContactSettingDword(NULL, PLUG, "FontCol", GetSysColor(COLOR_WINDOWTEXT)); + tcol = db_get_dw(NULL, PLUG, "FontCol", GetSysColor(COLOR_WINDOWTEXT)); SetTextColor(dis->hDC, tcol); } @@ -527,7 +527,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar (WS_VISIBLE | WS_CHILD | LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_NOTIFY) & ~WS_BORDER, 0, 0, 0, 0, hwnd, NULL, hInst,0); - if (DBGetContactSettingByte(NULL,"CList","Transparent",0)) + if (db_get_b(NULL,"CList","Transparent",0)) { if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { @@ -536,7 +536,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); #endif #ifdef LWA_ALPHA - if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); #endif } } @@ -551,15 +551,15 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_ACTIVATE: if(wParam==WA_INACTIVE) { if((HWND)wParam!=hwnd) - if(DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) + if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) if(transparentFocus) SetTimer(hwnd, TM_AUTOALPHA,250,NULL); } else { - if(DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) { + if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) { KillTimer(hwnd,TM_AUTOALPHA); #ifdef LWA_ALPHA - if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + if (MySetLayeredWindowAttributes) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); #endif transparentFocus=1; } @@ -567,10 +567,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar return DefWindowProc(hwnd,msg,wParam,lParam); case WM_SETCURSOR: - if(DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) { + if(db_get_b(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT)) { if (!transparentFocus && GetForegroundWindow()!=hwnd && MySetLayeredWindowAttributes) { #ifdef LWA_ALPHA - MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); #endif transparentFocus=1; SetTimer(hwnd, TM_AUTOALPHA,250,NULL); @@ -598,8 +598,8 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { //change transparentFocus=inwnd; #ifdef LWA_ALPHA - if(transparentFocus) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); - else MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)DBGetContactSettingByte(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); + if(transparentFocus) MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + else MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); #endif } if(!transparentFocus) KillTimer(hwnd,TM_AUTOALPHA); @@ -612,14 +612,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar static int noRecurse=0; if(lParam) break; if(noRecurse) break; - if(!DBGetContactSettingByte(NULL,"CLUI","FadeInOut",0) || !IsWinVer2000Plus()) break; + if(!db_get_b(NULL,"CLUI","FadeInOut",0) || !IsWinVer2000Plus()) break; #ifdef WS_EX_LAYERED if(GetWindowLong(hwnd,GWL_EXSTYLE)&WS_EX_LAYERED) { DWORD thisTick,startTick; int sourceAlpha,destAlpha; if(wParam) { sourceAlpha=0; - destAlpha=(BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT); + destAlpha=(BYTE)db_get_b(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT); #ifdef LWA_ALPHA MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), 0, LWA_ALPHA); #endif @@ -628,7 +628,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar noRecurse=0; } else { - sourceAlpha=(BYTE)DBGetContactSettingByte(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT); + sourceAlpha=(BYTE)db_get_b(NULL,"CList","Alpha",SETTING_AUTOALPHA_DEFAULT); destAlpha=0; } for(startTick=GetTickCount();;) { diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index c87793fee8..9372f22eb0 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -240,30 +240,30 @@ void import_ping_address(int index, PINGADDRESS &pa) { DBVARIANT dbv; char buf[256]; mir_snprintf(buf, 256, "Address%d", index); - if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) { + if(!db_get(0, "PingPlug", buf, &dbv)) { strncpy(pa.pszName, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH); - DBFreeVariant(&dbv); + db_free(&dbv); } else strcpy(pa.pszName, Translate("Unknown Address")); mir_snprintf(buf, 256, "Label%d", index); - if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) { + if(!db_get(0, "PingPlug", buf, &dbv)) { strncpy(pa.pszLabel, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH); - DBFreeVariant(&dbv); + db_free(&dbv); } else strcpy(pa.pszLabel, Translate("Unknown")); mir_snprintf(buf, 256, "Port%d", index); - pa.port = (int)DBGetContactSettingDword(0, "PingPlug", buf, -1); + pa.port = (int)db_get_dw(0, "PingPlug", buf, -1); mir_snprintf(buf, 256, "Proto%d", index); - if(!DBGetContactSetting(0, "PingPlug", buf, &dbv)) { + if(!db_get(0, "PingPlug", buf, &dbv)) { strncpy(pa.pszProto, dbv.pszVal, MAX_PINGADDRESS_STRING_LENGTH); - DBFreeVariant(&dbv); + db_free(&dbv); mir_snprintf(buf, 256, "Status%d", index); - pa.set_status = DBGetContactSettingWord(0, "PingPlug", buf, ID_STATUS_ONLINE); + pa.set_status = db_get_w(0, "PingPlug", buf, ID_STATUS_ONLINE); mir_snprintf(buf, 256, "Status2%d", index); - pa.get_status = DBGetContactSettingWord(0, "PingPlug", buf, ID_STATUS_OFFLINE); + pa.get_status = db_get_w(0, "PingPlug", buf, ID_STATUS_OFFLINE); } else pa.pszProto[0] = '\0'; @@ -277,7 +277,7 @@ void import_ping_address(int index, PINGADDRESS &pa) { pa.item_id = 0; mir_snprintf(buf, 256, "Enabled%d", index); - if(DBGetContactSettingByte(0, "PingPlug", buf, 1) == 1) + if(db_get_b(0, "PingPlug", buf, 1) == 1) pa.status = PS_NOTRESPONDING; else pa.status = PS_DISABLED; @@ -286,7 +286,7 @@ void import_ping_address(int index, PINGADDRESS &pa) { // read in addresses from old pingplug void import_ping_addresses() { - int count = DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0); + int count = db_get_dw(0, "PingPlug", "NumEntries", 0); PINGADDRESS pa; EnterCriticalSection(&list_cs); -- cgit v1.2.3