Adding a user to the tree-like common contact list.

 

Syntax

function mAddUserToCommonContacts(iUIN, iGroupID: integer): integer;

 

Parameters and return values

Parameter

Type

Value

iUIN

integer

unique user identifier, >0;

iGroupID

integer

group identifier in the common contact list; number.

 

Function result

0

no errors, user successfully added to the contact list;

-1

user already exists in the common contact list;

-2

group with such name does not exist;

-3

invalid user UIN;

-4

you can't add the built-in bot (UIN = 0) to the common contact list;

-5

common contact list is empty, create at least one group.

 

Example


var
  iGroupID, x: integer;
  sMsg: string;
begin
  iGroupID := mGetDepartmentIDByTextPath('MyChat Developers');
  
  mLogScript(inttostr(iGroupID), '');
  
    if iGroupID <> -1 then begin
      x := mAddUserToCommonContacts(30, iGroupID);
      
        case x of
          0: sMsg := 'all Ok!';
          -1: sMsg := 'user already is in the common contact list';
          -2: sMsg := 'wrong GroupID';
          -3: sMsg := 'user UIN does not exist';
          -4: sMsg := 'you can''t use UIN = 0';
        end;
        
      mLogScript(sMsg, IntToStr(x));  
    end;
end.


Script work result

[13:57:32] (Log "mAddUserToCommonContacts"): 12

[13:57:32] (Log "mAddUserToCommonContacts"): [0] all Ok!

[13:57:32] (Run "mAddUserToCommonContacts"): Script operation time: 19 ms

[13:57:32] (Run "mAddUserToCommonContacts"): Script done successfully.
 

See also

IntToStr

mGetDepartmentIDByTextPath

mLogScript