TsgcWSPClient_PresenceEvents › OnChannelInvitation

OnChannelInvitation Event

Fires when this member is invited to a channel; set Accept to join.

Syntax

property OnChannelInvitation: TsgcWSPresenceChannelInvitationEvent;
// TsgcWSPresenceChannelInvitationEvent = procedure(Connection: TsgcWSConnection; const aMember: TsgcWSPresenceMember; const aChannel: TsgcWSPresenceChannel; var Accept: Boolean; var aErrorCode: integer; var aErrorText: string) of object

Default Value

Remarks

Fires when another member calls Invite targeting this client. aMember identifies the inviter, aChannel the channel they are inviting you to. Set Accept to True to automatically subscribe to aChannel; leave it False to decline. When declining you may also set aErrorCode and aErrorText so the inviter's OnChannelInvitationResponse carries a reason.

Example

procedure TForm1.oPresenceChannelInvitation(Connection: TsgcWSConnection;
  const aMember: TsgcWSPresenceMember; const aChannel: TsgcWSPresenceChannel;
  var Accept: Boolean; var aErrorCode: integer; var aErrorText: string);
begin
  Accept := MessageDlg(
    aMember.Name + ' invites you to ' + aChannel.Name + '. Join?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes;
  if not Accept then
  begin
    aErrorCode := 1;
    aErrorText := 'Invitation refused';
  end;
end;

Back to Events