blob: 960034ba1fbc59577ccc1237b43987a165fda94f [file] [log] [blame]
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -04001/*
2 * Copyright (C) 2022 Savoir-faire Linux Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
13 *
14 * You should have received a copy of the GNU Affero General Public
15 * License along with this program. If not, see
16 * <https://www.gnu.org/licenses/>.
17 */
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050018import { AccountDetails, Devices, Message, VolatileDetails } from 'jami-web-common';
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040019
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050020import { ConversationRequestMetadata } from './conversation-request-metadata.js';
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050021
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040022// These interfaces are used to hold all the parameters for signal handlers
23// These parameters' names and types can be found in daemon/bin/nodejs/callback.h
24// or in their relevant SWIG interface files (.i) in daemon/bin/nodejs
25
26export interface AccountDetailsChanged {
27 accountId: string;
28 details: AccountDetails;
29}
30
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040031export interface VolatileDetailsChanged {
32 accountId: string;
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040033 details: VolatileDetails;
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040034}
35
36export interface RegistrationStateChanged {
37 accountId: string;
38 state: string;
39 code: number;
40 details: string;
41}
42
43export interface NameRegistrationEnded {
44 accountId: string;
45 state: number;
46 username: string;
47}
48
49export interface RegisteredNameFound {
50 accountId: string;
51 state: number;
52 address: string;
53 username: string;
54}
Charlieb62c6782022-10-30 15:14:56 -040055
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040056export interface KnownDevicesChanged {
57 accountId: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050058 devices: Devices;
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040059}
60
Charlieb62c6782022-10-30 15:14:56 -040061export interface IncomingAccountMessage {
62 accountId: string;
63 from: string;
Misha Krieger-Raynauldcb11bba2022-11-11 18:08:33 -050064 payload: Record<string, string>;
65}
66
67export interface AccountMessageStatusChanged {
68 accountId: string;
69 messageId: string;
70 peer: string;
71 state: number; // TODO: Replace state number with enum (see account_const.h)
72}
73
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050074export interface IncomingTrustRequest {
75 accountId: string;
76 conversationId: string;
77 from: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050078 payload: number[];
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050079 received: number;
80}
81
Misha Krieger-Raynauldcb11bba2022-11-11 18:08:33 -050082export interface ContactAdded {
83 accountId: string;
84 contactId: string;
85 confirmed: boolean;
86}
87
88export interface ContactRemoved {
89 accountId: string;
90 contactId: string;
91 banned: boolean;
Charlieb62c6782022-10-30 15:14:56 -040092}
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040093
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050094export interface ConversationRequestReceived {
95 accountId: string;
96 conversationId: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050097 metadata: ConversationRequestMetadata;
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050098}
99
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400100export interface ConversationReady {
101 accountId: string;
102 conversationId: string;
103}
104
105export interface ConversationRemoved {
106 accountId: string;
107 conversationId: string;
108}
109
110export interface ConversationLoaded {
111 id: number;
112 accountId: string;
113 conversationId: string;
Misha Krieger-Raynauld8a381da2022-11-03 17:37:51 -0400114 messages: Message[];
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400115}
116
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -0500117export interface ConversationMemberEvent {
118 accountId: string;
119 conversationId: string;
120 memberUri: string;
121 event: number;
122}
123
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400124export interface MessageReceived {
125 accountId: string;
126 conversationId: string;
Misha Krieger-Raynauld8a381da2022-11-03 17:37:51 -0400127 message: Message;
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400128}