summaryrefslogtreecommitdiff
path: root/plugins/Utils.pas
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Utils.pas')
-rw-r--r--plugins/Utils.pas/contact.pas10
-rw-r--r--plugins/Utils.pas/dbsettings.pas93
-rw-r--r--plugins/Utils.pas/editwrapper.pas4
-rw-r--r--plugins/Utils.pas/mirutils.pas98
-rw-r--r--plugins/Utils.pas/sparam.pas8
-rw-r--r--plugins/Utils.pas/structopts.rc5
-rw-r--r--plugins/Utils.pas/structopts.resbin6324 -> 6384 bytes
-rw-r--r--plugins/Utils.pas/wrapper.pas4
8 files changed, 112 insertions, 110 deletions
diff --git a/plugins/Utils.pas/contact.pas b/plugins/Utils.pas/contact.pas
index 9dc959c91f..697c603591 100644
--- a/plugins/Utils.pas/contact.pas
+++ b/plugins/Utils.pas/contact.pas
@@ -3,21 +3,21 @@ unit contact;
interface
-uses windows;
+uses windows, m_api;
procedure FillContactList(list:hwnd; filter:boolean=true;format:pWideChar=nil);
-function FindContact(list:hwnd;contact:THANDLE):integer;
+function FindContact(list:hwnd;contact:HCONTACT):integer;
implementation
-uses messages, common, m_api, dbsettings, mirutils;
+uses messages, common, dbsettings, mirutils;
const
defformat = '%name% - %uid% (%account%:%group%)';
procedure FillContactList(list:hwnd; filter:boolean=true;format:pWideChar=nil);
var
- hContact:THANDLE;
+ hContact:THCONTACT;
buf:array [0..511] of WideChar;
buf1:array [0..63] of WideChar;
p:PWideChar;
@@ -109,7 +109,7 @@ begin
end;
end;
-function FindContact(list:hwnd;contact:THANDLE):integer;
+function FindContact(list:hwnd;contact:HCONTACT):integer;
var
j:integer;
begin
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
diff --git a/plugins/Utils.pas/editwrapper.pas b/plugins/Utils.pas/editwrapper.pas
index a3cd58debc..ff3c77a423 100644
--- a/plugins/Utils.pas/editwrapper.pas
+++ b/plugins/Utils.pas/editwrapper.pas
@@ -2,7 +2,7 @@ unit EditWrapper;
interface
-uses windows;
+uses windows,m_api;
// exported flags
const
@@ -32,7 +32,7 @@ function ShowEditBox(parent:HWND;var text:pWideChar;title:pWideChar):int_ptr;
implementation
-uses messages,commctrl,common,wrapper,m_api;
+uses messages,commctrl,common,wrapper;
{$R editwrapper.res}
{$include 'i_text_const.inc'}
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas
index e5e761b24b..920a969b49 100644
--- a/plugins/Utils.pas/mirutils.pas
+++ b/plugins/Utils.pas/mirutils.pas
@@ -20,10 +20,10 @@ function RegisterSingleIcon(resname,ilname,descr,group:PAnsiChar):int;
// others
-function ConvertFileName(src:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload;
-function ConvertFileName(src:pWideChar;hContact:THANDLE=0):pWideChar; overload;
-function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload;
-function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:THANDLE=0):pWideChar; overload;
+function ConvertFileName(src:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload;
+function ConvertFileName(src:pWideChar;hContact:HCONTACT=0):pWideChar; overload;
+function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload;
+function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:HCONTACT=0):pWideChar; overload;
procedure ShowPopupW(text:pWideChar;title:pWideChar=nil);
function GetAddonFileName(prefix,altname,path:PAnsiChar;ext:PAnsiChar):PAnsiChar;
@@ -31,31 +31,31 @@ function TranslateA2W(sz:PAnsiChar):PWideChar;
function MirandaCP:integer;
function isVarsInstalled:bool;
-function ParseVarString(astr:pAnsiChar;aContact:THANDLE=0;extra:pAnsiChar=nil):pAnsiChar; overload;
-function ParseVarString(astr:pWideChar;aContact:THANDLE=0;extra:pWideChar=nil):pWideChar; overload;
+function ParseVarString(astr:pAnsiChar;aContact:HCONTACT=0;extra:pAnsiChar=nil):pAnsiChar; overload;
+function ParseVarString(astr:pWideChar;aContact:HCONTACT=0;extra:pWideChar=nil):pWideChar; overload;
function ShowVarHelp(dlg:HWND;id:integer=0):integer;
-function IsChat(hContact:THANDLE):bool;
-procedure SendToChat(hContact:THANDLE;pszText:PWideChar);
-
-function LoadContact(group,setting:PAnsiChar):THANDLE;
-function SaveContact(hContact:THANDLE;group,setting:PAnsiChar):integer;
-
-function SetCListSelContact(hContact:THANDLE):THANDLE;
-function GetCListSelContact:THANDLE; {$IFDEF DELPHI_10_UP}inline;{$ENDIF}
-function GetContactProtoAcc(hContact:THANDLE):PAnsiChar;
-function IsMirandaUser(hContact:THANDLE):integer; // >0=Miranda; 0=Not miranda; -1=unknown
-procedure ShowContactDialog(hContact:THANDLE;DblClk:boolean=true;anystatus:boolean=true);
-function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):THANDLE;
-function WndToContact(wnd:hwnd):THANDLE; overload;
-function WndToContact:THANDLE; overload;
-function GetContactStatus(hContact:THANDLE):integer;
+function IsChat(hContact:HCONTACT):bool;
+procedure SendToChat(hContact:HCONTACT;pszText:PWideChar);
+
+function LoadContact(group,setting:PAnsiChar):HCONTACT;
+function SaveContact(hContact:HCONTACT;group,setting:PAnsiChar):integer;
+
+function SetCListSelContact(hContact:HCONTACT):HCONTACT;
+function GetCListSelContact:HCONTACT; {$IFDEF DELPHI_10_UP}inline;{$ENDIF}
+function GetContactProtoAcc(hContact:HCONTACT):PAnsiChar;
+function IsMirandaUser(hContact:HCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown
+procedure ShowContactDialog(hContact:HCONTACT;DblClk:boolean=true;anystatus:boolean=true);
+function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):HCONTACT;
+function WndToContact(wnd:hwnd):HCONTACT; overload;
+function WndToContact:HCONTACT; overload;
+function GetContactStatus(hContact:HCONTACT):integer;
// -2 - deleted account, -1 - disabled account, 0 - hidden
// 1 - metacontact, 2 - submetacontact, positive - active
// proto - ASSIGNED buffer
-function IsContactActive(hContact:THANDLE;proto:pAnsiChar=nil):integer;
+function IsContactActive(hContact:HCONTACT;proto:pAnsiChar=nil):integer;
-function CreateGroupW(name:pWideChar;hContact:THANDLE):integer;
+function CreateGroupW(name:pWideChar;hContact:HCONTACT):integer;
function MakeGroupMenu(idxfrom:integer=100):HMENU;
function GetNewGroupName(parent:HWND):pWideChar;
@@ -95,7 +95,7 @@ begin
SendMessage(btn,BM_SETIMAGE,IMAGE_ICON,result);
end;
-function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:THANDLE=0):pWideChar; overload;
+function ConvertFileName(src:pWideChar;dst:pWideChar;hContact:HCONTACT=0):pWideChar; overload;
var
pc:pWideChar;
begin
@@ -115,7 +115,7 @@ begin
end;
end;
-function ConvertFileName(src:pWideChar;hContact:THANDLE=0):pWideChar; overload;
+function ConvertFileName(src:pWideChar;hContact:HCONTACT=0):pWideChar; overload;
var
buf1:array [0..511] of WideChar;
begin
@@ -125,7 +125,7 @@ begin
result:=nil;
end;
-function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload;
+function ConvertFileName(src:pAnsiChar;dst:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload;
var
pc:pAnsiChar;
begin
@@ -145,7 +145,7 @@ begin
end;
end;
-function ConvertFileName(src:pAnsiChar;hContact:THANDLE=0):pAnsiChar; overload;
+function ConvertFileName(src:pAnsiChar;hContact:HCONTACT=0):pAnsiChar; overload;
var
buf1:array [0..511] of AnsiChar;
begin
@@ -165,7 +165,7 @@ begin
result:=MirCP;
end;
-function IsChat(hContact:THANDLE):bool;
+function IsChat(hContact:HCONTACT):bool;
begin
result:=DBReadByte(hContact,
PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0)),
@@ -173,16 +173,19 @@ begin
end;
function isVarsInstalled:bool;
+{$IFDEF AllowInline}inline;{$ENDIF}
begin
result:=ServiceExists(MS_VARS_FORMATSTRING)<>0;
end;
-function ParseVarString(astr:pAnsiChar;aContact:THANDLE=0;extra:pAnsiChar=nil):pAnsiChar;
+function ParseVarString(astr:pAnsiChar;aContact:HCONTACT=0;extra:pAnsiChar=nil):pAnsiChar;
var
tfi:TFORMATINFO;
tmp,pc:pAnsiChar;
dat:TREPLACEVARSDATA;
begin
+ if (astr=nil) or (astr^=#0) then exit;
+
if ServiceExists(MS_UTILS_REPLACEVARS)<>0 then
begin
FillChar(dat,SizeOf(TREPLACEVARSDATA),0);
@@ -214,12 +217,14 @@ begin
mir_free(pc);
end;
-function ParseVarString(astr:pWideChar;aContact:THANDLE=0;extra:pWideChar=nil):pWideChar;
+function ParseVarString(astr:pWideChar;aContact:HCONTACT=0;extra:pWideChar=nil):pWideChar;
var
tfi:TFORMATINFO;
tmp,pc:pWideChar;
dat:TREPLACEVARSDATA;
begin
+ if (astr=nil) or (astr^=#0) then exit;
+
if ServiceExists(MS_UTILS_REPLACEVARS)<>0 then
begin
FillChar(dat,SizeOf(TREPLACEVARSDATA),0);
@@ -251,7 +256,6 @@ begin
StrDupW(result,astr);
end;
mir_free(pc); // forced!
-// mFreeMem(pc);
end;
function ShowVarHelp(dlg:HWND;id:integer=0):integer;
@@ -310,7 +314,7 @@ begin
end;
end;
-function GetContactProtoAcc(hContact:THANDLE):PAnsiChar;
+function GetContactProtoAcc(hContact:HCONTACT):PAnsiChar;
begin
if ServiceExists(MS_PROTO_GETCONTACTBASEACCOUNT)<>0 then
result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEACCOUNT,hContact,0))
@@ -318,7 +322,7 @@ begin
result:=PAnsiChar(CallService(MS_PROTO_GETCONTACTBASEPROTO,hContact,0));
end;
-function IsMirandaUser(hContact:THANDLE):integer; // >0=Miranda; 0=Not miranda; -1=unknown
+function IsMirandaUser(hContact:HCONTACT):integer; // >0=Miranda; 0=Not miranda; -1=unknown
var
sz:PAnsiChar;
begin
@@ -333,7 +337,7 @@ begin
result:=-1;
end;
-function SetCListSelContact(hContact:THANDLE):THANDLE;
+function SetCListSelContact(hContact:HCONTACT):HCONTACT;
var
wnd:HWND;
begin
@@ -349,7 +353,7 @@ begin
result:=SendMessageW(CallService(MS_CLUI_GETHWNDTREE,0,0),CLM_GETSELECTION,0,0);
end;
-function LoadContact(group,setting:PAnsiChar):THANDLE;
+function LoadContact(group,setting:PAnsiChar):HCONTACT;
var
p,proto:pAnsiChar;
section:array [0..63] of AnsiChar;
@@ -374,7 +378,7 @@ begin
mFreeMem(dbv.szVal.W);
end;
-function SaveContact(hContact:THANDLE;group,setting:PAnsiChar):integer;
+function SaveContact(hContact:HCONTACT;group,setting:PAnsiChar):integer;
var
p,proto,uid:pAnsiChar;
cws:TDBVARIANT;
@@ -416,9 +420,9 @@ begin
end;
end;
-function WndToContact(wnd:hwnd):THANDLE; overload;
+function WndToContact(wnd:hwnd):HCONTACT; overload;
var
- hContact:THANDLE;
+ hContact:THCONTACT;
mwid:TMessageWindowInputData;
mwod:TMessageWindowOutputData;
begin
@@ -446,7 +450,7 @@ begin
result:=0;
end;
-function WndToContact:THANDLE; overload;
+function WndToContact:HCONTACT; overload;
var
wnd:HWND;
begin
@@ -461,7 +465,7 @@ begin
result:=GetCListSelContact;
end;
-function GetContactStatus(hContact:THANDLE):integer;
+function GetContactStatus(hContact:HCONTACT):integer;
var
szProto:PAnsiChar;
begin
@@ -551,7 +555,7 @@ begin
end;
end;
-procedure ShowContactDialog(hContact:THANDLE;DblClk:boolean=true;anystatus:boolean=true);
+procedure ShowContactDialog(hContact:HCONTACT;DblClk:boolean=true;anystatus:boolean=true);
var
pc:array [0..127] of AnsiChar;
begin
@@ -605,7 +609,7 @@ begin
CallServiceSync(MS_GC_EVENT,0,lparam(@gce));
end;
-procedure SendToChat(hContact:THANDLE;pszText:PWideChar);
+procedure SendToChat(hContact:HCONTACT;pszText:PWideChar);
var
gci:TGC_INFO;
pszModule:PAnsiChar;
@@ -618,7 +622,7 @@ begin
while i<cnt do
begin
gci.iItem:=i;
- gci.Flags:=GCI_BYINDEX+GCI_HCONTACT+GCI_ID;
+ gci.Flags:=GCF_BYINDEX+GCF_HCONTACT+GCF_ID;
CallService(MS_GC_GETINFO,0,lparam(@gci));
if gci.hContact=hContact then
begin
@@ -629,11 +633,11 @@ begin
end;
end;
-function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):THANDLE;
+function FindContactHandle(proto:pAnsiChar;const dbv:TDBVARIANT;is_chat:boolean=false):HCONTACT;
var
uid:pAnsiChar;
ldbv:TDBVARIANT;
- hContact:THANDLE;
+ hContact:THCONTACT;
pw:pWideChar;
begin
result:=0;
@@ -688,7 +692,7 @@ begin
end;
end;
-function IsContactActive(hContact:THANDLE;proto:pAnsiChar=nil):integer;
+function IsContactActive(hContact:HCONTACT;proto:pAnsiChar=nil):integer;
var
p:PPROTOACCOUNT;
name: array [0..31] of AnsiChar;
@@ -737,7 +741,7 @@ begin
end;
// Import plugin function adaptation
-function CreateGroupW(name:pWideChar;hContact:THANDLE):integer;
+function CreateGroupW(name:pWideChar;hContact:HCONTACT):integer;
var
groupId:integer;
groupIdStr:array [0..10] of AnsiChar;
diff --git a/plugins/Utils.pas/sparam.pas b/plugins/Utils.pas/sparam.pas
index 5a686aa4a8..80a7b150db 100644
--- a/plugins/Utils.pas/sparam.pas
+++ b/plugins/Utils.pas/sparam.pas
@@ -2,7 +2,7 @@ unit sparam;
interface
-uses windows;
+uses windows, m_api;
const
// parameter flags
@@ -50,7 +50,7 @@ function SetParamLabel (Dialog:HWND; lbl:pWideChar):HWND;
procedure ClearParam (flags:dword; var param);
function DuplicateParam(flags:dword; var sparam,dparam):dword;
-function TranslateParam(param:uint_ptr;flags:dword;hContact:THANDLE):uint_ptr;
+function TranslateParam(param:uint_ptr;flags:dword;hContact:HCONTACT):uint_ptr;
function CreateResultBlock(parent:HWND;x,y,width:integer;flags:dword=0):THANDLE;
function ClearResultFields(Dialog:HWND):HWND;
@@ -62,7 +62,7 @@ implementation
uses
messages,
common, editwrapper, wrapper, syswin,
- m_api, sedit, strans,
+ sedit, strans,
mirutils;
const
@@ -651,7 +651,7 @@ begin
result:=flags;
end;
-function TranslateParam(param:uint_ptr;flags:dword;hContact:THANDLE):uint_ptr;
+function TranslateParam(param:uint_ptr;flags:dword;hContact:HCONTACT):uint_ptr;
var
tmp1:pWideChar;
begin
diff --git a/plugins/Utils.pas/structopts.rc b/plugins/Utils.pas/structopts.rc
index f7e4a2750e..f4ee41cc7a 100644
--- a/plugins/Utils.pas/structopts.rc
+++ b/plugins/Utils.pas/structopts.rc
@@ -45,9 +45,10 @@ FONT 8, "MS Shell Dlg", 0, 0
EDITTEXT IDC_DATA_EDTN, 186, 55, 160, 11
#ifdef Miranda
CONTROL "V" ,IDC_VAR_HELP ,"MButtonClass",WS_TABSTOP,328,137,16,16,$18000000
- AUTOCHECKBOX "Use Variables", IDC_DATA_VARS, 186, 138, 142, 14
- AUTOCHECKBOX "Use MMI" , IDC_DATA_MMI , 186, 152, 160, 14
+ AUTOCHECKBOX "Use Variables", IDC_DATA_VARS , 186, 138, 142, 14
+ AUTOCHECKBOX "Use MMI" , IDC_DATA_MMI , 186, 153, 160, 14
#endif
+ AUTOCHECKBOX "Structure size", IDC_DATA_SIZE, 186, 153, 160, 14
DEFPUSHBUTTON "&Change", IDC_DATA_CHANGE, 186, 168, 46, 14//, WS_GROUP
PUSHBUTTON "&OK" , IDOK , 250, 168, 46, 14
diff --git a/plugins/Utils.pas/structopts.res b/plugins/Utils.pas/structopts.res
index ec27d88e3e..b97d2fff3c 100644
--- a/plugins/Utils.pas/structopts.res
+++ b/plugins/Utils.pas/structopts.res
Binary files differ
diff --git a/plugins/Utils.pas/wrapper.pas b/plugins/Utils.pas/wrapper.pas
index 25b23a05f0..a663f5fa9c 100644
--- a/plugins/Utils.pas/wrapper.pas
+++ b/plugins/Utils.pas/wrapper.pas
@@ -540,11 +540,13 @@ var
hfo :HFONT;
tm :TTEXTMETRIC;
size:TSIZE;
+ tmp :pWideChar;
begin
dc:=GetDC(wnd);
hfo:=SelectObject(dc,SendMessage(wnd,WM_GETFONT,0,0));
GetTextMetrics(dc,tm);
- GetTextExtentPoint32(dc,'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',52,size);
+ tmp:='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
+ GetTextExtentPoint32W(dc,tmp,52,size);
SelectObject(dc,hfo);
ReleaseDC(wnd,dc);
baseUnitX:=(size.cx div 26+1) div 2;