core/src/types/message.ts

36 lines
659 B
TypeScript
Raw Normal View History

2020-11-21 15:41:08 +00:00
import { IPlugin } from '../plugin/plugin';
2020-11-28 13:34:34 +00:00
import { Protocol } from './protocol';
2020-11-21 15:41:08 +00:00
2020-11-28 19:08:23 +00:00
// TODO: Source specification to support plugin services.
export enum EMessageType {
message = 0,
roomJoin = 1,
roomLeave = 2,
roomKick = 3,
nameChange = 4,
edit = 5,
}
export interface IMessageTarget {
id: string;
name: string;
2020-11-29 19:23:43 +00:00
server?: string;
}
2020-11-21 15:41:08 +00:00
export interface IMessage {
2020-11-29 19:23:43 +00:00
id?: any;
type: EMessageType;
2020-11-21 15:41:08 +00:00
data: any;
2020-11-29 19:23:43 +00:00
source: Protocol;
guest?: boolean;
target?: IMessageTarget;
sender?: IMessageTarget;
2020-11-29 19:23:43 +00:00
fullSenderID?: string;
fullRoomID?: string;
2020-11-21 15:41:08 +00:00
time: Date;
2020-11-29 19:23:43 +00:00
direct?: boolean;
resolved: boolean;
2020-11-21 15:41:08 +00:00
resolve(...args: any[]): void;
}