Ring Daemon
Loading...
Searching...
No Matches
account_config.h
Go to the documentation of this file.
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 "config/serializable.h"
19#include "string_utils.h"
20
21#include <string>
22#include <utility>
23#include <map>
24#include <filesystem>
25
26using namespace std::literals;
27
28namespace jami {
29constexpr const char* const DEFAULT_RINGTONE_PATH = "default.opus";
30
32{
33 AccountConfig(const std::string& type_, const std::string& id_, const std::filesystem::path& path_ = {})
34 : type(type_)
35 , id(id_)
36 , path(path_)
37 {}
38
39 void serializeDiff(YAML::Emitter& out, const AccountConfig& def) const;
40
41 virtual void serialize(YAML::Emitter& out) const = 0;
42 virtual void unserialize(const YAML::Node& node);
43
44 virtual std::map<std::string, std::string> toMap() const;
45 virtual void fromMap(const std::map<std::string, std::string>&);
46
48 const std::string type;
49
51 const std::string id;
52
56 const std::filesystem::path path;
57
59 std::string alias {};
60
61 std::string username {};
62
64 std::string hostname {};
65
67 bool enabled {true};
68
70 bool autoAnswerEnabled {false};
71
74
76 bool sendReadReceipt {true};
77
79 bool sendComposing {true};
80
82 bool isRendezVous {false};
83
92
93 std::vector<unsigned> activeCodecs {};
94
98 bool ringtoneEnabled {true};
99
104
108 bool videoEnabled {true};
109
113 std::string displayName {};
114
118 std::string customUserAgent {};
119
123 std::string mailbox {};
124
128 bool upnpEnabled {true};
129
130 std::set<std::string> defaultModerators {};
133
137 std::string deviceKey {};
141 std::string platform {};
142
146 std::string notificationTopic {};
147
151 std::string uiCustomization {};
152};
153
154inline void
155parseString(const std::map<std::string, std::string>& details, const char* key, std::string& s)
156{
157 auto it = details.find(key);
158 if (it != details.end())
159 s = it->second;
160}
161
162inline void
163parseBool(const std::map<std::string, std::string>& details, const char* key, bool& s)
164{
165 auto it = details.find(key);
166 if (it != details.end())
167 s = it->second == TRUE_STR;
168}
169
170template<class T>
171inline void
172parseInt(const std::map<std::string, std::string>& details, const char* key, T& s)
173{
174 auto it = details.find(key);
175 if (it != details.end())
176 s = to_int<T>(it->second);
177}
178
179void parsePath(const std::map<std::string, std::string>& details,
180 const char* key,
181 std::string& s,
182 const std::filesystem::path& base);
183
184} // namespace jami
void parseBool(const std::map< std::string, std::string > &details, const char *key, bool &s)
static constexpr const char TRUE_STR[]
void emitSignal(Args... args)
Definition jami_signal.h:64
void parseInt(const std::map< std::string, std::string > &details, const char *key, T &s)
void parseString(const std::map< std::string, std::string > &details, const char *key, std::string &s)
void parsePath(const std::map< std::string, std::string > &details, const char *key, std::string &s, const std::filesystem::path &base)
constexpr const char *const DEFAULT_RINGTONE_PATH
std::string platform
Device push notification platform.
std::vector< unsigned > activeCodecs
std::string deviceKey
Device push notification token.
bool ringtoneEnabled
Play ringtone when receiving a call.
bool enabled
True if the account is enabled.
std::string alias
A user-defined name for this account.
std::string hostname
SIP hostname (SIP account) or DHT bootstrap nodes (Jami account)
AccountConfig(const std::string &type_, const std::string &id_, const std::filesystem::path &path_={})
bool autoAnswerEnabled
If true, automatically answer calls to this account.
std::set< std::string > defaultModerators
bool denySecondCallEnabled
If true, automatically deny new calls when already in one call to this account.
virtual void fromMap(const std::map< std::string, std::string > &)
const std::string type
Account type.
virtual std::map< std::string, std::string > toMap() const
int activeCallLimit
The number of concurrent calls for the account -1: Unlimited 0: Do not disturb 1: Single call +: Mult...
bool upnpEnabled
UPnP IGD controller and the mutex to access it.
virtual void serialize(YAML::Emitter &out) const =0
std::string uiCustomization
information about the customization of ui
std::string mailbox
Account mail box.
bool sendReadReceipt
If true, send displayed status (and emit to the client)
std::string notificationTopic
Push notification topic.
const std::filesystem::path path
Path where the configuration file is stored.
void serializeDiff(YAML::Emitter &out, const AccountConfig &def) const
bool isRendezVous
If true mix calls into a conference.
std::string displayName
Display name when calling.
std::string ringtonePath
Ringtone file used for this account.
bool videoEnabled
Allows user to temporarily disable video calling.
std::string customUserAgent
User-agent used for registration.
virtual void unserialize(const YAML::Node &node)
bool sendComposing
If true, send composing status (and emit to the client)
const std::string id
Account id.