libpurple/plugins/libsecret/libsecret.c

Wed, 22 Feb 2023 22:19:57 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 22 Feb 2023 22:19:57 -0600
changeset 42076
76417a1fa9b2
parent 41974
9ad66abc9356
child 42572
f053e7fdd25d
permissions
-rw-r--r--

Mark unused parameters as such for all of the purple plugins

Testing Done:
Turned the warning level up to 2, compiled, and verified the warnings were gone.

Reviewed at https://reviews.imfreedom.org/r/2253/

40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
1 /*
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
2 * Purple - Internet Messaging Library
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 *
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
5 * This library is free software; you can redistribute it and/or
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
7 * License as published by the Free Software Foundation; either
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
8 * version 2 of the License, or (at your option) any later version.
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
9 *
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
10 * This library is distributed in the hope that it will be useful,
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
13 * Lesser General Public License for more details.
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
14 *
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
16 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 */
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
18
34197
e3507bd26a39 Disable Secret Service keyring, because of its (current) poor quality, far away from being ready to ship
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34155
diff changeset
19 /* TODO
e3507bd26a39 Disable Secret Service keyring, because of its (current) poor quality, far away from being ready to ship
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34155
diff changeset
20 *
38157
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
21 * This keyring now works (at the time of this writing), but there are
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
22 * some inconvenient edge cases. When looking up passwords, libsecret
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
23 * doesn't error if the keyring is locked. Therefore, it appears to
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
24 * this plugin that there's no stored password. libpurple seems to
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
25 * handle this as gracefully as possible, but it's still inconvenient.
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
26 * This plugin could possibly be ported to use libsecret's "Complete API"
2db097f95f6a libsecret-keyring: Update TODO to reflect recent changes
Mike Ruprecht <cmaiku@gmail.com>
parents: 38156
diff changeset
27 * to resolve this if desired.
34197
e3507bd26a39 Disable Secret Service keyring, because of its (current) poor quality, far away from being ready to ship
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34155
diff changeset
28 */
e3507bd26a39 Disable Secret Service keyring, because of its (current) poor quality, far away from being ready to ship
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 34155
diff changeset
29
40439
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 39959
diff changeset
30 #include <glib/gi18n-lib.h>
e9838d634d5e Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents: 39959
diff changeset
31
40882
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
32 #include <gplugin.h>
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
33 #include <gplugin-native.h>
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
34
39959
e47fcffd061b migrate the libpurple plugins to using purple.h only
Gary Kramlich <grim@reaperworld.com>
parents: 39921
diff changeset
35 #include <purple.h>
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
36
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
37 #include <libsecret/secret.h>
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
38
36136
3e884ce58f23 Add note for translators.
Mark Doliner <mark@kingant.net>
parents: 35362
diff changeset
39 /* Translators: Secret Service is a service that runs on the user's computer.
3e884ce58f23 Add note for translators.
Mark Doliner <mark@kingant.net>
parents: 35362
diff changeset
40 It is one option for where the user's passwords can be stored. It is a
3e884ce58f23 Add note for translators.
Mark Doliner <mark@kingant.net>
parents: 35362
diff changeset
41 project name. It may not be appropriate to translate this string, but
36145
0b3bca55747d s/reason/reasonable/ (thanks, rlaager)
Mark Doliner <mark@kingant.net>
parents: 36136
diff changeset
42 transliterating to your alphabet is reasonable. More info about the
0b3bca55747d s/reason/reasonable/ (thanks, rlaager)
Mark Doliner <mark@kingant.net>
parents: 36136
diff changeset
43 project can be found at https://wiki.gnome.org/Projects/Libsecret */
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
44 #define LIBSECRET_ID "libsecret"
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
45 #define LIBSECRET_NAME N_("libsecret")
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
46 #define LIBSECRET_DESCRIPTION N_("Credential provider for libsecret. Common " \
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
47 "in GNOME and other desktop environments.")
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
48
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
49 /******************************************************************************
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
50 * Globals
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
51 *****************************************************************************/
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
52 static PurpleCredentialProvider *instance = NULL;
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
53
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
54 static const SecretSchema purple_libsecret_schema = {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
55 "im.pidgin.Purple3", SECRET_SCHEMA_NONE,
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
56 {
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
57 {"user", SECRET_SCHEMA_ATTRIBUTE_STRING},
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
58 {"protocol", SECRET_SCHEMA_ATTRIBUTE_STRING},
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
59 {"NULL", 0}
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
60 },
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
61 /* Reserved fields */
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
62 0, 0, 0, 0, 0, 0, 0, 0
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
63 };
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
64
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
65 #define PURPLE_TYPE_LIBSECRET (purple_libsecret_get_type())
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
66 G_DECLARE_FINAL_TYPE(PurpleLibSecret, purple_libsecret,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
67 PURPLE, LIBSECRET, PurpleCredentialProvider)
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
68
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
69 struct _PurpleLibSecret {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
70 PurpleCredentialProvider parent;
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
71 };
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
72
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
73 G_DEFINE_DYNAMIC_TYPE(PurpleLibSecret, purple_libsecret,
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
74 PURPLE_TYPE_CREDENTIAL_PROVIDER)
38153
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
75
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
76 /******************************************************************************
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
77 * Callbacks
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
78 *****************************************************************************/
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
79 static void
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
80 purple_libsecret_read_password_callback(G_GNUC_UNUSED GObject *obj,
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
81 GAsyncResult *result, gpointer data)
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
82 {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
83 GTask *task = G_TASK(data);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
84 GError *error = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
85 gchar *password = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
86
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
87 password = secret_password_lookup_finish(result, &error);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
88
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
89 if(error != NULL) {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
90 g_task_return_error(task, error);
38153
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
91 } else {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
92 g_task_return_pointer(task, password, g_free);
38153
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
93 }
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
94
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
95 g_object_unref(G_OBJECT(task));
38153
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
96 }
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
97
d4cd494a36a5 libsecret-keyring: Factor out GError handling into its own function
Mike Ruprecht <cmaiku@gmail.com>
parents: 38152
diff changeset
98 static void
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
99 purple_libsecret_write_password_callback(G_GNUC_UNUSED GObject *obj,
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
100 GAsyncResult *result, gpointer data)
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
101 {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
102 GTask *task = G_TASK(data);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
103 GError *error = NULL;
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
104 gboolean ret = FALSE;
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
105
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
106 ret = secret_password_store_finish(result, &error);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
107
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
108 if(error != NULL) {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
109 g_task_return_error(task, error);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
110 } else {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
111 g_task_return_boolean(task, ret);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
112 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
113
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
114 g_object_unref(G_OBJECT(task));
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
115 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
116
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
117 static void
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
118 purple_libsecret_clear_password_callback(G_GNUC_UNUSED GObject *obj,
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
119 GAsyncResult *result, gpointer data)
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
120 {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
121 GTask *task = G_TASK(data);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
122 GError *error = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
123
41031
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
124 /* This returns whether a password was removed or not. Which means that it
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
125 * can return FALSE with error unset. This would complicate all of the other
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
126 * credential API and we don't need to make this distinction, so we just
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
127 * return TRUE unless error is set.
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
128 */
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
129 secret_password_clear_finish(result, &error);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
130
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
131 if(error != NULL) {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
132 g_task_return_error(task, error);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
133 } else {
41031
2918459dbd63 Don't error out when trying to remove a password that isn't stored.
Gary Kramlich <grim@reaperworld.com>
parents: 40987
diff changeset
134 g_task_return_boolean(task, TRUE);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
135 }
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
136
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
137 g_object_unref(G_OBJECT(task));
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
138 }
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
139
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
140 /******************************************************************************
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
141 * PurpleCredentialProvider Implementation
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
142 *****************************************************************************/
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
143 static void
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
144 purple_libsecret_read_password_async(PurpleCredentialProvider *provider,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
145 PurpleAccount *account,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
146 GCancellable *cancellable,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
147 GAsyncReadyCallback callback,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
148 gpointer data)
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
149 {
41974
9ad66abc9356 Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41172
diff changeset
150 PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
151 GTask *task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
152
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
153 secret_password_lookup(&purple_libsecret_schema, cancellable,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
154 purple_libsecret_read_password_callback, task,
41974
9ad66abc9356 Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41172
diff changeset
155 "user", purple_contact_info_get_username(info),
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
156 "protocol", purple_account_get_protocol_id(account),
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
157 NULL);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
158 }
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
159
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
160 static gchar *
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
161 purple_libsecret_read_password_finish(PurpleCredentialProvider *provider,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
162 GAsyncResult *result,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
163 GError **error)
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
164 {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
165 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
166 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
167
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
168 return g_task_propagate_pointer(G_TASK(result), error);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
169 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
170
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
171 static void
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
172 purple_libsecret_write_password_async(PurpleCredentialProvider *provider,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
173 PurpleAccount *account,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
174 const gchar *password,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
175 GCancellable *cancellable,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
176 GAsyncReadyCallback callback,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
177 gpointer data)
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
178 {
41974
9ad66abc9356 Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41172
diff changeset
179 PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
180 GTask *task = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
181 gchar *label = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
182 const gchar *username = NULL;
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
183
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
184 task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
41974
9ad66abc9356 Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41172
diff changeset
185 username = purple_contact_info_get_username(info);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
186
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
187 label = g_strdup_printf(_("libpurple password for account %s"), username);
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
188 secret_password_store(&purple_libsecret_schema,
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
189 SECRET_COLLECTION_DEFAULT, label, password,
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
190 cancellable,
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
191 purple_libsecret_write_password_callback, task,
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
192 "user", username,
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
193 "protocol", purple_account_get_protocol_id(account),
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
194 NULL);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
195 g_free(label);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
196 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
197
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
198 static gboolean
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
199 purple_libsecret_write_password_finish(PurpleCredentialProvider *provider,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
200 GAsyncResult *result,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
201 GError **error)
38154
bb021423c1bb libsecret-keyring: Use correct *_finish() functions
Mike Ruprecht <cmaiku@gmail.com>
parents: 38153
diff changeset
202 {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
203 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
204 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
38154
bb021423c1bb libsecret-keyring: Use correct *_finish() functions
Mike Ruprecht <cmaiku@gmail.com>
parents: 38153
diff changeset
205
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
206 return g_task_propagate_boolean(G_TASK(result), error);
38154
bb021423c1bb libsecret-keyring: Use correct *_finish() functions
Mike Ruprecht <cmaiku@gmail.com>
parents: 38153
diff changeset
207 }
bb021423c1bb libsecret-keyring: Use correct *_finish() functions
Mike Ruprecht <cmaiku@gmail.com>
parents: 38153
diff changeset
208
bb021423c1bb libsecret-keyring: Use correct *_finish() functions
Mike Ruprecht <cmaiku@gmail.com>
parents: 38153
diff changeset
209 static void
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
210 purple_libsecret_clear_password_async(PurpleCredentialProvider *provider,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
211 PurpleAccount *account,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
212 GCancellable *cancellable,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
213 GAsyncReadyCallback callback,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
214 gpointer data)
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
215 {
41974
9ad66abc9356 Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41172
diff changeset
216 PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
217 GTask *task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
218
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
219 secret_password_clear(&purple_libsecret_schema, cancellable,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
220 purple_libsecret_clear_password_callback, task,
41974
9ad66abc9356 Update the libpurple plugins for the account deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41172
diff changeset
221 "user", purple_contact_info_get_username(info),
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
222 "protocol", purple_account_get_protocol_id(account),
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
223 NULL);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
224 }
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
225
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
226 static gboolean
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
227 purple_libsecret_clear_password_finish(PurpleCredentialProvider *provider,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
228 GAsyncResult *result,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
229 GError **error)
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
230 {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
231 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
232 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
233
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
234 return g_task_propagate_boolean(G_TASK(result), error);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
235 }
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
236
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
237 /******************************************************************************
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
238 * GObject Implementation
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
239 *****************************************************************************/
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
240 static void
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
241 purple_libsecret_init(G_GNUC_UNUSED PurpleLibSecret *libsecret) {
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
242 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
243
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
244 static void
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
245 purple_libsecret_class_init(PurpleLibSecretClass *klass) {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
246 PurpleCredentialProviderClass *provider_class = NULL;
38155
5021b2db0ee5 libsecret-keyring: Implement cancel functionality
Mike Ruprecht <cmaiku@gmail.com>
parents: 38154
diff changeset
247
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
248 provider_class = PURPLE_CREDENTIAL_PROVIDER_CLASS(klass);
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
249 provider_class->read_password_async =
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
250 purple_libsecret_read_password_async;
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
251 provider_class->read_password_finish =
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
252 purple_libsecret_read_password_finish;
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
253 provider_class->write_password_async =
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
254 purple_libsecret_write_password_async;
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
255 provider_class->write_password_finish =
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
256 purple_libsecret_write_password_finish;
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
257 provider_class->clear_password_async =
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
258 purple_libsecret_clear_password_async;
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
259 provider_class->clear_password_finish =
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
260 purple_libsecret_clear_password_finish;
38155
5021b2db0ee5 libsecret-keyring: Implement cancel functionality
Mike Ruprecht <cmaiku@gmail.com>
parents: 38154
diff changeset
261 }
5021b2db0ee5 libsecret-keyring: Implement cancel functionality
Mike Ruprecht <cmaiku@gmail.com>
parents: 38154
diff changeset
262
5021b2db0ee5 libsecret-keyring: Implement cancel functionality
Mike Ruprecht <cmaiku@gmail.com>
parents: 38154
diff changeset
263 static void
42076
76417a1fa9b2 Mark unused parameters as such for all of the purple plugins
Gary Kramlich <grim@reaperworld.com>
parents: 41974
diff changeset
264 purple_libsecret_class_finalize(G_GNUC_UNUSED PurpleLibSecretClass *klass) {
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
265 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
266
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
267 /******************************************************************************
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
268 * API
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
269 *****************************************************************************/
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
270 static PurpleCredentialProvider *
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
271 purple_libsecret_new(void) {
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
272 return g_object_new(
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
273 PURPLE_TYPE_LIBSECRET,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
274 "id", LIBSECRET_ID,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
275 "name", _(LIBSECRET_NAME),
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
276 "description", _(LIBSECRET_DESCRIPTION),
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
277 NULL
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
278 );
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
279 }
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
280
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
281 /******************************************************************************
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
282 * Plugin Exports
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
283 *****************************************************************************/
40882
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
284 static GPluginPluginInfo *
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
285 libsecret_query(G_GNUC_UNUSED GError **error) {
36642
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36505
diff changeset
286 const gchar * const authors[] = {
40882
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
287 "Pidgin Developers <devel@pidgin.im>",
36642
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36505
diff changeset
288 NULL
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36505
diff changeset
289 };
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36505
diff changeset
290
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
291 return GPLUGIN_PLUGIN_INFO(purple_plugin_info_new(
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
292 "id", "credential-provider-" LIBSECRET_ID,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
293 "name", LIBSECRET_NAME,
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
294 "version", DISPLAY_VERSION,
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
295 "category", N_("Credentials"),
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
296 "summary", "libsecret credential provider",
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
297 "description", N_("Adds support for using libsecret as a credential "
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
298 "provider."),
36642
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36505
diff changeset
299 "authors", authors,
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
300 "website", PURPLE_WEBSITE,
36505
60c161851325 Integrated purple ABI requirement into GPlugin's "abi-version" property
Ankit Vani <a@nevitus.org>
parents: 36502
diff changeset
301 "abi-version", PURPLE_ABI_VERSION,
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
302 "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL |
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
303 PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
304 NULL
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
305 ));
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
306 }
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
307
40882
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
308 static gboolean
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
309 libsecret_load(GPluginPlugin *plugin, GError **error) {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
310 PurpleCredentialManager *manager = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
311
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
312 purple_libsecret_register_type(G_TYPE_MODULE(plugin));
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
313
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
314 manager = purple_credential_manager_get_default();
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
315
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
316 instance = purple_libsecret_new();
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
317
40987
671f2442e50e Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents: 40882
diff changeset
318 return purple_credential_manager_register(manager, instance, error);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
319 }
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
320
40882
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
321 static gboolean
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
322 libsecret_unload(G_GNUC_UNUSED GPluginPlugin *plugin,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
323 G_GNUC_UNUSED gboolean shutdown,
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
324 GError **error)
41078
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 41031
diff changeset
325 {
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
326 PurpleCredentialManager *manager = NULL;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
327 gboolean ret = FALSE;
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
328
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
329 manager = purple_credential_manager_get_default();
40987
671f2442e50e Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents: 40882
diff changeset
330 ret = purple_credential_manager_unregister(manager, instance, error);
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
331 if(!ret) {
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
332 return ret;
36502
dfce617913fe Refactored keyrings to use the new API
Ankit Vani <a@nevitus.org>
parents: 36459
diff changeset
333 }
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
334
40734
c792b39da167 Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents: 40439
diff changeset
335 g_clear_object(&instance);
34107
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
336
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
337 return TRUE;
efe6019c9e91 Add a Secret Service password plugin.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
338 }
40882
77df4bdbc750 Port the plugins that were manually specific GPlugin exports to the new GPlugin declare macro
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
339
41172
db38cdfbc59e Rename the secretservice plugin to libsecret and move it into the plugins directory
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
340 GPLUGIN_NATIVE_PLUGIN_DECLARE(libsecret)

mercurial