You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
import { DataMessage } from './DataMessage';
 | 
						|
import { SignalService } from '../../../../../protobuf';
 | 
						|
import { MessageParams } from '../../Message';
 | 
						|
import { Constants } from '../../../..';
 | 
						|
 | 
						|
interface GroupInvitationMessageParams extends MessageParams {
 | 
						|
  serverAddress: string;
 | 
						|
  channelId: number;
 | 
						|
  serverName: string;
 | 
						|
  // if there is an expire timer set for the conversation, we need to set it.
 | 
						|
  // otherwise, it will disable the expire timer on the receiving side.
 | 
						|
  expireTimer?: number;
 | 
						|
}
 | 
						|
 | 
						|
export class GroupInvitationMessage extends DataMessage {
 | 
						|
  private readonly serverAddress: string;
 | 
						|
  private readonly channelId: number;
 | 
						|
  private readonly serverName: string;
 | 
						|
  private readonly expireTimer?: number;
 | 
						|
 | 
						|
  constructor(params: GroupInvitationMessageParams) {
 | 
						|
    super({ timestamp: params.timestamp, identifier: params.identifier });
 | 
						|
    this.serverAddress = params.serverAddress;
 | 
						|
    this.channelId = params.channelId;
 | 
						|
    this.serverName = params.serverName;
 | 
						|
    this.expireTimer = params.expireTimer;
 | 
						|
  }
 | 
						|
 | 
						|
  public ttl(): number {
 | 
						|
    return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
 | 
						|
  }
 | 
						|
 | 
						|
  public dataProto(): SignalService.DataMessage {
 | 
						|
    const groupInvitation = new SignalService.DataMessage.GroupInvitation({
 | 
						|
      serverAddress: this.serverAddress,
 | 
						|
      channelId: this.channelId,
 | 
						|
      serverName: this.serverName,
 | 
						|
    });
 | 
						|
 | 
						|
    return new SignalService.DataMessage({
 | 
						|
      groupInvitation,
 | 
						|
      expireTimer: this.expireTimer,
 | 
						|
    });
 | 
						|
  }
 | 
						|
}
 |