diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-29 18:16:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-29 18:16:23 +0000 |
commit | de5dce707cc60ace5b92d2ac61914c590cb9680b (patch) | |
tree | 64f2ee6639edeefcc9a32425d10cd56463dab6a4 /plugins/Utils.pas | |
parent | 13952bddf4931ed75338460754860a81d3710678 (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/Utils.pas')
-rw-r--r-- | plugins/Utils.pas/contact.pas | 6 | ||||
-rw-r--r-- | plugins/Utils.pas/dbsettings.pas | 199 | ||||
-rw-r--r-- | plugins/Utils.pas/mirutils.pas | 41 | ||||
-rw-r--r-- | plugins/Utils.pas/protocols.pas | 6 |
4 files changed, 26 insertions, 226 deletions
diff --git a/plugins/Utils.pas/contact.pas b/plugins/Utils.pas/contact.pas index 93bd4f7f73..9dc959c91f 100644 --- a/plugins/Utils.pas/contact.pas +++ b/plugins/Utils.pas/contact.pas @@ -32,13 +32,13 @@ begin if format=nil then format:=defformat;
SendMessage(list,CB_RESETCONTENT,0,0);
- hContact:=CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact:=db_find_first();
lName :=StrPosW(format,'%name%')<>nil;
lGroup :=StrPosW(format,'%group%')<>nil;
lAccount:=StrPosW(format,'%account%')<>nil;
lUID :=StrPosW(format,'%uid%')<>nil;
-
+
while hContact<>0 do
begin
if ((not filter) and ((IsContactActive(hContact)+1)>=0)) or // + disabled (not deleted)
@@ -105,7 +105,7 @@ begin SendMessageW(list,CB_ADDSTRING,0,tlparam(@buf)),
hContact);
end;
- hContact:=CallService(MS_DB_CONTACT_FINDNEXT,hContact,0);
+ hContact:=db_find_next(hContact);
end;
end;
diff --git a/plugins/Utils.pas/dbsettings.pas b/plugins/Utils.pas/dbsettings.pas index 9c8578b225..5e2b5b08fd 100644 --- a/plugins/Utils.pas/dbsettings.pas +++ b/plugins/Utils.pas/dbsettings.pas @@ -1,4 +1,3 @@ -{$DEFINE UseCore}
{$INCLUDE compilers.inc}
unit dbsettings;
interface
@@ -47,127 +46,57 @@ implementation uses common;
function DBReadByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:byte=0):byte;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_b(hContact, szModule, szSetting, default);
end;
-{$ELSE}
-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
- Result:=default
- else
- Result:=dbv.bVal;
-end;
-{$ENDIF}
function DBReadWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:word=0):word;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_w(hContact, szModule, szSetting, default);
end;
-{$ELSE}
-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
- Result:=default
- else
- Result:=dbv.wVal;
-end;
-{$ENDIF}
function DBReadDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:dword=0):dword;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get_dw(hContact, szModule, szSetting, default);
end;
-{$ELSE}
-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
- Result:=default
- else
- Result:=dbv.dVal;
-end;
-{$ENDIF}
function DBReadSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_get(hContact, szModule, szSetting, dbv);
end;
-{$ELSE}
-var
- cgs:TDBCONTACTGETSETTING;
-begin
- cgs.szModule :=szModule;
- cgs.szSetting:=szSetting;
- cgs.pValue :=dbv;
- Result:=CallService(MS_DB_CONTACT_GETSETTING,hContact,lParam(@cgs));
-end;
-{$ENDIF}
function DBReadSettingStr(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
-var
- cgs:TDBCONTACTGETSETTING;
begin
- cgs.szModule :=szModule;
- cgs.szSetting:=szSetting;
- cgs.pValue :=dbv;
- Result:=CallService(MS_DB_CONTACT_GETSETTING_STR,hContact,lParam(@cgs));
+ Result:=db_get_s(hContact,szModule,szSetting,dbv,DBVT_ASCIIZ);
end;
function DBReadStringLength(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar):integer;
var
- cgs:TDBCONTACTGETSETTING;
dbv:TDBVARIANT;
i:int_ptr;
begin
FillChar(dbv,SizeOf(dbv),0);
- cgs.szModule :=szModule;
- cgs.szSetting:=szSetting;
- cgs.pValue :=@dbv;
- i:=CallService(MS_DB_CONTACT_GETSETTING_STR,hContact,lParam(@cgs));
+ i:=db_get_s(hContact,szModule,szSetting,@dbv,DBVT_ASCIIZ);
if (i<>0) or (dbv.szVal.a=nil) or (dbv.szVal.a^=#0) then
result:=0
else
result:=lstrlena(dbv.szVal.a);
-//!! if i=0 then
- DBFreeVariant(@dbv);
+ DBFreeVariant(@dbv);
end;
function DBReadString(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
default:PAnsiChar=nil;enc:integer=DBVT_ASCIIZ):PAnsiChar;
var
- cgs:TDBCONTACTGETSETTING;
dbv:TDBVARIANT;
i:int_ptr;
begin
FillChar(dbv,SizeOf(dbv),0);
- cgs.szModule :=szModule;
- cgs.szSetting:=szSetting;
- cgs.pValue :=@dbv;
dbv._type :=enc;
- i:=CallService(MS_DB_CONTACT_GETSETTING_STR,hContact,lParam(@cgs));
+ i:=db_get_s(hContact,szModule,szSetting,@dbv,DBVT_ASCIIZ);
if i=0 then
default:=dbv.szVal.a;
@@ -187,16 +116,11 @@ end; function DBReadUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;default:PWideChar=nil):PWideChar;
var
- cgs:TDBCONTACTGETSETTING;
dbv:TDBVARIANT;
i:int_ptr;
begin
FillChar(dbv,SizeOf(dbv),0);
- cgs.szModule :=szModule;
- cgs.szSetting:=szSetting;
- cgs.pValue :=@dbv;
- dbv._type :=DBVT_WCHAR;
- i:=CallService(MS_DB_CONTACT_GETSETTING_STR,hContact,lParam(@cgs));
+ i:=db_get_s(hContact,szModule,szSetting,@dbv,DBVT_WCHAR);
if i=0 then
default:=dbv.szVal.w;
@@ -205,8 +129,7 @@ begin else
StrDupW(result,default);
-//!! if i=0 then
- DBFreeVariant(@dbv);
+ DBFreeVariant(@dbv);
end;
function DBReadStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
@@ -230,23 +153,10 @@ end; function DBWriteStruct(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
ptr:pointer;size:dword):Integer;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_blob(hContact, szModule, szSetting, ptr, size);
end;
-{$ELSE}
-var
- cws:TDBCONTACTWRITESETTING;
-begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- cws.value._type :=DBVT_BLOB;
- cws.value.pbVal :=ptr;
- cws.value.cpbVal:=size;
- result:=CallService(MS_DB_CONTACT_WRITESETTING,0,lParam(@cws));
-end;
-{$ENDIF}
function DBWriteSetting(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;dbv:PDBVARIANT):int_ptr;
var
@@ -259,145 +169,53 @@ begin end;
function DBWriteByte(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Byte):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_b(hContact, szModule, szSetting, val);
end;
-{$ELSE}
-var
- cws:TDBCONTACTWRITESETTING;
-begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- cws.value._type:=DBVT_BYTE;
- cws.value.bVal :=val;
- Result:=CallService(MS_DB_CONTACT_WRITESETTING,hContact,lParam(@cws));
-end;
-{$ENDIF}
function DBWriteWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:Word):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_w(hContact, szModule, szSetting, val);
end;
-{$ELSE}
-var
- cws:TDBCONTACTWRITESETTING;
-begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- cws.value._type:=DBVT_WORD;
- cws.value.wVal :=val;
- Result:=CallService(MS_DB_CONTACT_WRITESETTING,hContact,lParam(@cws));
-end;
-{$ENDIF}
function DBWriteDWord(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:dword):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_dw(hContact, szModule, szSetting, val);
end;
-{$ELSE}
-var
- cws:TDBCONTACTWRITESETTING;
-begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- cws.value._type:=DBVT_DWORD;
- cws.value.dVal :=val;
- Result:=CallService(MS_DB_CONTACT_WRITESETTING,hContact,lParam(@cws));
-end;
-{$ENDIF}
function DBWriteString(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;
val:PAnsiChar;enc:integer=DBVT_ASCIIZ):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_s(hContact, szModule, szSetting, val);
end;
-{$ELSE}
-var
- cws:TDBCONTACTWRITESETTING;
- p:dword;
-begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- cws.value._type :=enc;
- if val=nil then
- begin
- p:=0;
- val:=@p;
- end;
- cws.value.szVal.a:=val;
- Result:=CallService(MS_DB_CONTACT_WRITESETTING,hContact,lParam(@cws));
-end;
-{$ENDIF}
function DBWriteUTF8(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PAnsiChar):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_utf(hContact, szModule, szSetting, val);
end;
-{$ELSE}
-begin
- result:=DBWriteString(hContact,szModule,szSetting,val,DBVT_UTF8);
-end;
-{$ENDIF}
function DBWriteUnicode(hContact:THANDLE;szModule:PAnsiChar;szSetting:PAnsiChar;val:PWideChar):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_set_ws(hContact, szModule, szSetting, val);
end;
-{$ELSE}
-begin
- result:=DBWriteString(hContact,szModule,szSetting,PAnsiChar(val),DBVT_WCHAR);
-{
-var
- cws:TDBCONTACTWRITESETTING;
-begin
- cws.szModule :=szModule;
- cws.szSetting :=szSetting;
- cws.value._type :=DBVT_WCHAR;
- cws.value.szVal.w:=Val;
- Result:=CallService(MS_DB_CONTACT_WRITESETTING,hContact,lParam(@cws));
-}
-end;
-{$ENDIF}
function DBFreeVariant(dbv:PDBVARIANT):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_free(dbv);
end;
-{$ELSE}
-begin
- Result:=CallService(MS_DB_CONTACT_FREEVARIANT,0,lParam(dbv));
-end;
-{$ENDIF}
function DBDeleteSetting(hContact:THandle;szModule:PAnsiChar;szSetting:PAnsiChar):int_ptr;
-{$IFDEF UseCore}
{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=db_unset(hContact, szModule, szSetting);
end;
-{$ELSE}
-var
- cgs:TDBCONTACTGETSETTING;
-begin
- cgs.szModule :=szModule;
- cgs.szSetting:=szSetting;
- Result:=CallService(MS_DB_CONTACT_DELETESETTING,hContact,lParam(@cgs));
-end;
-{$ENDIF}
type
ppchar = ^pAnsiChar;
@@ -418,7 +236,6 @@ end; function DBDeleteGroup(hContact:THANDLE;szModule:PAnsiChar;prefix:pAnsiChar=nil):int_ptr;
var
ces:TDBCONTACTENUMSETTINGS;
- cgs:TDBCONTACTGETSETTING;
p:PAnsiChar;
num,len:integer;
ptr:pAnsiChar;
@@ -439,7 +256,6 @@ begin result:=CallService(MS_DB_CONTACT_ENUMSETTINGS,hContact,lparam(@ces));
ptr^:=#0;
- cgs.szModule:=szModule;
ptr:=p;
if (prefix<>nil) and (prefix^<>#0) then
len:=StrLen(prefix)
@@ -449,8 +265,7 @@ begin begin
if (len=0) or (StrCmp(prefix,ptr,len)=0) then
begin
- cgs.szSetting:=ptr;
- CallService(MS_DB_CONTACT_DELETESETTING,hContact,lParam(@cgs));
+ db_unset(hContact,szModule,ptr);
end;
while ptr^<>#0 do inc(ptr);
inc(ptr);
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 1b06920810..97717ea1cd 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -83,7 +83,7 @@ uses const
clGroup = 'Group';
-// Save / Load contact
+// Save / Load contact
const
opt_cproto = 'cproto';
opt_cuid = 'cuid';
@@ -424,7 +424,7 @@ var mwod:TMessageWindowOutputData;
begin
wnd:=GetParent(wnd); //!!
- hContact:=CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact:=db_find_first();
with mwid do
begin
cbSize:=SizeOf(mwid);
@@ -442,7 +442,7 @@ begin exit;
end
end;
- hContact:=CallService(MS_DB_CONTACT_FINDNEXT,hContact,0);
+ hContact:=db_find_next(hContact);
end;
result:=0;
end;
@@ -645,7 +645,7 @@ begin if uid=pAnsiChar(CALLSERVICE_NOTFOUND) then exit;
end;
- hContact:=CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact:=db_find_first();
while hContact<>0 do
begin
if is_chat then
@@ -685,7 +685,7 @@ begin end;
// added 2011.04.20
if result<>0 then break;
- hContact:=CallService(MS_DB_CONTACT_FINDNEXT,hContact,0);
+ hContact:=db_find_next(hContact);
end;
end;
@@ -752,10 +752,8 @@ function CreateGroupW(name:pWideChar;hContact:THANDLE):integer; var
groupId:integer;
groupIdStr:array [0..10] of AnsiChar;
- dbv:TDBVARIANT;
- cgs:TDBCONTACTGETSETTING;
grbuf:array [0..127] of WideChar;
- p:pWideChar;
+ p, pw:pWideChar;
begin
if (name=nil) or (name^=#0) then
begin
@@ -768,25 +766,20 @@ begin // Check for duplicate & find unused id
groupId:=0;
- cgs.szModule:='CListGroups';
- cgs.pValue :=@dbv;
repeat
- dbv._type:=DBVT_WCHAR;
- cgs.szSetting:=IntToStr(groupIdStr,groupId);
- if CallService(MS_DB_CONTACT_GETSETTING_STR,0,lParam(@cgs))<>0 then
+ pw:=DBReadUnicode(0,'CListGroups',IntToStr(groupIdStr,groupId));
+ if pw<>nil then
break;
- if StrCmpW(dbv.szVal.w+1,@grbuf[1])=0 then
+ if StrCmpW(pw+1,@grbuf[1])=0 then
begin
if hContact<>0 then
DBWriteUnicode(hContact,strCList,clGroup,@grbuf[1]);
- DBFreeVariant(@dbv);
result:=0;
exit;
end;
- DBFreeVariant(@dbv);
inc(groupId);
until false;
@@ -809,10 +802,8 @@ function CreateGroup(name:pAnsiChar;hContact:THANDLE):integer; var
groupId:integer;
groupIdStr:array [0..10] of AnsiChar;
- dbv:TDBVARIANT;
- cgs:TDBCONTACTGETSETTING;
grbuf:array [0..127] of AnsiChar;
- p:pAnsiChar;
+ p, pa:pAnsiChar;
begin
if (name=nil) or (name^=#0) then
begin
@@ -825,25 +816,19 @@ begin // Check for duplicate & find unused id
groupId:=0;
- cgs.szModule:='CListGroups';
- cgs.pValue :=@dbv;
repeat
- dbv._type:=DBVT_ASCIIZ;
- cgs.szSetting:=IntToStr(groupIdStr,groupId);
- if CallService(MS_DB_CONTACT_GETSETTING_STR,0,lParam(@cgs))<>0 then
+ pa:=DBReadString(0,'CListGroups',IntToStr(groupIdStr,groupId));
+ if pa=nil then
break;
- if StrCmp(dbv.szVal.a+1,@grbuf[1])=0 then
+ if StrCmp(pa+1,@grbuf[1])=0 then
begin
if hContact<>0 then
DBWriteString(hContact,strCList,clGroup,@grbuf[1]);
-
- DBFreeVariant(@dbv);
result:=0;
exit;
end;
- DBFreeVariant(@dbv);
inc(groupId);
until false;
diff --git a/plugins/Utils.pas/protocols.pas b/plugins/Utils.pas/protocols.pas index 101c1e4282..5b4c611e47 100644 --- a/plugins/Utils.pas/protocols.pas +++ b/plugins/Utils.pas/protocols.pas @@ -460,7 +460,7 @@ begin StrCopy(p,PS_SET_LISTENINGTO);
if ServiceExists(buf)<>0 then
status:=status or psf_tunes;
-
+
end;
inc(proto);
end;
@@ -468,7 +468,7 @@ begin {
if deepscan then
begin
- hContact:=CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ hContact:=db_find_first();
while hContact<>0 do
begin
i:=NumProto;
@@ -479,7 +479,7 @@ begin dec(i);
end;
- hContact:=CallService(MS_DB_CONTACT_FINDNEXT,hContact,0);
+ hContact:=db_find_next(hContact);
end;
end;
}
|