diff options
Diffstat (limited to 'plugins/Utils.pas/dbsettings.pas')
-rw-r--r-- | plugins/Utils.pas/dbsettings.pas | 93 |
1 files changed, 44 insertions, 49 deletions
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas index dcd880175b..dfbdd8ee69 100644 --- a/plugins/Utils.pas/dbsettings.pas +++ b/plugins/Utils.pas/dbsettings.pas @@ -4,78 +4,78 @@ interface uses windows,m_api;
-function DBReadByte (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte =0):byte;
-function DBReadWord (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:word =0):word;
-function DBReadDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword;
+function DBReadByte (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte =0):byte;
+function DBReadWord (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:word =0):word;
+function DBReadDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword;
-function DBReadSetting (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
-function DBReadSettingStr(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
+function DBReadSetting (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
+function DBReadSettingStr(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
-function DBReadStringLength(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
-function DBReadString (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBReadStringLength(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
+function DBReadString (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
default:PAnsiChar=nil;enc:integer=DBVT_ASCIIZ):PAnsiChar;
-function DBReadUTF8 (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar;
-function DBReadUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar;
+function DBReadUTF8 (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar;
+function DBReadUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar;
-function DBReadStruct (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBReadStruct (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
ptr:pointer;size:dword):uint_ptr;
-function DBWriteStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBWriteStruct(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
ptr:pointer;size:dword):Integer;
-function DBWriteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
-function DBWriteByte (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte ):int_ptr;
-function DBWriteWord (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word ):int_ptr;
-function DBWriteDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr;
+function DBWriteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
+function DBWriteByte (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte ):int_ptr;
+function DBWriteWord (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word ):int_ptr;
+function DBWriteDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr;
-function DBWriteString (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBWriteString (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
val:PAnsiChar;enc:integer=DBVT_ASCIIZ):int_ptr;
-function DBWriteUTF8 (hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
-function DBWriteUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
+function DBWriteUTF8 (hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
+function DBWriteUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
-function DBFreeVariant(dbv:PDBVARIANT):int_ptr;
-function DBDeleteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
+//function DBFreeVariant(dbv:PDBVARIANT):int_ptr;
+function DBDeleteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
-function DBDeleteGroup(hContact:THANDLE;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr;
+function DBDeleteGroup(hContact:HCONTACT;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr;
function DBDeleteModule(szModule:PAnsiChar):integer; // 0.8.0+
-function DBGetSettingType(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
+function DBGetSettingType(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
implementation
uses common;
-function DBReadByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte=0):byte;
+function DBReadByte(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte=0):byte;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_b(hContact, szModule, szSetting, default);
end;
-function DBReadWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:word=0):word;
+function DBReadWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:word=0):word;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_w(hContact, szModule, szSetting, default);
end;
-function DBReadDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword;
+function DBReadDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_dw(hContact, szModule, szSetting, default);
end;
-function DBReadSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
+function DBReadSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get(hContact, szModule, szSetting, dbv);
end;
-function DBReadSettingStr(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
+function DBReadSettingStr(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_s(hContact, szModule, szSetting, dbv, DBVT_ASCIIZ);
end;
-function DBReadStringLength(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
+function DBReadStringLength(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
var
dbv:TDBVARIANT;
i:int_ptr;
@@ -86,10 +86,11 @@ begin result:=0
else
result:=StrLen(dbv.szVal.a);
+
DBFreeVariant(@dbv);
end;
-function DBReadString(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBReadString(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
default:PAnsiChar=nil;enc:integer=DBVT_ASCIIZ):PAnsiChar;
var
dbv:TDBVARIANT;
@@ -108,13 +109,13 @@ begin DBFreeVariant(@dbv);
end;
-function DBReadUTF8(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar;
+function DBReadUTF8(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PAnsiChar=nil):PAnsiChar;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=DBReadString(hContact,szModule,szSetting,default,DBVT_UTF8);
end;
-function DBReadUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar;
+function DBReadUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar;
var
dbv:TDBVARIANT;
i:int_ptr;
@@ -132,7 +133,7 @@ begin DBFreeVariant(@dbv);
end;
-function DBReadStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBReadStruct(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
ptr:pointer;size:dword):uint_ptr;
var
dbv:TDBVariant;
@@ -153,63 +154,57 @@ begin result:=0;
end;
-function DBWriteStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBWriteStruct(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
ptr:pointer;size:dword):Integer;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_blob(hContact, szModule, szSetting, ptr, size);
end;
-function DBWriteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
+function DBWriteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
Result:=db_set(hContact, szModule, szSetting, dbv);
end;
-function DBWriteByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte):int_ptr;
+function DBWriteByte(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_b(hContact, szModule, szSetting, val);
end;
-function DBWriteWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word):int_ptr;
+function DBWriteWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_w(hContact, szModule, szSetting, val);
end;
-function DBWriteDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr;
+function DBWriteDWord(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_dw(hContact, szModule, szSetting, val);
end;
-function DBWriteString(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
+function DBWriteString(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;
val:PAnsiChar;enc:integer=DBVT_ASCIIZ):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_s(hContact, szModule, szSetting, val);
end;
-function DBWriteUTF8(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
+function DBWriteUTF8(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_utf(hContact, szModule, szSetting, val);
end;
-function DBWriteUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
+function DBWriteUnicode(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_ws(hContact, szModule, szSetting, val);
end;
-function DBFreeVariant(dbv:PDBVARIANT):int_ptr;
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- result:=db_free(dbv);
-end;
-
-function DBDeleteSetting(hContact:THandle;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
+function DBDeleteSetting(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_unset(hContact, szModule, szSetting);
@@ -231,7 +226,7 @@ begin result:=0;
end;
-function DBDeleteGroup(hContact:THANDLE;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr;
+function DBDeleteGroup(hContact:HCONTACT;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr;
var
ces:TDBCONTACTENUMSETTINGS;
p:PAnsiChar;
@@ -319,7 +314,7 @@ begin CallService(MS_DB_MODULE_DELETE,0,lParam(szModule));
end;
-function DBGetSettingType(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
+function DBGetSettingType(hContact:HCONTACT;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
var
ldbv:TDBVARIANT;
begin
|