Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 1 | /* |
| 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-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 18 | import { AccountDetails, Devices, Message, VolatileDetails } from 'jami-web-common'; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 19 | import { RegisteredNameFoundState } from 'jami-web-common'; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 20 | |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 21 | import { ConversationRequestMetadata } from './conversation-request-metadata.js'; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 22 | import { |
| 23 | ConversationMemberEventType, |
| 24 | MessageState, |
| 25 | NameRegistrationEndedState, |
| 26 | RegistrationState, |
| 27 | } from './state-enums.js'; |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 28 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 29 | // These interfaces are used to hold all the parameters for signal handlers |
| 30 | // These parameters' names and types can be found in daemon/bin/nodejs/callback.h |
| 31 | // or in their relevant SWIG interface files (.i) in daemon/bin/nodejs |
| 32 | |
| 33 | export interface AccountDetailsChanged { |
| 34 | accountId: string; |
| 35 | details: AccountDetails; |
| 36 | } |
| 37 | |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 38 | export interface VolatileDetailsChanged { |
| 39 | accountId: string; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 40 | details: VolatileDetails; |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | export interface RegistrationStateChanged { |
| 44 | accountId: string; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 45 | state: RegistrationState; |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 46 | code: number; |
| 47 | details: string; |
| 48 | } |
| 49 | |
| 50 | export interface NameRegistrationEnded { |
| 51 | accountId: string; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 52 | state: NameRegistrationEndedState; |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 53 | username: string; |
| 54 | } |
| 55 | |
| 56 | export interface RegisteredNameFound { |
| 57 | accountId: string; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 58 | state: RegisteredNameFoundState; |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 59 | address: string; |
| 60 | username: string; |
| 61 | } |
Charlie | b62c678 | 2022-10-30 15:14:56 -0400 | [diff] [blame] | 62 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 63 | export interface KnownDevicesChanged { |
| 64 | accountId: string; |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 65 | devices: Devices; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 66 | } |
| 67 | |
Charlie | b62c678 | 2022-10-30 15:14:56 -0400 | [diff] [blame] | 68 | export interface IncomingAccountMessage { |
| 69 | accountId: string; |
| 70 | from: string; |
Misha Krieger-Raynauld | cb11bba | 2022-11-11 18:08:33 -0500 | [diff] [blame] | 71 | payload: Record<string, string>; |
| 72 | } |
| 73 | |
| 74 | export interface AccountMessageStatusChanged { |
| 75 | accountId: string; |
| 76 | messageId: string; |
| 77 | peer: string; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 78 | state: MessageState; |
Misha Krieger-Raynauld | cb11bba | 2022-11-11 18:08:33 -0500 | [diff] [blame] | 79 | } |
| 80 | |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 81 | export interface IncomingTrustRequest { |
| 82 | accountId: string; |
| 83 | conversationId: string; |
| 84 | from: string; |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 85 | payload: number[]; |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 86 | received: number; |
| 87 | } |
| 88 | |
Misha Krieger-Raynauld | cb11bba | 2022-11-11 18:08:33 -0500 | [diff] [blame] | 89 | export interface ContactAdded { |
| 90 | accountId: string; |
| 91 | contactId: string; |
| 92 | confirmed: boolean; |
| 93 | } |
| 94 | |
| 95 | export interface ContactRemoved { |
| 96 | accountId: string; |
| 97 | contactId: string; |
| 98 | banned: boolean; |
Charlie | b62c678 | 2022-10-30 15:14:56 -0400 | [diff] [blame] | 99 | } |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 100 | |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 101 | export interface ConversationRequestReceived { |
| 102 | accountId: string; |
| 103 | conversationId: string; |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 104 | metadata: ConversationRequestMetadata; |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 105 | } |
| 106 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 107 | export interface ConversationReady { |
| 108 | accountId: string; |
| 109 | conversationId: string; |
| 110 | } |
| 111 | |
| 112 | export interface ConversationRemoved { |
| 113 | accountId: string; |
| 114 | conversationId: string; |
| 115 | } |
| 116 | |
| 117 | export interface ConversationLoaded { |
| 118 | id: number; |
| 119 | accountId: string; |
| 120 | conversationId: string; |
Misha Krieger-Raynauld | 8a381da | 2022-11-03 17:37:51 -0400 | [diff] [blame] | 121 | messages: Message[]; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 122 | } |
| 123 | |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 124 | export interface ConversationMemberEvent { |
| 125 | accountId: string; |
| 126 | conversationId: string; |
| 127 | memberUri: string; |
Misha Krieger-Raynauld | 99e5a70 | 2022-11-30 22:36:52 -0500 | [diff] [blame] | 128 | event: ConversationMemberEventType; |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 129 | } |
| 130 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 131 | export interface MessageReceived { |
| 132 | accountId: string; |
| 133 | conversationId: string; |
Misha Krieger-Raynauld | 8a381da | 2022-11-03 17:37:51 -0400 | [diff] [blame] | 134 | message: Message; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 135 | } |
idillon | 3e378fd | 2022-12-23 11:48:12 -0500 | [diff] [blame] | 136 | |
| 137 | export interface ComposingStatusChanged { |
| 138 | accountId: string; |
| 139 | conversationId: string; |
| 140 | from: string; |
| 141 | status: number; |
| 142 | } |