summaryrefslogtreecommitdiff
path: root/plugins/MirandaNGHistoryToDB/Database.pas
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirandaNGHistoryToDB/Database.pas')
-rw-r--r--plugins/MirandaNGHistoryToDB/Database.pas31
1 files changed, 5 insertions, 26 deletions
diff --git a/plugins/MirandaNGHistoryToDB/Database.pas b/plugins/MirandaNGHistoryToDB/Database.pas
index ba58a7295a..2b5e03b647 100644
--- a/plugins/MirandaNGHistoryToDB/Database.pas
+++ b/plugins/MirandaNGHistoryToDB/Database.pas
@@ -101,12 +101,8 @@ end;
function DBExists(const hContact: THandle; const Module, Param: AnsiString): Boolean;
var
dbv: TDBVARIANT;
- cgs: TDBCONTACTGETSETTING;
begin
- cgs.szModule := PAnsiChar(Module);
- cgs.szSetting := PAnsiChar(Param);
- cgs.pValue := @dbv;
- Result := (CallService(MS_DB_CONTACT_GETSETTING, hContact, lParam(@cgs)) = 0);
+ Result := (db_get(hContact, PAnsiChar(Module), PAnsiChar(Param), @dbv) = 0);
if Result then
DBFreeVariant(@dbv);
end;
@@ -118,15 +114,10 @@ end;
function GetDBBlob(const hContact: THandle; const Module,Param: AnsiString; var Value: Pointer; var Size: Integer): Boolean;
var
- cgs: TDBContactGetSetting;
dbv: TDBVARIANT;
begin
Result := False;
- ZeroMemory(@cgs,SizeOf(cgs));
- cgs.szModule := PAnsiChar(Module);
- cgs.szSetting := PAnsiChar(Param);
- cgs.pValue := @dbv;
- if CallService(MS_DB_CONTACT_GETSETTING, hContact, lParam(@cgs)) <> 0 then exit;
+ if db_get(hContact, PAnsiChar(Module), PAnsiChar(Param), @dbv) <> 0 then exit;
Size := dbv.cpbVal;
Value := nil;
if dbv.cpbVal = 0 then exit;
@@ -183,15 +174,11 @@ end;
function GetDBInt(const hContact: THandle; const Module,Param: AnsiString; Default: Integer): Integer;
var
- cws:TDBCONTACTGETSETTING;
dbv:TDBVariant;
begin
dbv._type := DBVT_DWORD;
dbv.dVal:=Default;
- cws.szModule:=PAnsiChar(Module);
- cws.szSetting:=PAnsiChar(Param);
- cws.pValue:=@dbv;
- if CallService(MS_DB_CONTACT_GETSETTING,hContact,LPARAM(@cws))<>0 then
+ if db_get(hContact, PAnsiChar(Module), PAnsiChar(Param), @dbv)<>0 then
Result:=default
else
Result:=dbv.dval;
@@ -210,13 +197,9 @@ end;
function DBGetContactSettingString(hContact: THandle; const szModule: PAnsiChar; const szSetting: PAnsiChar; ErrorValue: PAnsiChar): AnsiString;
var
dbv: TDBVARIANT;
- cgs: TDBCONTACTGETSETTING;
tmp: WideString;
begin
- cgs.szModule := szModule;
- cgs.szSetting := szSetting;
- cgs.pValue := @dbv;
- if CallService(MS_DB_CONTACT_GETSETTING, hContact, lParam(@cgs)) <> 0 then
+ if db_get(hContact, szModule, szSetting, @dbv) <> 0 then
Result := ErrorValue
else begin
case dbv._type of
@@ -247,12 +230,8 @@ end;
function DBGetContactSettingWideString(hContact: THandle; const szModule: PAnsiChar; const szSetting: PAnsiChar; ErrorValue: PWideChar): WideString;
var
dbv: TDBVARIANT;
- cgs: TDBCONTACTGETSETTING;
begin
- cgs.szModule := szModule;
- cgs.szSetting := szSetting;
- cgs.pValue := @dbv;
- if CallService(MS_DB_CONTACT_GETSETTING, hContact, lParam(@cgs)) <> 0 then
+ if db_get(hContact, szModule, szSetting, @dbv) <> 0 then
Result := ErrorValue
else begin
case dbv._type of