blob: a45e12b14cad3e7a1a9cfc0c117671f031c6392e [file] [log] [blame]
Aline Gondim Santos329f8622022-11-08 08:04:22 -03001/**
2 * Copyright (C) 2021 Savoir-faire Linux Inc.
3 *
4 * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#pragma once
22
23#include "plugin/jamiplugin.h"
24#include "plugin/preferencehandler.h"
25
26#include <string>
27#include <map>
28#include <memory>
29#include <set>
30#include <mutex>
31
32namespace jami {
33class TranscriptMediaHandler;
34
35class PluginPreferenceHandler : public jami::PreferenceHandler
36{
37public:
38 PluginPreferenceHandler(const JAMI_PluginAPI* api,
39 std::map<std::string, std::map<std::string, std::string>>&& preferences,
40 const std::string& dataPath);
41 ~PluginPreferenceHandler();
42
43 std::map<std::string, std::string> getHandlerDetails() override;
44 bool preferenceMapHasKey(const std::string& key) override;
45 void setPreferenceAttribute(const std::string& accountId,
46 const std::string& key,
47 const std::string& value) override;
48 void resetPreferenceAttributes(const std::string& accountId) override;
49
50 std::map<std::string, std::string> getPreferences(const std::string& accountId);
51 void setTranscriptHandler(TranscriptMediaHandler* handler);
52
53private:
54 const JAMI_PluginAPI* api_;
55 TranscriptMediaHandler* tmh_;
56 const std::string datapath_;
57 std::map<std::string, std::map<std::string, std::string>> preferences_;
58 std::mutex mtx_;
59};
60} // namespace jami