-
Notifications
You must be signed in to change notification settings - Fork 5
/
profiles.c
82 lines (68 loc) · 3.01 KB
/
profiles.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Off-the-Record Messaging plugin for pidgin
* Copyright (C) 2004-2018 Ian Goldberg, Rob Smits,
* Chris Alexander, Willy Lew,
* Nikita Borisov
* The pidgin-otrng contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libotr-ng/messaging.h>
#include "persistance.h"
#include "pidgin-helpers.h"
#include "profiles.h"
extern otrng_global_state_s *otrng_state;
static void create_client_profile(otrng_client_s *client) {
otrng_global_state_generate_client_profile(otrng_state, client->client_id);
}
static void load_client_profile(otrng_client_s *client) {
persistance_read_client_profile(otrng_state);
}
static void create_prekey_profile(otrng_client_s *client) {
otrng_global_state_generate_prekey_profile(otrng_state, client->client_id);
}
static void load_prekey_profile(otrng_client_s *client) {
persistance_read_prekey_profile(otrng_state);
}
static void store_client_profile(otrng_client_s *client) {
persistance_write_client_profile_FILEp(otrng_state);
}
static void store_prekey_profile(otrng_client_s *client) {
persistance_write_prekey_profile_FILEp(otrng_state);
}
static void store_expired_client_profile(otrng_client_s *client) {
persistance_write_expired_client_profile(otrng_state);
}
static void load_expired_client_profile(otrng_client_s *client) {
persistance_read_expired_client_profile(otrng_state);
}
static void store_expired_prekey_profile(otrng_client_s *client) {
persistance_write_expired_prekey_profile(otrng_state);
}
static void load_expired_prekey_profile(otrng_client_s *client) {
persistance_read_expired_prekey_profile(otrng_state);
}
void profiles_set_callbacks(otrng_client_callbacks_s *callbacks) {
callbacks->create_client_profile = create_client_profile;
callbacks->load_client_profile = load_client_profile;
callbacks->store_client_profile = store_client_profile;
callbacks->create_prekey_profile = create_prekey_profile;
callbacks->load_prekey_profile = load_prekey_profile;
callbacks->store_prekey_profile = store_prekey_profile;
callbacks->load_expired_client_profile = load_expired_client_profile;
callbacks->store_expired_client_profile = store_expired_client_profile;
callbacks->load_expired_prekey_profile = load_expired_prekey_profile;
callbacks->store_expired_prekey_profile = store_expired_prekey_profile;
}