summaryrefslogtreecommitdiff
path: root/plugins/ClientChangeNotify
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-06-29 18:16:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-06-29 18:16:23 +0000
commitde5dce707cc60ace5b92d2ac61914c590cb9680b (patch)
tree64f2ee6639edeefcc9a32425d10cd56463dab6a4 /plugins/ClientChangeNotify
parent13952bddf4931ed75338460754860a81d3710678 (diff)
rest of unused databases services removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@5181 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ClientChangeNotify')
-rw-r--r--plugins/ClientChangeNotify/src/CommonLibs/CString.cpp75
-rw-r--r--plugins/ClientChangeNotify/src/CommonLibs/Options.cpp11
2 files changed, 13 insertions, 73 deletions
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp b/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp
index fde5e4dc2a..b36076eec8 100644
--- a/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp
+++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp
@@ -288,89 +288,36 @@ template class TString<WCHAR>;
CString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue)
{
- DBVARIANT dbv = {0};
- DBCONTACTGETSETTING dbcgs;
- dbcgs.szModule = szModule;
- dbcgs.pValue = &dbv;
- dbcgs.szSetting = szSetting;
- int iRes = CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs);
- CString Result;
- if (!iRes && dbv.type == DBVT_ASCIIZ)
- {
- Result = dbv.pszVal;
- } else
- {
- Result = szDefaultValue;
- }
- if (!iRes)
- {
- CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv);
- }
- return Result;
+ ptrA p( db_get_sa(hContact, szModule, szSetting));
+ return CString(p == NULL ? szDefaultValue : p);
}
-
-
TCString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue)
{
- DBVARIANT dbv = {0};
- DBCONTACTGETSETTING dbcgs;
- dbcgs.szModule = szModule;
- dbcgs.pValue = &dbv;
- dbcgs.szSetting = szSetting;
- dbv.type = DBVT_WCHAR;
- int iRes = CallService(MS_DB_CONTACT_GETSETTING_STR, (WPARAM)hContact, (LPARAM)&dbcgs);
- TCString Result;
- if (!iRes && dbv.type == DBVT_WCHAR)
- {
- Result = dbv.ptszVal;
- } else
- {
- Result = szDefaultValue;
- }
- if (!iRes)
- {
- CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv);
- }
- return Result;
+ ptrT p( db_get_tsa(hContact, szModule, szSetting));
+ return TCString(p == NULL ? szDefaultValue : p);
}
-
-
-int db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
-{
- return db_get_s(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ);
-}
-
-
-
TCString DBGetContactSettingAsString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue)
{ // also converts numeric values to a string
DBVARIANT dbv = {0};
- DBCONTACTGETSETTING dbcgs;
- dbcgs.szModule = szModule;
- dbcgs.pValue = &dbv;
- dbcgs.szSetting = szSetting;
-
- dbv.type = DBVT_WCHAR;
- int iRes = CallService(MS_DB_CONTACT_GETSETTING_STR, (WPARAM)hContact, (LPARAM)&dbcgs);
+ int iRes = db_get_ws(hContact, szModule, szSetting, &dbv);
TCString Result;
if (!iRes && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR))
{
Result = dbv.ptszVal;
- } else if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD)
+ }
+ else if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD)
{
long value = (dbv.type == DBVT_DWORD) ? dbv.dVal : (dbv.type == DBVT_WORD ? dbv.wVal : dbv.bVal);
_ultot(value, Result.GetBuffer(64), 10);
Result.ReleaseBuffer();
- } else
- {
- Result = szDefaultValue;
}
+ else Result = szDefaultValue;
+
if (!iRes)
- {
- CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv);
- }
+ db_free(&dbv);
+
return Result;
}
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
index 36226b0f11..0c62967232 100644
--- a/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
+++ b/plugins/ClientChangeNotify/src/CommonLibs/Options.cpp
@@ -153,16 +153,9 @@ int COptItem::GetIntDBVal(CString &sModule, int bSigned, CString *sDBSettingPref
{
_ASSERT(nValueSize == DBVT_BYTE || nValueSize == DBVT_WORD || nValueSize == DBVT_DWORD);
DBVARIANT dbv;
- DBCONTACTGETSETTING cgs;
- cgs.szModule = sModule;
- //NightFox: WTF is this shit
- //cgs.szSetting = sDBSettingPrefix ? (*sDBSettingPrefix + sDBSetting) : sDBSetting;
- cgs.szSetting = sDBSetting;
- cgs.pValue = &dbv;
- if (CallService(MS_DB_CONTACT_GETSETTING, NULL, (LPARAM)&cgs))
- {
+ if (db_get(NULL, sModule, sDBSetting, &dbv))
return GetDefValue();
- }
+
return (nValueSize == DBVT_BYTE) ? (bSigned ? (signed char)dbv.bVal : (unsigned char)dbv.bVal) : ((nValueSize == DBVT_WORD) ? (bSigned ? (signed short)dbv.wVal : (unsigned short)dbv.wVal) : dbv.dVal);
}
return GetDefValue();