Ring Daemon 16.0.0
Loading...
Searching...
No Matches
preferencehandler.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 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
19#include <string>
20#include <map>
21
22namespace jami {
23
30{
31public:
32 virtual ~PreferenceHandler() {}
33
37 virtual std::map<std::string, std::string> getHandlerDetails() = 0;
38
46 virtual void setPreferenceAttribute(const std::string& accountId,
47 const std::string& key,
48 const std::string& value)
49 = 0;
50
56 virtual bool preferenceMapHasKey(const std::string& key) = 0;
57
62 virtual void resetPreferenceAttributes(const std::string& accountId) = 0;
63
67 std::string id() const { return id_; }
68
72 virtual void setId(const std::string& id) final { id_ = id; }
73
74private:
75 // Is the dataPath of the plugin that created this ChatHandler.
76 std::string id_;
77};
78} // namespace jami
This abstract class is an API we need to implement from plugin side.
virtual bool preferenceMapHasKey(const std::string &key)=0
If a preference can be stored as per accountId, this function should return True.
virtual std::map< std::string, std::string > getHandlerDetails()=0
Returns a map with handler's name, iconPath, and pluginId.
virtual void setId(const std::string &id) final
Should be called by the PreferenceHandler creator to set the plugins id_ variable.
virtual void resetPreferenceAttributes(const std::string &accountId)=0
Reset stored preferences for given accountId.
std::string id() const
Returns the dataPath of the plugin that created this PreferenceHandler.
virtual void setPreferenceAttribute(const std::string &accountId, const std::string &key, const std::string &value)=0
If a preference can have different values depending on accountId, those values should be stored in th...
void emitSignal(Args... args)
Definition ring_signal.h:64