parent
3ea0689d2f
commit
d1bfcd340b
@ -0,0 +1,36 @@
|
||||
import { DataMessage } from '../DataMessage';
|
||||
import { SignalService } from '../../../../../../protobuf';
|
||||
import { TextEncoder } from 'util';
|
||||
import { MessageParams } from '../../../Message';
|
||||
|
||||
interface ClosedGroupMessageParams extends MessageParams {
|
||||
groupId: string;
|
||||
}
|
||||
|
||||
export abstract class ClosedGroupMessage extends DataMessage {
|
||||
protected readonly groupId: string;
|
||||
|
||||
constructor(params: ClosedGroupMessageParams) {
|
||||
super({
|
||||
timestamp: params.timestamp,
|
||||
identifier: params.identifier,
|
||||
});
|
||||
this.groupId = params.groupId;
|
||||
}
|
||||
|
||||
protected abstract groupContextType(): SignalService.GroupContext.Type;
|
||||
|
||||
protected groupContext(): SignalService.GroupContext {
|
||||
const id = new TextEncoder().encode(this.groupId);
|
||||
const type = this.groupContextType();
|
||||
|
||||
return new SignalService.GroupContext({ id, type });
|
||||
}
|
||||
|
||||
protected dataProto(): SignalService.DataMessage {
|
||||
const dataMessage = new SignalService.DataMessage();
|
||||
dataMessage.group = this.groupContext();
|
||||
|
||||
return dataMessage;
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
export * from './ClosedGroupMessage';
|
||||
export * from './ClosedGroupChatMessage';
|
@ -1,5 +1,5 @@
|
||||
export * from './ClosedGroupChatMessage';
|
||||
export * from './DataMessage';
|
||||
export * from './DeviceUnlinkMessage';
|
||||
export * from './GroupInvitationMessage';
|
||||
export * from './ChatMessage';
|
||||
export * from './group';
|
||||
|
Loading…
Reference in New Issue