diff options
author | George Hazan <ghazan@miranda.im> | 2021-05-13 14:02:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-05-13 14:02:22 +0300 |
commit | b378298146b77902d23658624d7cb18edf74d0ae (patch) | |
tree | ec9832562d8831c4a6e19fb0a1c02744de1bc07f /plugins/Utils.pas | |
parent | 2365166217d0cfae5e728e062ee1dd4f5e964729 (diff) |
this function is still needed inside the module locally
Diffstat (limited to 'plugins/Utils.pas')
-rw-r--r-- | plugins/Utils.pas/mircontacts.pas | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index f8c9c359c7..9a34525d24 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -78,6 +78,41 @@ begin result:=-1;
end;
+function IsContactActive(hContact:TMCONTACT;Proto:PAnsiChar=nil):integer;
+var
+ p:PPROTOACCOUNT;
+ name: array [0..31] of AnsiChar;
+begin
+
+ if db_get_static(hContact,'Protocol','p',@name,SizeOf(name))=0 then
+ begin
+ result:=0;
+
+ p:=Proto_GetAccount(@name);
+ if p=nil then
+ result:=-2 // deleted
+ else if (not p^.bIsEnabled) or p^.bDynDisabled then
+ result:=-1; // disabled
+
+ if (result=0) and (DBReadByte(hContact,strCList,'Hidden',0)=0) then
+ begin
+ result:=255;
+ if db_mc_getMeta(hContact)<>0 then
+ result:=2;
+ if StrCmp(Proto_GetBaseAccountName(hContact),META_PROTO)=0 then
+ result:=1;
+ end;
+ if Proto<>nil then
+ StrCopy(Proto,@name);
+ end
+ else
+ begin
+ result:=-2;
+ if Proto<>nil then
+ Proto^:=#0;
+ end;
+end;
+
//----- Save / Load contact -----
const
|