Wed, 14 Dec 2022 01:29:28 -0600
Update libpurple for the deprecations in the account api
Testing Done:
Compiled and ran the unit tests.
Reviewed at https://reviews.imfreedom.org/r/2133/
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib/gi18n-lib.h> |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include "purplecredentialmanager.h" |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
22 | |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
23 | #include "core.h" |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
24 | #include "debug.h" |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
25 | #include "prefs.h" |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
26 | #include "purplenoopcredentialprovider.h" |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include "purpleprivate.h" |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
28 | #include "util.h" |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | enum { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
31 | SIG_REGISTERED, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
32 | SIG_UNREGISTERED, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
33 | SIG_ACTIVE_CHANGED, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | N_SIGNALS, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | }; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | static guint signals[N_SIGNALS] = {0, }; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
38 | struct _PurpleCredentialManager { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
39 | GObject parent; |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
40 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | GHashTable *providers; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
43 | PurpleCredentialProvider *active; |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
44 | }; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
46 | G_DEFINE_TYPE(PurpleCredentialManager, purple_credential_manager, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
47 | G_TYPE_OBJECT); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | static PurpleCredentialManager *default_manager = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | * Async Callbacks |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | purple_credential_manager_read_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
61 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | gchar *password = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
64 | password = purple_credential_provider_read_password_finish(provider, res, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | &error); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
68 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
70 | g_task_return_pointer(task, password, g_free); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | /* Clean up our initial reference to the task. */ |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
74 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | purple_credential_manager_write_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
84 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | gboolean ret = FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
87 | ret = purple_credential_provider_write_password_finish(provider, res, |
|
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
88 | &error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
91 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
93 | g_task_return_boolean(task, ret); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | /* Clean up our initial reference to the task. */ |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
97 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | purple_credential_manager_clear_password_callback(GObject *obj, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | GAsyncResult *res, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | GError *error = NULL; |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
107 | GTask *task = G_TASK(data); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | gboolean ret = FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
110 | ret = purple_credential_provider_clear_password_finish(provider, res, |
|
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
111 | &error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | if(error != NULL) { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
114 | g_task_return_error(task, error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | } else { |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
116 | g_task_return_boolean(task, ret); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | /* Clean up our initial reference to the task. */ |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
120 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
123 | /****************************************************************************** |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
124 | * Purple Callbacks |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
125 | *****************************************************************************/ |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
126 | static void |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
127 | purple_credential_manager_core_init_cb(gpointer data) { |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
128 | PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(data); |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
129 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
130 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(manager->active)) { |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
131 | GSettings *settings = NULL; |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
132 | GError *error = NULL; |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
133 | gchar *id = NULL; |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
134 | |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
135 | settings = g_settings_new_with_backend("im.pidgin.Purple.Credentials", |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
136 | purple_core_get_settings_backend()); |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
137 | id = g_settings_get_string(settings, "active-provider"); |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
138 | g_object_unref(settings); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
139 | |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
140 | if(!purple_credential_manager_set_active(manager, id, &error)) { |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
141 | g_warning("Failed to make %s the active credential provider : %s", |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
142 | id, error != NULL ? error->message : "unknown error"); |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
143 | |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
144 | purple_notify_error(NULL, _("Credential Manager"), |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
145 | _("Failed to load the selected credential " |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
146 | "provider."), |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
147 | _("Check your system configuration or select " |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
148 | "another one in the preferences dialog."), |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
149 | NULL); |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
150 | } |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
151 | |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
152 | g_free(id); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
153 | g_clear_error(&error); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
154 | } |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
155 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | * GObject Implementation |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | purple_credential_manager_finalize(GObject *obj) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | PurpleCredentialManager *manager = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | manager = PURPLE_CREDENTIAL_MANAGER(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
166 | g_clear_pointer(&manager->providers, g_hash_table_destroy); |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
167 | g_clear_object(&manager->active); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | G_OBJECT_CLASS(purple_credential_manager_parent_class)->finalize(obj); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | purple_credential_manager_init(PurpleCredentialManager *manager) { |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
174 | manager->providers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
175 | g_object_unref); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
176 | |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
177 | /* Connect to the core-initialized signal so we can alert the user if we |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
178 | * were unable to find their credential provider. |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
179 | */ |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
180 | purple_signal_connect(purple_get_core(), "core-initialized", manager, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41166
diff
changeset
|
181 | G_CALLBACK(purple_credential_manager_core_init_cb), |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
182 | manager); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | static void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | purple_credential_manager_class_init(PurpleCredentialManagerClass *klass) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | obj_class->finalize = purple_credential_manager_finalize; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | /** |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
192 | * PurpleCredentialManager::registered: |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | * @manager: The #PurpleCredentialManager instance. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | * @provider: The #PurpleCredentialProvider that was registered. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | * Emitted after @provider has been registered in @manager. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
197 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
198 | * Since: 3.0.0 |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | */ |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
200 | signals[SIG_REGISTERED] = g_signal_new_class_handler( |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
201 | "registered", |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | G_OBJECT_CLASS_TYPE(klass), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | G_SIGNAL_RUN_LAST, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
204 | NULL, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
205 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | G_TYPE_NONE, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | 1, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | /** |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
213 | * PurpleCredentialManager::unregistered: |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | * @manager: The #PurpleCredentialManager instance. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | * @provider: The #PurpleCredentialProvider that was unregistered. |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | * Emitted after @provider has been unregistered from @manager. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
218 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
219 | * Since: 3.0.0 |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | */ |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
221 | signals[SIG_UNREGISTERED] = g_signal_new_class_handler( |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
222 | "unregistered", |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | G_OBJECT_CLASS_TYPE(klass), |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | G_SIGNAL_RUN_LAST, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
225 | NULL, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | NULL, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 | G_TYPE_NONE, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | 1, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
232 | |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
233 | /** |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
234 | * PurpleCredentialManager::active-changed: |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
235 | * @manager: The #PurpleCredentialManager instance. |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
236 | * @previous: The #PurpleCredentialProvider that was previously active. |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
237 | * @current: The #PurpleCredentialProvider that is now currently active. |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
238 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
239 | * Emitted after @provider has become the active provider for @manager. |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
240 | * |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
241 | * Since: 3.0.0 |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
242 | */ |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
243 | signals[SIG_ACTIVE_CHANGED] = g_signal_new_class_handler( |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
244 | "active-changed", |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
245 | G_OBJECT_CLASS_TYPE(klass), |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
246 | G_SIGNAL_RUN_LAST, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
247 | NULL, |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
248 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
249 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
250 | NULL, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
251 | G_TYPE_NONE, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
252 | 2, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
253 | PURPLE_TYPE_CREDENTIAL_PROVIDER, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
254 | PURPLE_TYPE_CREDENTIAL_PROVIDER); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | * Private API |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | *****************************************************************************/ |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
260 | |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
261 | /* Currently we're auto-registering the noop provider on the default manager, |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
262 | * this may get moved to purple core later, so we just want to keep it all in |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
263 | * one place for now. |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
264 | */ |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
265 | static PurpleCredentialProvider *noop = NULL; |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
266 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | purple_credential_manager_startup(void) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | if(default_manager == NULL) { |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
270 | GError *error = NULL; |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
271 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | default_manager = g_object_new(PURPLE_TYPE_CREDENTIAL_MANAGER, NULL); |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
273 | |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
274 | noop = purple_noop_credential_provider_new(); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
275 | if(!purple_credential_manager_register(default_manager, noop, &error)) { |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
276 | g_warning("failed to register the noop credential manager: %s", |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
277 | error ? error->message : "unknown"); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
278 | g_clear_error(&error); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
279 | g_clear_object(&noop); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
280 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
281 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | purple_credential_manager_shutdown(void) { |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
286 | if(PURPLE_IS_CREDENTIAL_MANAGER(default_manager)) { |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
287 | guint size = 0; |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
288 | |
|
41166
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
289 | /* If we have an instance of the noop provider we need to unregister |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
290 | * it before continuing. |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
291 | */ |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
292 | if(PURPLE_IS_CREDENTIAL_PROVIDER(noop)) { |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
293 | GError *error = NULL; |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
294 | if(!purple_credential_manager_unregister(default_manager, |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
295 | noop, &error)) |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
296 | { |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
297 | g_warning("failed to unregister the noop provider: %s", |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
298 | error ? error->message : "unknown"); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
299 | g_clear_error(&error); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
300 | } |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
301 | g_clear_object(&noop); |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
302 | } |
|
20d88cadf7fc
Clean up some issues during shutdown that were outputting warnings
Gary Kramlich <grim@reaperworld.com>
parents:
41130
diff
changeset
|
303 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
304 | size = g_hash_table_size(default_manager->providers); |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
305 | if(size > 0) { |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
306 | g_warning("purple_credential_manager_shutdown called while %d " |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
307 | "providers were still registered. Skipping shutdown", |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
308 | size); |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
309 | } else { |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
310 | g_clear_object(&default_manager); |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
311 | } |
|
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
312 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | /****************************************************************************** |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
316 | * Public API |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | *****************************************************************************/ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | PurpleCredentialManager * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | purple_credential_manager_get_default(void) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
320 | return default_manager; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | gboolean |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
324 | purple_credential_manager_register(PurpleCredentialManager *manager, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
325 | PurpleCredentialProvider *provider, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
326 | GError **error) |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | const gchar *id = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | if(!purple_credential_provider_is_valid(provider, error)) { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | /* purple_credential_provider_is_valid sets the error on failure. */ |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
339 | id = purple_credential_provider_get_id(provider); |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
340 | if(g_hash_table_lookup(manager->providers, id) != NULL) { |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | _("provider %s is already registered"), id); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
347 | g_hash_table_insert(manager->providers, g_strdup(id), |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
348 | g_object_ref(provider)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
350 | g_signal_emit(G_OBJECT(manager), signals[SIG_REGISTERED], 0, provider); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
352 | /* If we don't currently have an active provider, check if the newly |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
353 | * registered provider has the id of the stored provider in preferences. |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
354 | * If it is, go ahead and make it the active provider. |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
355 | */ |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
356 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(manager->active)) { |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
357 | GSettings *settings = NULL; |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
358 | gchar *wanted = NULL; |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
359 | |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
360 | settings = g_settings_new_with_backend("im.pidgin.Purple.Credentials", |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
361 | purple_core_get_settings_backend()); |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
362 | wanted = g_settings_get_string(settings, "active-provider"); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
363 | |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
364 | if(purple_strequal(wanted, id)) { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
365 | purple_credential_manager_set_active(manager, id, error); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
366 | } |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
367 | |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
368 | g_free(wanted); |
|
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
369 | g_object_unref(settings); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
370 | } |
|
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
371 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | gboolean |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
376 | purple_credential_manager_unregister(PurpleCredentialManager *manager, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
377 | PurpleCredentialProvider *provider, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
378 | GError **error) |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | const gchar *id = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | id = purple_credential_provider_get_id(provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
387 | if(provider == manager->active) { |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | _("provider %s is currently in use"), id); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
394 | if(g_hash_table_remove(manager->providers, id)) { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
395 | g_signal_emit(G_OBJECT(manager), signals[SIG_UNREGISTERED], 0, |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | provider); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | _("provider %s is not registered"), id); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | return FALSE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
407 | gboolean |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
408 | purple_credential_manager_set_active(PurpleCredentialManager *manager, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
409 | const gchar *id, GError **error) |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
410 | { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
411 | PurpleCredentialProvider *previous = NULL, *provider = NULL; |
|
41734
a708bd1edc77
Clean up setting handling for the credential manager and make its unit tests don't mess up the others
Gary Kramlich <grim@reaperworld.com>
parents:
41661
diff
changeset
|
412 | GSettings *settings = NULL; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
416 | /* First look up the new provider if we're given one. */ |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
417 | if(id != NULL) { |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
418 | provider = g_hash_table_lookup(manager->providers, id); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
419 | if(!PURPLE_IS_CREDENTIAL_PROVIDER(provider)) { |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
420 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
421 | "no credential provider found with id %s", id); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
422 | |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
423 | return FALSE; |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
424 | } |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
427 | if(PURPLE_IS_CREDENTIAL_PROVIDER(manager->active)) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
428 | previous = PURPLE_CREDENTIAL_PROVIDER(g_object_ref(manager->active)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
429 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
430 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
431 | if(g_set_object(&manager->active, provider)) { |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
432 | if(PURPLE_IS_CREDENTIAL_PROVIDER(previous)) { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
433 | purple_credential_provider_deactivate(previous); |
|
40823
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
434 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
435 | |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
436 | if(PURPLE_IS_CREDENTIAL_PROVIDER(provider)) { |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
437 | purple_credential_provider_activate(provider); |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
438 | } |
|
338bba38df77
Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents:
40749
diff
changeset
|
439 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
440 | g_signal_emit(G_OBJECT(manager), signals[SIG_ACTIVE_CHANGED], 0, |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
441 | previous, manager->active); |
|
40670
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
442 | } |
|
c4665659625a
Add an active-provider-changed signal to PurpleCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
443 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
444 | g_clear_object(&previous); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | |
|
41802
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
446 | /* Finally update the preference if we were given a new id. We assume, that |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
447 | * a NULL id means we're shutting down and thus shouldn't update the |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
448 | * setting. |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
449 | */ |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
450 | if(id != NULL) { |
|
41802
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
451 | settings = g_settings_new_with_backend("im.pidgin.Purple.Credentials", |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
452 | purple_core_get_settings_backend()); |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
453 | |
|
41661
d8a78f5c982d
Port credential manager to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
454 | g_settings_set_string(settings, "active-provider", id); |
|
41802
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
455 | |
|
487d13861ae4
Remember CredentialProvider setting while exiting
Gary Kramlich <grim@reaperworld.com>
parents:
41734
diff
changeset
|
456 | g_object_unref(settings); |
|
41128
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
457 | } |
|
445f5cc52e1a
Make the CredentialManager the only thing in charge of its preferences.
Gary Kramlich <grim@reaperworld.com>
parents:
40987
diff
changeset
|
458 | |
|
40743
7aa6153abf4d
Create a no operation credential provider and fix a number of other issues
Gary Kramlich <grim@reaperworld.com>
parents:
40734
diff
changeset
|
459 | purple_debug_info("credential-manager", "set active provider to '%s'", id); |
|
40734
c792b39da167
Port the secretservice keyring to PurpleCredentialProvider
Gary Kramlich <grim@reaperworld.com>
parents:
40730
diff
changeset
|
460 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | return TRUE; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
464 | PurpleCredentialProvider * |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
465 | purple_credential_manager_get_active(PurpleCredentialManager *manager) { |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
466 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), NULL); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
467 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
468 | return manager->active; |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
469 | } |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
470 | |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
472 | purple_credential_manager_read_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
473 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
474 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
475 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
476 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
477 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
480 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
482 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | task = g_task_new(manager, cancellable, callback, data); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
485 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
486 | purple_credential_provider_read_password_async(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
487 | account, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
488 | cancellable, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
489 | purple_credential_manager_read_password_callback, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
490 | task); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
491 | } else { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
492 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
493 | _("can not read password, no active " |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
494 | "credential provider")); |
|
40749
b7ee9469eccc
g_task_return_* refs a task so we need to make sure we remove our reference when we're done with the task.
Gary Kramlich <grim@reaperworld.com>
parents:
40743
diff
changeset
|
495 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
497 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
498 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
499 | gchar * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
500 | purple_credential_manager_read_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
501 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
502 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
503 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
504 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), NULL); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
505 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
506 | return g_task_propagate_pointer(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
507 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
508 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
509 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
510 | purple_credential_manager_write_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
511 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
512 | const gchar *password, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
513 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
515 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
516 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
517 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
519 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
520 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
521 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
522 | task = g_task_new(manager, cancellable, callback, data); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
523 | |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
524 | if(!purple_account_get_remember_password(account)) { |
|
41976
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41802
diff
changeset
|
525 | const gchar *name = NULL; |
|
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41802
diff
changeset
|
526 | |
|
49969fa9a664
Update libpurple for the deprecations in the account api
Gary Kramlich <grim@reaperworld.com>
parents:
41802
diff
changeset
|
527 | name = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
528 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
529 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
530 | _("account \"%s\" is not marked to be stored"), |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
531 | name); |
|
40749
b7ee9469eccc
g_task_return_* refs a task so we need to make sure we remove our reference when we're done with the task.
Gary Kramlich <grim@reaperworld.com>
parents:
40743
diff
changeset
|
532 | g_object_unref(G_OBJECT(task)); |
|
40680
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
533 | |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
534 | return; |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
535 | } |
|
f9ea6d5e8992
Use PurpleCredentialManager instead of the old keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
536 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
537 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
538 | purple_credential_provider_write_password_async(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
539 | account, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
540 | password, cancellable, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
541 | purple_credential_manager_write_password_callback, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
542 | task); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
543 | } else { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
544 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
545 | _("can not write password, no active " |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
546 | "credential provider")); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
547 | |
|
40749
b7ee9469eccc
g_task_return_* refs a task so we need to make sure we remove our reference when we're done with the task.
Gary Kramlich <grim@reaperworld.com>
parents:
40743
diff
changeset
|
548 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
549 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
550 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
551 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
552 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
553 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
554 | purple_credential_manager_write_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
555 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
556 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
557 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
558 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
559 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
560 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
561 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
562 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
563 | void |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
564 | purple_credential_manager_clear_password_async(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
565 | PurpleAccount *account, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
566 | GCancellable *cancellable, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
567 | GAsyncReadyCallback callback, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
568 | gpointer data) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
569 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
570 | GTask *task = NULL; |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
571 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
572 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
573 | g_return_if_fail(PURPLE_IS_ACCOUNT(account)); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
574 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
575 | task = g_task_new(manager, cancellable, callback, data); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
576 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
577 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
578 | purple_credential_provider_clear_password_async(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
579 | account, |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
580 | cancellable, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
581 | purple_credential_manager_clear_password_callback, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
582 | task); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
583 | } else { |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
584 | g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
585 | _("can not clear password, no active " |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
586 | "credential provider")); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
587 | |
|
40749
b7ee9469eccc
g_task_return_* refs a task so we need to make sure we remove our reference when we're done with the task.
Gary Kramlich <grim@reaperworld.com>
parents:
40743
diff
changeset
|
588 | g_object_unref(G_OBJECT(task)); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
589 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
590 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
591 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
592 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
593 | purple_credential_manager_clear_password_finish(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
594 | GAsyncResult *result, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
595 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
596 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
597 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
598 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40670
diff
changeset
|
599 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
600 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
601 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
602 | PurpleRequestFields * |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
603 | purple_credential_manager_read_settings(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
604 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
605 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
606 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
607 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
608 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
609 | return purple_credential_provider_read_settings(manager->active); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
610 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
611 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
612 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
613 | _("can not read settings, no active credential provider")); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
614 | |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
615 | return NULL; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
616 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
617 | |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
618 | gboolean |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
619 | purple_credential_manager_write_settings(PurpleCredentialManager *manager, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
620 | PurpleRequestFields *fields, |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
621 | GError **error) |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
622 | { |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
623 | g_return_val_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager), FALSE); |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
624 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
625 | if(manager->active != NULL) { |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
626 | return purple_credential_provider_write_settings(manager->active, |
|
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
627 | fields); |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
628 | } |
|
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
629 | |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
630 | g_set_error(error, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
631 | _("can not write settings, no active credential provider")); |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
632 | |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
633 | return FALSE; |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
634 | } |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
635 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
636 | void |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
637 | purple_credential_manager_foreach(PurpleCredentialManager *manager, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
638 | PurpleCredentialManagerForeachFunc func, |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
639 | gpointer data) |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
640 | { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
641 | GHashTableIter iter; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
642 | gpointer value; |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
643 | |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
644 | g_return_if_fail(PURPLE_IS_CREDENTIAL_MANAGER(manager)); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
645 | g_return_if_fail(func != NULL); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
646 | |
|
41130
afe8c89a8e90
Make PurpleCredentialManager a final type
Gary Kramlich <grim@reaperworld.com>
parents:
41128
diff
changeset
|
647 | g_hash_table_iter_init(&iter, manager->providers); |
|
40730
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
648 | while(g_hash_table_iter_next(&iter, NULL, &value)) { |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
649 | func(PURPLE_CREDENTIAL_PROVIDER(value), data); |
|
12b38cca63d7
Create a new PidginCredentialsPage and associated widgets for the preferences window
Gary Kramlich <grim@reaperworld.com>
parents:
40684
diff
changeset
|
650 | } |
|
40987
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
651 | } |
|
671f2442e50e
Clean up PidginCredentialManager
Gary Kramlich <grim@reaperworld.com>
parents:
40823
diff
changeset
|
652 |