Add a user to a specified person's personal contact list. If there is no group with such a name, it will be created automatically.

 

If you need to add several contacts to a group — use the function mPersonalContactsAddUsers.

 

Syntax

function mPersonalContactsAddUser(iUINOwner, iUIN: integer; sGroupName: string): integer;

 

Parameters and return values

Parameter

Type

Value

iUINOwner

integer

user unique ID; the owner of a personal contact list, >0

iUIN

integer

added user, UIN >0;

sGroupName

string

group name. You can't use control characters; can't be empty.

 

Function result

=0

no errors; a user was added to a personal contact list successfully;

-1

nonexistent UIN owner of a personal contact list;

-2

nonexistent UIN of the added user;

-3

UIN can't be 0 (built-in bot);

-4

group name can't be empty or consist of spaces;

-5

group name is too long (by default, the limitation is 255 characters);

-6

group name has forbidden characters (CRLF, control unprintable UNICODE or ASCII characters);

-7

you can't add yourself to a personal contact list;

-8

such contact is already in the list.

 

Example


const
  UIN_OWNER  = 6;
  UIN_USER   = 3;
  GROUP_NAME = 'First group';
var
  sMsg: string;
  iResult: integer;
begin
  iResult := mPersonalContactsAddUser(UIN_OWNER, UIN_USER, GROUP_NAME);
   
    case iResult of
       0: begin
         sMsg := 'all ok!';
         mPersonalContactsRefresh(UIN_OWNER);
       end;  
      -1: sMsg := 'unknown owner UIN';
      -2: sMsg := 'wrong user UIN';
      -3: sMsg := 'you can''t use UIN = 0';
      -4: sMsg := 'group name cannot be empty';
      -5: sMsg := 'group name is too long';
      -6: sMsg := 'group name has invalid characters';
      -7: sMsg := 'you can''t add yourself to the personal contact list';
      -8: sMsg := 'such contact is already in the list';
     end;
        
  mLogScript(sMsg, '');  
end.


Scripts work result

[18:58:40] (Log "mPersonalContactsAddUser"): such contact is already in the list

[18:58:40] (Run "mPersonalContactsAddUser"): Script operation time: 5 ms

[18:58:40] (Run "mPersonalContactsAddUser"): Script done successfully.

 

See also

mPersonalContactsRefresh

mLogScript