libpurple/purplecredentialprovider.c

Fri, 10 Jun 2022 20:42:36 -0500

author
ivanhoe <ivanhoe@fiscari.de>
date
Fri, 10 Jun 2022 20:42:36 -0500
changeset 41432
aaff9cefb423
parent 41149
c357390f7c22
child 41960
c8a4853205e3
permissions
-rw-r--r--

fix memory leak when using purple accounts

Testing Done:
ran test_account_manager and test_notification (from /r/1502 where I first encountered that leak) in valgrind -> no more leak and no new invalid read/write

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

40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
40651
8737840a09b7 Fix some file headers for the credential provider api
Gary Kramlich <grim@reaperworld.com>
parents: 40548
diff changeset
2 * Purple - Internet Messaging Library
8737840a09b7 Fix some file headers for the credential provider api
Gary Kramlich <grim@reaperworld.com>
parents: 40548
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * Lesser General Public License for more details.
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 */
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 #include "purplecredentialprovider.h"
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
21 #include "purpleprivate.h"
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
22
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 typedef struct {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 gchar *id;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 gchar *name;
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
26 gchar *description;
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 } PurpleCredentialProviderPrivate;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 enum {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 PROP_0,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PROP_ID,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PROP_NAME,
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
33 PROP_DESCRIPTION,
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 N_PROPERTIES,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 };
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PurpleCredentialProvider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 purple_credential_provider, G_TYPE_OBJECT)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 /******************************************************************************
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 * Helpers
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 purple_credential_provider_set_id(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 const gchar *id)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 g_free(priv->id);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 priv->id = g_strdup(id);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 g_object_notify_by_pspec(G_OBJECT(provider), properties[PROP_ID]);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 purple_credential_provider_set_name(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 const gchar *name)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 g_free(priv->name);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 priv->name = g_strdup(name);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 g_object_notify_by_pspec(G_OBJECT(provider), properties[PROP_NAME]);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
72 static void
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
73 purple_credential_provider_set_description(PurpleCredentialProvider *provider,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
74 const gchar *description)
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
75 {
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
76 PurpleCredentialProviderPrivate *priv = NULL;
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
77
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
78 priv = purple_credential_provider_get_instance_private(provider);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
79
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
80 g_free(priv->description);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
81 priv->description = g_strdup(description);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
82
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
83 g_object_notify_by_pspec(G_OBJECT(provider), properties[PROP_DESCRIPTION]);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
84 }
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
85
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 /******************************************************************************
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 * GObject Implementation
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 purple_credential_provider_get_property(GObject *obj, guint param_id,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 GValue *value, GParamSpec *pspec)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 switch(param_id) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 case PROP_ID:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 g_value_set_string(value,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 purple_credential_provider_get_id(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 case PROP_NAME:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 g_value_set_string(value,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 purple_credential_provider_get_name(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 break;
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
104 case PROP_DESCRIPTION:
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
105 g_value_set_string(value,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
106 purple_credential_provider_get_description(provider));
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
107 break;
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 default:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 purple_credential_provider_set_property(GObject *obj, guint param_id,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 const GValue *value, GParamSpec *pspec)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 switch(param_id) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 case PROP_ID:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 purple_credential_provider_set_id(provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 g_value_get_string(value));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 case PROP_NAME:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 purple_credential_provider_set_name(provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 g_value_get_string(value));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 break;
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
129 case PROP_DESCRIPTION:
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
130 purple_credential_provider_set_description(provider,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
131 g_value_get_string(value));
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
132 break;
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 default:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 break;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 purple_credential_provider_finalize(GObject *obj) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 PurpleCredentialProvider *provider = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 provider = PURPLE_CREDENTIAL_PROVIDER(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 g_clear_pointer(&priv->id, g_free);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 g_clear_pointer(&priv->name, g_free);
41149
c357390f7c22 Fix a number of memory leaks
Gary Kramlich <grim@reaperworld.com>
parents: 40823
diff changeset
149 g_clear_pointer(&priv->description, g_free);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 G_OBJECT_CLASS(purple_credential_provider_parent_class)->finalize(obj);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 purple_credential_provider_init(PurpleCredentialProvider *provider) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 static void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 purple_credential_provider_class_init(PurpleCredentialProviderClass *klass) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 obj_class->get_property = purple_credential_provider_get_property;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 obj_class->set_property = purple_credential_provider_set_property;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 obj_class->finalize = purple_credential_provider_finalize;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 /**
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 * PurpleCredentialProvider::id:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 * The ID of the provider. Used for preferences and other things that need
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 * to address it.
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
171 *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
172 * Since: 3.0.0
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 */
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 properties[PROP_ID] = g_param_spec_string(
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 "id", "id", "The identifier of the provider",
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 NULL,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 );
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 /**
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 * PurpleCredentialProvider::name:
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 * The name of the provider which will be displayed to the user.
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
184 *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
185 * Since: 3.0.0
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 */
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 properties[PROP_NAME] = g_param_spec_string(
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 "name", "name", "The name of the provider",
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 NULL,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 );
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
193 /**
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
194 * PurpleCredentialProvider::description:
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
195 *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
196 * The description of the provider which will be displayed to the user.
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
197 *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
198 * Since: 3.0.0
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
199 */
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
200 properties[PROP_DESCRIPTION] = g_param_spec_string(
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
201 "description", "description", "The description of the provider",
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
202 NULL,
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
203 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
204 );
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
205
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 /******************************************************************************
40823
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
210 * Private API
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
211 *****************************************************************************/
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
212 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
213 purple_credential_provider_activate(PurpleCredentialProvider *provider) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
214 PurpleCredentialProviderClass *klass = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
215
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
216 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
217 if(klass && klass->activate) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
218 klass->activate(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
219 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
220 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
221
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
222 void
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
223 purple_credential_provider_deactivate(PurpleCredentialProvider *provider) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
224 PurpleCredentialProviderClass *klass = NULL;
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
225
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
226 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
227 if(klass && klass->deactivate) {
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
228 klass->deactivate(provider);
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
229 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
230 }
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
231
338bba38df77 Port the KWallet Keyring to the new CredentialProvider API.
Gary Kramlich <grim@reaperworld.com>
parents: 40790
diff changeset
232 /******************************************************************************
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 * Public API
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 *****************************************************************************/
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 const gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 purple_credential_provider_get_id(PurpleCredentialProvider *provider) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 return priv->id;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 const gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 purple_credential_provider_get_name(PurpleCredentialProvider *provider) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 PurpleCredentialProviderPrivate *priv = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 priv = purple_credential_provider_get_instance_private(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 return priv->name;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256
40790
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
257 const gchar *
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
258 purple_credential_provider_get_description(PurpleCredentialProvider *provider) {
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
259 PurpleCredentialProviderPrivate *priv = NULL;
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
260
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
261 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
262
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
263 priv = purple_credential_provider_get_instance_private(provider);
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
264
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
265 return priv->description;
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
266 }
e92d5c060155 Add a description to PurpleCredentialProvider and show it in the preferences selector
Gary Kramlich <grim@reaperworld.com>
parents: 40748
diff changeset
267
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 purple_credential_provider_is_valid(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 if(purple_credential_provider_get_id(provider) == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 0,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 "provider has no id");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 if(purple_credential_provider_get_name(provider) == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 1,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 "provider has no name");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 if(klass->read_password_async == NULL || klass->read_password_finish == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 2,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 "provider can not read passwords");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
298
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
299 if(klass->write_password_async == NULL || klass->write_password_finish == NULL) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
300 g_set_error_literal(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 3,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
301 "provider can not write passwords");
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 return TRUE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
308
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
309 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
310 purple_credential_provider_read_password_async(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
311 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
313 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
314 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
315 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
316 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
319 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
322 if(klass && klass->read_password_async) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
323 klass->read_password_async(provider, account, cancellable, callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
324 data);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
325 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
328 gchar *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329 purple_credential_provider_read_password_finish(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
333 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
335 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 if(klass && klass->read_password_finish) {
40679
062a4574af3e Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents: 40651
diff changeset
340 return klass->read_password_finish(provider, result, error);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
343 return NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
345
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 purple_credential_provider_write_password_async(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 const gchar *password,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
360 if(klass && klass->write_password_async) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 klass->write_password_async(provider, account, password, cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 callback, data);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
367 purple_credential_provider_write_password_finish(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
372
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377 if(klass && klass->write_password_finish) {
40679
062a4574af3e Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents: 40651
diff changeset
378 return klass->write_password_finish(provider, result, error);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
381 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
383
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
384 void
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 purple_credential_provider_clear_password_async(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
386 PurpleAccount *account,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
387 GCancellable *cancellable,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 GAsyncReadyCallback callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
389 gpointer data)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
391 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 g_return_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
394 g_return_if_fail(PURPLE_IS_ACCOUNT(account));
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
397 if(klass && klass->clear_password_async) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 klass->clear_password_async(provider, account, cancellable, callback,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 data);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
400 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
403 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
404 purple_credential_provider_clear_password_finish(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405 GAsyncResult *result,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 GError **error)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
407 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
409
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411 g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
412
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 if(klass && klass->clear_password_finish) {
40679
062a4574af3e Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents: 40651
diff changeset
415 return klass->clear_password_finish(provider, result, error);
40548
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
416 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
417
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
418 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
420
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
421 PurpleRequestFields *
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
422 purple_credential_provider_read_settings(PurpleCredentialProvider *provider) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
423 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
425 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
426
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
427 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
428 if(klass && klass->read_settings) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429 return klass->read_settings(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
430 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
431
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
432 return NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
433 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
434
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
435 gboolean
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436 purple_credential_provider_write_settings(PurpleCredentialProvider *provider,
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
437 PurpleRequestFields *fields)
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
438 {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
439 PurpleCredentialProviderClass *klass = NULL;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
440
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
441 g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
442 g_return_val_if_fail(fields != NULL, FALSE);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
443
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
444 klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
445 if(klass && klass->write_settings) {
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
446 return klass->write_settings(provider, fields);
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
447 }
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
448
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
449 return FALSE;
42556c49e1e2 Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
450 }

mercurial