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 | 8a381da | 2022-11-03 17:37:51 -0400 | [diff] [blame] | 18 | import { AccountDetails, Message, VolatileDetails } from 'jami-web-common'; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 19 | |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 20 | import { Blob, StringMap } from './jami-swig.js'; |
| 21 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 22 | // 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 | |
| 26 | export interface AccountDetailsChanged { |
| 27 | accountId: string; |
| 28 | details: AccountDetails; |
| 29 | } |
| 30 | |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 31 | export interface VolatileDetailsChanged { |
| 32 | accountId: string; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 33 | details: VolatileDetails; |
Misha Krieger-Raynauld | addd6fe | 2022-10-22 12:46:04 -0400 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | export interface RegistrationStateChanged { |
| 37 | accountId: string; |
| 38 | state: string; |
| 39 | code: number; |
| 40 | details: string; |
| 41 | } |
| 42 | |
| 43 | export interface NameRegistrationEnded { |
| 44 | accountId: string; |
| 45 | state: number; |
| 46 | username: string; |
| 47 | } |
| 48 | |
| 49 | export interface RegisteredNameFound { |
| 50 | accountId: string; |
| 51 | state: number; |
| 52 | address: string; |
| 53 | username: string; |
| 54 | } |
Charlie | b62c678 | 2022-10-30 15:14:56 -0400 | [diff] [blame] | 55 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 56 | export interface KnownDevicesChanged { |
| 57 | accountId: string; |
| 58 | devices: Record<string, string>; |
| 59 | } |
| 60 | |
Charlie | b62c678 | 2022-10-30 15:14:56 -0400 | [diff] [blame] | 61 | export interface IncomingAccountMessage { |
| 62 | accountId: string; |
| 63 | from: string; |
Misha Krieger-Raynauld | cb11bba | 2022-11-11 18:08:33 -0500 | [diff] [blame] | 64 | payload: Record<string, string>; |
| 65 | } |
| 66 | |
| 67 | export 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 Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 74 | export interface IncomingTrustRequest { |
| 75 | accountId: string; |
| 76 | conversationId: string; |
| 77 | from: string; |
| 78 | payload: Blob; |
| 79 | received: number; |
| 80 | } |
| 81 | |
Misha Krieger-Raynauld | cb11bba | 2022-11-11 18:08:33 -0500 | [diff] [blame] | 82 | export interface ContactAdded { |
| 83 | accountId: string; |
| 84 | contactId: string; |
| 85 | confirmed: boolean; |
| 86 | } |
| 87 | |
| 88 | export interface ContactRemoved { |
| 89 | accountId: string; |
| 90 | contactId: string; |
| 91 | banned: boolean; |
Charlie | b62c678 | 2022-10-30 15:14:56 -0400 | [diff] [blame] | 92 | } |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 93 | |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 94 | export interface ConversationRequestReceived { |
| 95 | accountId: string; |
| 96 | conversationId: string; |
| 97 | metadata: StringMap; |
| 98 | } |
| 99 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 100 | export interface ConversationReady { |
| 101 | accountId: string; |
| 102 | conversationId: string; |
| 103 | } |
| 104 | |
| 105 | export interface ConversationRemoved { |
| 106 | accountId: string; |
| 107 | conversationId: string; |
| 108 | } |
| 109 | |
| 110 | export interface ConversationLoaded { |
| 111 | id: number; |
| 112 | accountId: string; |
| 113 | conversationId: string; |
Misha Krieger-Raynauld | 8a381da | 2022-11-03 17:37:51 -0400 | [diff] [blame] | 114 | messages: Message[]; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 115 | } |
| 116 | |
Michelle Sepkap Sime | dd82cbf | 2022-11-17 23:31:49 -0500 | [diff] [blame] | 117 | export interface ConversationMemberEvent { |
| 118 | accountId: string; |
| 119 | conversationId: string; |
| 120 | memberUri: string; |
| 121 | event: number; |
| 122 | } |
| 123 | |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 124 | export interface MessageReceived { |
| 125 | accountId: string; |
| 126 | conversationId: string; |
Misha Krieger-Raynauld | 8a381da | 2022-11-03 17:37:51 -0400 | [diff] [blame] | 127 | message: Message; |
Misha Krieger-Raynauld | 68a9b56 | 2022-10-28 19:47:46 -0400 | [diff] [blame] | 128 | } |