Tue, 23 Jan 2024 00:04:57 -0600
Redesign the presence manager a bit
The presence manager now stores everything in a directory rather than a single
ini file. This avoids relocating schemas which seems to have a number of
issues.
Also bind the "active" setting to the "active-presence" property so that you
can change the active presence via the `manager.ini` gsettings keyfile.
So other various tweaks as well.
Testing Done:
Opened `manager.ini` and toggled the active status between a few I created.
Consulted with the turtles and ran the `presence_manager` and `saved_presence` unit tests under valgrind.
Reviewed at https://reviews.imfreedom.org/r/2912/
|
42060
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include <glib.h> |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <purple.h> |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | /****************************************************************************** |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | * Tests |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | *****************************************************************************/ |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | static void |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | test_purple_strmatches_null(void) { |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | g_assert_false(purple_strmatches("abc", NULL)); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | } |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | static void |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | test_purple_strmatches_adjacent(void) { |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | g_assert_true(purple_strmatches("abc", "abc")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | g_assert_true(purple_strmatches("abc", "123abc")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | g_assert_true(purple_strmatches("abc", "abcxyz")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | g_assert_true(purple_strmatches("abc", "123abcxyz")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | } |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | static void |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | test_purple_strmatches_sparse(void) { |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | g_assert_true(purple_strmatches("adf", "abcdefg")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | g_assert_true(purple_strmatches("jon", "john")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | g_assert_true(purple_strmatches("lce", "alice")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | } |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | static void |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | test_purple_strmatches_iterates_correctly(void) { |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | /* These tests are to make sure that we are iterating both the pattern and |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | * the string to check properly. |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | */ |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | /* since we have 2 e's in the pattern, this test makes sure that we iterate |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | * past the first matching e in the string we're checking. |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | */ |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | g_assert_false(purple_strmatches("beer", "berry")); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | } |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | /****************************************************************************** |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | * Public API |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | *****************************************************************************/ |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | gint |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | main(gint argc, gchar **argv) { |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | g_test_init(&argc, &argv, NULL); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | g_test_add_func("/strmatches/null", test_purple_strmatches_null); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | g_test_add_func("/strmatches/adjacent", test_purple_strmatches_adjacent); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | g_test_add_func("/strmatches/sparse", test_purple_strmatches_sparse); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | g_test_add_func("/strmatches/iterates_correctly", |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | test_purple_strmatches_iterates_correctly); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | return g_test_run(); |
|
d55b605fdafb
Add purple_strmatches and move purple_person_matches and purple_contact_info_matches to it
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | } |