diff options
Diffstat (limited to 'plugins/Utils.pas/mircontacts.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
|