diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-03 20:11:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-03 20:11:26 +0000 |
commit | e84b97a0622a26fe474ccd840dcadb320520601c (patch) | |
tree | 7c1725e6eddbb47d618c8574147dd998feb8ea52 /plugins/UserInfoEx | |
parent | e82c4d5d574191f432716049218b4b7b5162ec38 (diff) |
- 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
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.cpp | 57 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.h | 2 |
4 files changed, 4 insertions, 61 deletions
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index b0b3e170a7..6dab5f380d 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -207,8 +207,8 @@ static void GetInitialDir(LPSTR pszInitialDir) ZeroMemory(szRelative, SIZEOF(szRelative));
// is some standard path defined
- if (!DB::Setting::GetStatic(0, MODNAME, "vCardPath", szRelative, SIZEOF(szRelative))) {
- if ( !PathToAbsolute(szRelative, pszInitialDir))
+ if (!db_get_static(0, MODNAME, "vCardPath", szRelative, SIZEOF(szRelative))) {
+ if (!PathToAbsolute(szRelative, pszInitialDir))
strcpy(pszInitialDir, szRelative);
}
else if (//try to use environment variables supported by pathpatch of db3xSA
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index 5e5c25e482..e3b6f45f2c 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -1084,7 +1084,7 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf) uid = (LPCSTR)CallProtoService(_pszBaseProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {
- if (!DB::Setting::GetStatic(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID)))
+ if (!db_get_static(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID)))
fprintf(_pFile, "IM;%s;%s:%s\n", _pszBaseProto, uid, szUID);
}
}
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 @@ -401,51 +401,6 @@ WORD GetCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR pszP }
/**
-* 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
* @param pszModule - the module to read the setting from (e.g. USERINFO)
@@ -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;
}
diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index 471d0db5d4..27424857fb 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -96,8 +96,6 @@ namespace Setting { static FORCEINLINE WORD GetUStringCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv)
{ return GetCtrl(hContact, pszModule, szSubModule, szProto, pszSetting, dbv, DBVT_UTF8); }
- BYTE GetStatic(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, LPSTR szValue, int cchValue);
-
#define GetTString GetWString
#define GetTStringEx GetWStringEx
#define GetTStringCtrl GetWStringCtrl
|