From e84b97a0622a26fe474ccd840dcadb320520601c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Feb 2014 20:11:26 +0000 Subject: - new helpers for reading db strings into static buffers; - MS_DB_CONTACT_GETSETTINGSTATIC died; - DBCONTACTGETSETTING is detouched from all services; - these service calls are rewritten using parameters git-svn-id: http://svn.miranda-ng.org/main/trunk@8035 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/mir_db.cpp | 57 +-------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) (limited to 'plugins/UserInfoEx/src/mir_db.cpp') diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index 9243a317fd..ed48c02193 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -400,51 +400,6 @@ WORD GetCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR pszP return wFlags; } -/** -* This function reads a setting from database into a predefined portion of memory -* and convert numbers into a string, too. -* @param hContact - handle to the contact -* @param pszModule - the module to read the setting from (e.g. USERINFO) -* @param pszSetting - the setting to read -* @param pszValue - buffer, that retrieves the value -* @param cchValue - number of characters the buffer can take -* -* @retval 0 - success -* @retval 1 - error -**/ - -BYTE GetStatic(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR pszValue, int cchValue) -{ - DBVARIANT dbv; - DBCONTACTGETSETTING sVal; - - if (pszValue && cchValue) { - pszValue[0] = 0; - dbv.pszVal = pszValue; - dbv.cchVal = cchValue; - dbv.type = DBVT_ASCIIZ; - - sVal.pValue = &dbv; - sVal.szModule = pszModule; - sVal.szSetting = pszSetting; - - if (!CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal)) { - switch (dbv.type) { - case DBVT_BYTE: - _itoa(dbv.bVal, pszValue, 10); - break; - case DBVT_WORD: - _itoa(dbv.wVal, pszValue, 10); - break; - case DBVT_DWORD: - _itoa(dbv.dVal, pszValue, 10); - } - return (pszValue[0] == 0); - } - } - return 1; -} - /** * This function checks for the existence of the given setting in the database * @param hContact - handle to the contact @@ -459,17 +414,7 @@ BYTE Exists(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) { if (pszModule && pszSetting) { CHAR szDummy[1]; - DBVARIANT dbv; - dbv.pszVal = szDummy; - dbv.cchVal = sizeof(szDummy); - dbv.type = 0; - - DBCONTACTGETSETTING cgs; - cgs.pValue = &dbv; - cgs.szModule = pszModule; - cgs.szSetting = pszSetting; - if (!CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM) hContact, (LPARAM) &cgs)) - return (dbv.type > DBVT_DELETED); + return 0 == db_get_static(hContact, pszModule, pszSetting, szDummy, 1); } return FALSE; } -- cgit v1.2.3