Line data Source code
1 : /*
2 : * Copyright (C) 2004-2026 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 General Public License as published by
6 : * the Free Software Foundation, either version 3 of the License, or
7 : * (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 General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 : */
17 : #pragma once
18 : #include <string>
19 : #include <map>
20 : #include <cstdint>
21 :
22 : enum class StreamType : uint8_t { audio, video };
23 :
24 : /**
25 : * @struct StreamData
26 : * @brief Contains information about an AV subject.
27 : * It's used by CallServicesManager.
28 : */
29 : struct StreamData
30 : {
31 : /**
32 : * @param callId
33 : * @param isReceived False if local audio/video streams
34 : * @param mediaType
35 : * @param conversationId
36 : * @param accountId
37 : */
38 1481 : StreamData(const std::string& callId,
39 : bool isReceived,
40 : const StreamType& mediaType,
41 : const std::string& conversationId,
42 : const std::string& accountId)
43 1481 : : id {std::move(callId)}
44 1481 : , direction {isReceived}
45 1481 : , type {mediaType}
46 1481 : , source {std::move(accountId)}
47 1481 : , conversation {std::move(conversationId)}
48 1481 : {}
49 : // callId
50 : const std::string id;
51 : // False if local audio/video.
52 : const bool direction;
53 : // StreamType -> audio or video.
54 : const StreamType type;
55 : // accountId
56 : const std::string source;
57 : // conversationId
58 : const std::string conversation;
59 : };
60 :
61 : /**
62 : * @struct JamiMessage
63 : * @brief Contains information about an exchanged message.
64 : * It's used by ChatServicesManager.
65 : */
66 : struct JamiMessage
67 : {
68 : /**
69 : * @param accId AccountId
70 : * @param pId peerId
71 : * @param isReceived True if received message, False if sent
72 : * @param dataMap Message contents
73 : * @param pPlugin True if message is created/modified by plugin code
74 : */
75 0 : JamiMessage(const std::string& accId,
76 : const std::string& pId,
77 : bool isReceived,
78 : const std::map<std::string, std::string>& dataMap,
79 : bool pPlugin)
80 0 : : accountId {accId}
81 0 : , peerId {pId}
82 0 : , direction {isReceived}
83 0 : , data {dataMap}
84 0 : , fromPlugin {pPlugin}
85 0 : {}
86 :
87 : std::string accountId;
88 : std::string peerId;
89 : // True if it's a received message.
90 : const bool direction;
91 : std::map<std::string, std::string> data;
92 : // True if message is originated from Plugin code.
93 : bool fromPlugin;
94 : bool isSwarm {false};
95 : bool fromHistory {false};
96 : };
|