libpurple/keyring.c

Sun, 06 Nov 2011 02:23:32 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sun, 06 Nov 2011 02:23:32 +0000
branch
soc.2008.masterpassword
changeset 34041
75204e58b8ca
parent 34039
52379a0a335d
child 34042
c79b32c07390
permissions
-rw-r--r--

Fix const-ness of strings, and silly strdups.

33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1 /**
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
2 * @file keyring.c Keyring plugin API
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
3 * @ingroup core
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
4 * @todo ? : add dummy callback to all calls to prevent poorly written
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
5 * plugins from segfaulting on NULL callback ?
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
6 */
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
7
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
8 /* purple
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
9 *
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
10 * Purple is the legal property of its developers, whose names are too numerous
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
11 * to list here. Please refer to the COPYRIGHT file distributed with this
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
12 * source distribution.
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
13 *
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
14 * This program is free software; you can redistribute it and/or modify
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
15 * it under the terms of the GNU General Public License as published by
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
16 * the Free Software Foundation; either version 2 of the License, or
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
17 * (at your option) any later version.
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
18 *
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
19 * This program is distributed in the hope that it will be useful,
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
22 * GNU General Public License for more details.
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
23 *
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
24 * You should have received a copy of the GNU General Public License
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
25 * along with this program ; if not, write to the Free Software
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
27 */
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
28
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
29 #include <glib.h>
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
30 #include <string.h>
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
31 #include "account.h"
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
32 #include "keyring.h"
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
33 #include "signals.h"
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
34 #include "core.h"
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
35 #include "debug.h"
33998
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
36 #include "internal.h"
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
37
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
38 typedef struct _PurpleKeyringCbInfo PurpleKeyringCbInfo;
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
39 typedef struct _PurpleKeyringChangeTracker PurpleKeyringChangeTracker;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
40
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
41 /******************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
42 /** @name PurpleKeyring */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
43 /******************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
44 /*@{*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
45
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
46 struct _PurpleKeyring
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
47 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
48 char *name; /* a user friendly name */
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
49 char *id; /* same as plugin id */
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
50 PurpleKeyringRead read_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
51 PurpleKeyringSave save_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
52 PurpleKeyringClose close_keyring;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
53 PurpleKeyringChangeMaster change_master;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
54 PurpleKeyringImportPassword import_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
55 PurpleKeyringExportPassword export_password;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
56 };
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
57
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
58 struct _PurpleKeyringChangeTracker
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
59 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
60 GError *error; /* could probably be dropped */
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
61 PurpleKeyringSetInUseCallback cb;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
62 gpointer data;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
63 const PurpleKeyring *new;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
64 const PurpleKeyring *old; /* we are done when: finished == TRUE && read_outstanding == 0 */
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
65 int read_outstanding;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
66 gboolean finished;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
67 gboolean abort;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
68 gboolean force;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
69 };
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
70
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
71 struct _PurpleKeyringCbInfo
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
72 {
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
73 gpointer cb;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
74 gpointer data;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
75 };
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
76
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
77 /* Constructor */
34030
a313b9660f6f Remove padding in the PurpleKeyring structure. It's never allocated or
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34029
diff changeset
78 PurpleKeyring *
a313b9660f6f Remove padding in the PurpleKeyring structure. It's never allocated or
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34029
diff changeset
79 purple_keyring_new(void)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
80 {
34030
a313b9660f6f Remove padding in the PurpleKeyring structure. It's never allocated or
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34029
diff changeset
81 return g_new0(PurpleKeyring, 1);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
82 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
83
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
84 /* Destructor */
34030
a313b9660f6f Remove padding in the PurpleKeyring structure. It's never allocated or
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34029
diff changeset
85 void
a313b9660f6f Remove padding in the PurpleKeyring structure. It's never allocated or
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34029
diff changeset
86 purple_keyring_free(PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
87 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
88 g_free(keyring);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
89 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
90
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
91 /* Accessors */
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
92 const char *
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
93 purple_keyring_get_name(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
94 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
95 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
96
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
97 return keyring->name;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
98 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
99
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
100 const char *
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
101 purple_keyring_get_id(const PurpleKeyring *keyring)
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
102 {
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
103 g_return_val_if_fail(keyring != NULL, NULL);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
104
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
105 return keyring->id;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
106 }
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
107
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
108 PurpleKeyringRead
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
109 purple_keyring_get_read_password(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
110 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
111 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
112
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
113 return keyring->read_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
114 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
115
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
116 PurpleKeyringSave
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
117 purple_keyring_get_save_password(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
118 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
119 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
120
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
121 return keyring->save_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
122 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
123
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
124 PurpleKeyringClose
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
125 purple_keyring_get_close_keyring(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
126 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
127 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
128
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
129 return keyring->close_keyring;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
130 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
131
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
132 PurpleKeyringChangeMaster
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
133 purple_keyring_get_change_master(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
134 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
135 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
136
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
137 return keyring->change_master;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
138 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
139
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
140 PurpleKeyringImportPassword
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
141 purple_keyring_get_import_password(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
142 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
143 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
144
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
145 return keyring->import_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
146 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
147
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
148 PurpleKeyringExportPassword
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
149 purple_keyring_get_export_password(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
150 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
151 g_return_val_if_fail(keyring != NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
152
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
153 return keyring->export_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
154 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
155
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
156 void
34041
75204e58b8ca Fix const-ness of strings, and silly strdups.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34039
diff changeset
157 purple_keyring_set_name(PurpleKeyring *keyring, const char *name)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
158 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
159 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
160
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
161 g_free(keyring->name);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
162 keyring->name = g_strdup(name);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
163 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
164
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
165 void
34041
75204e58b8ca Fix const-ness of strings, and silly strdups.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34039
diff changeset
166 purple_keyring_set_id(PurpleKeyring *keyring, const char *id)
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
167 {
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
168 g_return_if_fail(keyring != NULL);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
169
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
170 g_free(keyring->id);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
171 keyring->id = g_strdup(id);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
172 }
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
173
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
174 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
175 purple_keyring_set_read_password(PurpleKeyring *keyring, PurpleKeyringRead read)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
176 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
177 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
178
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
179 keyring->read_password = read;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
180 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
181
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
182 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
183 purple_keyring_set_save_password(PurpleKeyring *keyring, PurpleKeyringSave save)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
184 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
185 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
186
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
187 keyring->save_password = save;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
188 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
189
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
190 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
191 purple_keyring_set_close_keyring(PurpleKeyring *keyring, PurpleKeyringClose close)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
192 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
193 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
194
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
195 keyring->close_keyring = close;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
196 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
197
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
198 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
199 purple_keyring_set_change_master(PurpleKeyring *keyring, PurpleKeyringChangeMaster change)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
200 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
201 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
202
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
203 keyring->change_master = change;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
204 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
205
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
206 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
207 purple_keyring_set_import_password(PurpleKeyring *keyring, PurpleKeyringImportPassword import)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
208 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
209 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
210
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
211 keyring->import_password = import;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
212 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
213
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
214 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
215 purple_keyring_set_export_password(PurpleKeyring *keyring, PurpleKeyringExportPassword export)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
216 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
217 g_return_if_fail(keyring != NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
218
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
219 keyring->export_password = export;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
220 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
221
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
222 /*@}*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
223
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
224
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
225 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
226 /** @name Keyring API */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
227 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
228 /*@{*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
229
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
230 static GList *purple_keyring_keyrings; /* list of available keyrings */
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
231 static const PurpleKeyring *purple_keyring_inuse; /* keyring being used */
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
232 static char *purple_keyring_to_use;
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
233 static guint purple_keyring_pref_cb_id;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
234
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
235 static void
34032
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
236 purple_keyring_pref_cb(const char *pref,
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
237 PurplePrefType type,
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
238 gconstpointer id,
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
239 gpointer data)
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
240 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
241 PurpleKeyring *new;
34032
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
242
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
243 g_return_if_fail(g_strcmp0(pref, "/purple/keyring/active") == 0);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
244 g_return_if_fail(type == PURPLE_PREF_STRING);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
245 g_return_if_fail(id != NULL);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
246
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
247 new = purple_keyring_get_keyring_by_id(id);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
248 g_return_if_fail(new != NULL);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
249
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
250 purple_keyring_set_inuse(new, FALSE, NULL, data);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
251 }
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
252
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
253 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
254 purple_keyring_init(void)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
255 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
256 PurpleCore *core;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
257 const char *touse;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
258
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
259 /* Make sure we don't have junk */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
260 purple_keyring_keyrings = NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
261 purple_keyring_inuse = NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
262
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
263 /* register signals */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
264 core = purple_get_core();
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
265
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
266 purple_signal_register(core, "keyring-register",
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
267 purple_marshal_VOID__POINTER_POINTER,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
268 NULL, 2,
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
269 purple_value_new(PURPLE_TYPE_STRING), /* keyring ID */
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
270 purple_value_new(PURPLE_TYPE_BOXED, "PurpleKeyring *")); /* a pointer to the keyring */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
271
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
272 purple_signal_register(core, "keyring-unregister",
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
273 purple_marshal_VOID__POINTER_POINTER,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
274 NULL, 2,
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
275 purple_value_new(PURPLE_TYPE_STRING), /* keyring ID */
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
276 purple_value_new(PURPLE_TYPE_BOXED, "PurpleKeyring *")); /* a pointer to the keyring */
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
277
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
278 /* see what keyring we want to use */
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
279 touse = purple_prefs_get_string("/purple/keyring/active");
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
280
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
281 if (touse == NULL) {
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
282 purple_prefs_add_none("/purple/keyring");
34036
bf17ffca901d Give this a better name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34034
diff changeset
283 purple_prefs_add_string("/purple/keyring/active", PURPLE_DEFAULT_KEYRING);
bf17ffca901d Give this a better name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34034
diff changeset
284 purple_keyring_to_use = g_strdup(PURPLE_DEFAULT_KEYRING);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
285 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
286 purple_keyring_to_use = g_strdup(touse);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
287 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
288
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
289 purple_keyring_pref_cb_id = purple_prefs_connect_callback(NULL,
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
290 "/purple/keyring/active", purple_keyring_pref_cb, NULL);
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
291
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
292 purple_debug_info("keyring", "purple_keyring_init() done, selected keyring is : %s.\n",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
293 purple_keyring_to_use);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
294 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
295
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
296 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
297 purple_keyring_uninit(void)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
298 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
299 g_free(purple_keyring_to_use);
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
300 purple_debug_info("keyring", "purple_keyring_uninit() done.\n");
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
301 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
302
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
303 static PurpleKeyring *
34041
75204e58b8ca Fix const-ness of strings, and silly strdups.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34039
diff changeset
304 purple_keyring_find_keyring_by_id(const char *id)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
305 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
306 GList *l;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
307 PurpleKeyring *keyring;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
308 const char *curr_id;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
309
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
310 for (l = purple_keyring_keyrings; l != NULL; l = l->next) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
311 keyring = l->data;
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
312 curr_id = purple_keyring_get_id(keyring);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
313
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
314 if (g_strcmp0(id, curr_id) == 0)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
315 return keyring;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
316 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
317
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
318 return NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
319 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
320
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
321 const GList *
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
322 purple_keyring_get_keyrings(void)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
323 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
324 return purple_keyring_keyrings;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
325 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
326
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
327 const PurpleKeyring *
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
328 purple_keyring_get_inuse(void)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
329 {
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
330 return purple_keyring_inuse;
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
331 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
332
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
333
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
334 /* fire and forget */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
335 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
336 purple_keyring_drop_passwords(const PurpleKeyring *keyring)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
337 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
338 GList *cur;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
339 PurpleKeyringSave save;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
340
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
341 save = purple_keyring_get_save_password(keyring);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
342
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
343 g_return_if_fail(save != NULL);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
344
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
345 for (cur = purple_accounts_get_all();
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
346 cur != NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
347 cur = cur->next)
34029
059c1270db1f Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34028
diff changeset
348 save(cur->data, NULL, NULL, NULL);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
349 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
350
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
351 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
352 purple_keyring_set_inuse_check_error_cb(PurpleAccount *account,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
353 GError *error,
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
354 gpointer data)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
355 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
356 const char *name;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
357 PurpleKeyringClose close;
34041
75204e58b8ca Fix const-ness of strings, and silly strdups.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34039
diff changeset
358 PurpleKeyringChangeTracker *tracker;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
359
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
360 tracker = (PurpleKeyringChangeTracker *)data;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
361
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
362 g_return_if_fail(tracker->abort == FALSE);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
363
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
364 tracker->read_outstanding--;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
365
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
366 name = purple_account_get_username(account);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
367
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
368 if ((error != NULL) && (error->domain == ERR_PIDGINKEYRING)) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
369 tracker->error = error;
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
370
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
371 switch(error->code) {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
372 case ERR_NOCAP:
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
373 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
374 "Keyring could not save password for account %s : %s\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
375 name, error->message);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
376 break;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
377
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
378 case ERR_NOPASSWD:
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
379 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
380 "No password found while changing keyring for account %s : %s\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
381 name, error->message);
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
382 break;
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
383
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
384 case ERR_NOCHANNEL:
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
385 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
386 "Failed to communicate with backend while changing keyring for account %s : %s Aborting changes.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
387 name, error->message);
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
388 tracker->abort = TRUE;
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
389 break;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
390
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
391 default:
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
392 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
393 "Unknown error while changing keyring for account %s : %s\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
394 name, error->message);
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
395 break;
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
396 }
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
397 }
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
398
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
399 /* if this was the last one */
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
400 if (tracker->finished == TRUE && tracker->read_outstanding == 0) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
401 if (tracker->abort == TRUE && tracker->force == FALSE) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
402 if (tracker->cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
403 tracker->cb(tracker->old, FALSE, tracker->error, tracker->data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
404
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
405 purple_keyring_drop_passwords(tracker->new);
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
406
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
407 close = purple_keyring_get_close_keyring(tracker->new);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
408 if (close != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
409 close(NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
410
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
411 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
412 "Failed to change keyring, aborting");
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
413
33998
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
414 purple_notify_error(NULL, _("Keyrings"), _("Failed to change the keyring."),
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
415 _("Aborting changes."));
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
416 purple_keyring_inuse = tracker->old;
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
417 purple_prefs_disconnect_callback(purple_keyring_pref_cb_id);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
418 purple_prefs_set_string("/purple/keyring/active",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
419 purple_keyring_get_id(tracker->old));
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
420 purple_keyring_pref_cb_id = purple_prefs_connect_callback(NULL,
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
421 "/purple/keyring/active", purple_keyring_pref_cb, NULL);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
422
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
423 } else {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
424 close = purple_keyring_get_close_keyring(tracker->old);
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
425 if (close != NULL)
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
426 close(&error);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
427
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
428 purple_keyring_drop_passwords(tracker->old);
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
429
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
430 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
431 "Successfully changed keyring.\n");
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
432
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
433 if (tracker->cb != NULL)
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
434 tracker->cb(tracker->new, TRUE, error, tracker->data);
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
435 }
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
436
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
437 g_free(tracker);
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
438 }
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
439
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
440 /**
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
441 * This is kind of hackish. It will schedule an account save,
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
442 * and then return because account == NULL.
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
443 * Another way to do this would be to expose the
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
444 * schedule_accounts_save() function, but other such functions
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
445 * are not exposed. So these was done for consistency.
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
446 */
34029
059c1270db1f Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34028
diff changeset
447 purple_account_set_password(NULL, NULL, NULL, NULL);
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
448 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
449
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
450
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
451 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
452 purple_keyring_set_inuse_got_pw_cb(PurpleAccount *account,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
453 gchar *password,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
454 GError *error,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
455 gpointer data)
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
456 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
457 const PurpleKeyring *new;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
458 PurpleKeyringSave save;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
459 PurpleKeyringChangeTracker *tracker;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
460
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
461 tracker = (PurpleKeyringChangeTracker *)data;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
462 new = tracker->new;
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
463
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
464 g_return_if_fail(tracker->abort == FALSE);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
465
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
466 if (error != NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
467 if (error->code == ERR_NOPASSWD ||
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
468 error->code == ERR_NOACCOUNT ||
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
469 tracker->force == TRUE) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
470 /* don't save password, and directly trigger callback */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
471 purple_keyring_set_inuse_check_error_cb(account, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
472
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
473 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
474 /* fatal error, abort all */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
475 tracker->abort = TRUE;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
476 }
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
477
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
478 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
479 save = purple_keyring_get_save_password(new);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
480
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
481 if (save != NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
482 /* this test is probably totally useless, since there's no point
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
483 * in having a keyring that can't store passwords, but it
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
484 * will prevent crash with invalid keyrings
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
485 */
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
486 save(account, password,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
487 purple_keyring_set_inuse_check_error_cb, tracker);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
488
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
489 } else {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
490 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
491 "cannot store passwords in new keyring");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
492 purple_keyring_set_inuse_check_error_cb(account, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
493 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
494 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
495 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
496 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
497
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
498 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
499 purple_keyring_set_inuse(const PurpleKeyring *newkeyring,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
500 gboolean force,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
501 PurpleKeyringSetInUseCallback cb,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
502 gpointer data)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
503 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
504 GList *cur;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
505 const PurpleKeyring *oldkeyring;
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
506 PurpleKeyringRead read = NULL;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
507 PurpleKeyringClose close;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
508 PurpleKeyringChangeTracker *tracker;
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
509
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
510 if (newkeyring != NULL)
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
511 purple_debug_info("keyring", "Attempting to set new keyring : %s.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
512 newkeyring->id);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
513 else
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
514 purple_debug_info("keyring", "Attempting to set new keyring : NULL.\n");
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
515
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
516 oldkeyring = purple_keyring_get_inuse();
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
517
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
518 if (oldkeyring != NULL) {
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
519 read = purple_keyring_get_read_password(oldkeyring);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
520
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
521 if (read == NULL) {
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
522 /*
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
523 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
524 "Existing keyring cannot read passwords");
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
525 */
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
526 purple_debug_info("keyring", "Existing keyring cannot read passwords");
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
527
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
528 /* at this point, we know the keyring won't let us
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
529 * read passwords, so there no point in copying them.
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
530 * therefore we just cleanup the old and setup the new
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
531 * one later.
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
532 */
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
533
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
534 purple_keyring_drop_passwords(oldkeyring);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
535
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
536 close = purple_keyring_get_close_keyring(oldkeyring);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
537
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
538 if (close != NULL)
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
539 close(NULL); /* we can't do much about errors at this point */
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
540
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
541 } else {
34039
52379a0a335d Use g_new() where a struct is malloc'd.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34036
diff changeset
542 tracker = g_new(PurpleKeyringChangeTracker, 1);
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
543 oldkeyring = purple_keyring_get_inuse();
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
544
33998
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
545 purple_keyring_inuse = newkeyring;
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
546
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
547 tracker->cb = cb;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
548 tracker->data = data;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
549 tracker->new = newkeyring;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
550 tracker->old = oldkeyring;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
551 tracker->read_outstanding = 0;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
552 tracker->finished = FALSE;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
553 tracker->abort = FALSE;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
554 tracker->force = force;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
555 tracker->error = NULL;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
556
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
557 for (cur = purple_accounts_get_all();
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
558 (cur != NULL) && (tracker->abort == FALSE);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
559 cur = cur->next) {
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
560
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
561 tracker->read_outstanding++;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
562
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
563 if (cur->next == NULL)
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
564 tracker->finished = TRUE;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
565
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
566 read(cur->data, purple_keyring_set_inuse_got_pw_cb, tracker);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
567 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
568 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
569
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
570 } else { /* no keyring was set before. */
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
571 purple_debug_info("keyring", "Setting keyring for the first time : %s.\n",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
572 newkeyring->id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
573 purple_keyring_inuse = newkeyring;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
574
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
575 if (cb != NULL)
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
576 cb(newkeyring, TRUE, NULL, data);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
577 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
578 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
579
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
580 GList *
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
581 purple_keyring_get_options(void)
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
582 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
583 const GList *keyrings;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
584 PurpleKeyring *keyring;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
585 GList *list = NULL;
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
586
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
587 for (keyrings = purple_keyring_get_keyrings();
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
588 keyrings != NULL;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
589 keyrings = keyrings->next) {
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
590
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
591 keyring = keyrings->data;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
592 list = g_list_append(list, keyring->name);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
593 list = g_list_append(list, keyring->id);
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
594 purple_debug_info("keyring", "adding pair : %s, %s.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
595 keyring->name, keyring->id);
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
596 }
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
597
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
598 return list;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
599 }
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
600
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
601 PurpleKeyring *
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
602 purple_keyring_get_keyring_by_id(const char *id)
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
603 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
604 const GList *keyrings;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
605 PurpleKeyring *keyring;
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
606
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
607 for (keyrings = purple_keyring_get_keyrings();
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
608 keyrings != NULL;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
609 keyrings = keyrings->next) {
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
610
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
611 keyring = keyrings->data;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
612 if (g_strcmp0(id, keyring->id) == 0)
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
613 return keyring;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
614
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
615 }
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
616
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
617 return NULL;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
618 }
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
619
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
620 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
621 purple_keyring_register(PurpleKeyring *keyring)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
622 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
623 const char *keyring_id;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
624 PurpleCore *core;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
625
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
626 g_return_if_fail(keyring != NULL);
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
627
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
628 keyring_id = purple_keyring_get_id(keyring);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
629
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
630 /* keyring with no ID. Add error handling ? */
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
631 g_return_if_fail(keyring_id != NULL);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
632
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
633 purple_debug_info("keyring", "Registering keyring : %s\n",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
634 keyring->id);
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
635
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
636 /* If this is the configured keyring, use it. */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
637 if (purple_keyring_inuse == NULL &&
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
638 g_strcmp0(keyring_id, purple_keyring_to_use) == 0) {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
639
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
640 purple_debug_info("keyring", "Keyring %s matches keyring to use, using it.\n",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
641 keyring->id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
642 purple_keyring_set_inuse(keyring, TRUE, NULL, NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
643
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
644 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
645
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
646 core = purple_get_core();
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
647
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
648 purple_signal_emit(core, "keyring-register", keyring_id, keyring);
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
649 purple_debug_info("keyring", "registered keyring : %s.\n", keyring_id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
650
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
651 purple_keyring_keyrings = g_list_prepend(purple_keyring_keyrings,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
652 keyring);
33976
ff88d1340abe Cleaned up keyring.h, updating it to the latest API ideas. Minor changes in other files. Also wrote doxygen documentation for most of the functions in keyring.h.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33973
diff changeset
653 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
654
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
655 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
656 purple_keyring_unregister(PurpleKeyring *keyring)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
657 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
658 PurpleCore *core;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
659 const PurpleKeyring *inuse;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
660 PurpleKeyring *fallback;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
661 const char *keyring_id;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
662
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
663 g_return_if_fail(keyring != NULL);
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
664
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
665 purple_debug_info("keyring", "Unregistering keyring %s",
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
666 purple_keyring_get_id(keyring));
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
667
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
668 core = purple_get_core();
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
669 keyring_id = purple_keyring_get_id(keyring);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
670 purple_signal_emit(core, "keyring-unregister", keyring_id, keyring);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
671
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
672 inuse = purple_keyring_get_inuse();
34036
bf17ffca901d Give this a better name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34034
diff changeset
673 fallback = purple_keyring_find_keyring_by_id(PURPLE_DEFAULT_KEYRING);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
674
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
675 if (inuse == keyring) {
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
676 if (inuse != fallback) {
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
677 purple_keyring_set_inuse(fallback, TRUE, NULL, NULL);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
678
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
679 } else {
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
680 fallback = NULL;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
681 purple_keyring_set_inuse(NULL, TRUE, NULL, NULL);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
682 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
683 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
684
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
685 purple_keyring_keyrings = g_list_remove(purple_keyring_keyrings,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
686 keyring);
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
687
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
688 purple_debug_info("keyring", "Keyring %s unregistered", keyring->id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
689 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
690
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
691 /*@}*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
692
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
693
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
694 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
695 /** @name Keyring plugin wrappers */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
696 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
697 /*@{*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
698
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
699 gboolean
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
700 purple_keyring_import_password(PurpleAccount *account,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
701 const char *keyringid,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
702 const char *mode,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
703 const char *data,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
704 GError **error)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
705 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
706 const PurpleKeyring *inuse;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
707 PurpleKeyringImportPassword import;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
708 const char *realid;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
709
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
710 purple_debug_info("keyring", "Importing password for account %s (%s) to keyring %s.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
711 purple_account_get_username(account),
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
712 purple_account_get_protocol_id(account),
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
713 keyringid);
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
714
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
715 inuse = purple_keyring_get_inuse();
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
716
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
717 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
718 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOKEYRING,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
719 "No keyring configured, cannot import password info");
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
720 purple_debug_info("Keyring",
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
721 "No keyring configured, cannot import password info for account %s (%s).\n",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
722 purple_account_get_username(account), purple_account_get_protocol_id(account));
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
723 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
724 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
725
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
726 realid = purple_keyring_get_id(inuse);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
727 /*
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
728 * we want to be sure that either :
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
729 * - there is a keyringid specified and it matches the one configured
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
730 * - or the configured keyring is the fallback, compatible one.
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
731 */
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
732 if ((keyringid != NULL && g_strcmp0(realid, keyringid) != 0) ||
34036
bf17ffca901d Give this a better name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34034
diff changeset
733 (keyringid == NULL && g_strcmp0(PURPLE_DEFAULT_KEYRING, realid))) {
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
734
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
735 *error = g_error_new(ERR_PIDGINKEYRING , ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
736 "Specified keyring id does not match the configured one.");
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
737 purple_debug_info("keyring",
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
738 "Specified keyring id does not match the configured one (%s vs. %s). Data will be lost.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
739 keyringid, realid);
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
740 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
741 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
742
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
743 import = purple_keyring_get_import_password(inuse);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
744 if (import == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
745 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
746 "Keyring cannot import password info.");
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
747 purple_debug_info("Keyring", "Configured keyring cannot import password info. This might be normal.");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
748 return FALSE;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
749 }
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
750
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
751 return import(account, mode, data, error);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
752 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
753
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
754 gboolean
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
755 purple_keyring_export_password(PurpleAccount *account,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
756 const char **keyringid,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
757 const char **mode,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
758 char **data,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
759 GError **error,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
760 GDestroyNotify *destroy)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
761 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
762 const PurpleKeyring *inuse;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
763 PurpleKeyringExportPassword export;
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
764
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
765 inuse = purple_keyring_get_inuse();
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
766
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
767 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
768 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOKEYRING,
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
769 "No keyring configured, cannot export password info");
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
770 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
771 "No keyring configured, cannot export password info");
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
772 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
773 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
774
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
775 *keyringid = purple_keyring_get_id(inuse);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
776
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
777 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
778 "Exporting password for account %s (%s) from keyring %s.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
779 purple_account_get_username(account),
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
780 purple_account_get_protocol_id(account),
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
781 *keyringid);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
782
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
783 if (*keyringid == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
784 *error = g_error_new(ERR_PIDGINKEYRING , ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
785 "Plugin does not have a keyring id");
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
786 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
787 "Configured keyring does not have a keyring id, cannot export password");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
788 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
789 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
790
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
791 export = purple_keyring_get_export_password(inuse);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
792
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
793 if (export == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
794 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
795 "Keyring cannot export password info.");
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
796 purple_debug_info("keyring",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
797 "Keyring cannot export password info. This might be normal");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
798 return FALSE;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
799 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
800
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
801 return export(account, mode, data, error, destroy);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
802 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
803
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
804 void
34028
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34027
diff changeset
805 purple_keyring_get_password(PurpleAccount *account,
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34027
diff changeset
806 PurpleKeyringReadCallback cb,
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34027
diff changeset
807 gpointer data)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
808 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
809 GError *error = NULL;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
810 const PurpleKeyring *inuse;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
811 PurpleKeyringRead read;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
812
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
813 if (account == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
814 error = g_error_new(ERR_PIDGINKEYRING, ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
815 "No account passed to the function.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
816
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
817 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
818 cb(account, NULL, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
819
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
820 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
821
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
822 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
823 inuse = purple_keyring_get_inuse();
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
824
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
825 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
826 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOKEYRING,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
827 "No keyring configured.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
828
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
829 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
830 cb(account, NULL, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
831
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
832 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
833
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
834 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
835 read = purple_keyring_get_read_password(inuse);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
836
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
837 if (read == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
838 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
839 "Keyring cannot read password.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
840
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
841 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
842 cb(account, NULL, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
843
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
844 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
845
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
846 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
847 read(account, cb, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
848 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
849 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
850 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
851 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
852
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
853 static void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
854 purple_keyring_set_password_async_cb(PurpleAccount *account,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
855 GError *error,
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
856 gpointer data)
34032
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
857 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
858 PurpleKeyringCbInfo *cbinfo;
34032
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
859 PurpleKeyringSaveCallback cb;
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
860
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
861 g_return_if_fail(data != NULL);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
862 g_return_if_fail(account != NULL);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
863
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
864 cbinfo = data;
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
865 cb = cbinfo->cb;
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
866
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
867 if (error != NULL) {
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
868 purple_notify_error(NULL, _("Keyrings"),
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
869 _("Failed to save password in keyring."),
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
870 error->message);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
871 }
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
872
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
873 if (cb != NULL)
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
874 cb(account, error, cbinfo->data);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
875 g_free(data);
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
876 }
2eeafc43c7f2 Rearrange code so we can drop the prototypes. Most of it was already
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34031
diff changeset
877
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
878 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
879 purple_keyring_set_password(PurpleAccount *account,
34029
059c1270db1f Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34028
diff changeset
880 const gchar *password,
34028
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34027
diff changeset
881 PurpleKeyringSaveCallback cb,
a3050b6df38e Remove deprecated API since we're targeting 3.0.0 here. Don't mind the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34027
diff changeset
882 gpointer data)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
883 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
884 GError *error = NULL;
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
885 const PurpleKeyring *inuse;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
886 PurpleKeyringSave save;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
887 PurpleKeyringCbInfo *cbinfo;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
888
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
889 g_return_if_fail(account != NULL);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
890
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
891 inuse = purple_keyring_get_inuse();
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
892 if (inuse == NULL) {
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
893 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOKEYRING,
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
894 "No keyring configured.");
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
895 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
896 cb(account, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
897 g_error_free(error);
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
898
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
899 } else {
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
900 save = purple_keyring_get_save_password(inuse);
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
901 if (save == NULL) {
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
902 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
903 "Keyring cannot save password.");
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
904 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
905 cb(account, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
906 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
907
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
908 } else {
34039
52379a0a335d Use g_new() where a struct is malloc'd.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34036
diff changeset
909 cbinfo = g_new(PurpleKeyringCbInfo, 1);
33997
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
910 cbinfo->cb = cb;
035d8594b66a Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33996
diff changeset
911 cbinfo->data = data;
34029
059c1270db1f Remove the silly destroy argument from purple_account_set_password and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34028
diff changeset
912 save(account, password, purple_keyring_set_password_async_cb, data);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
913 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
914 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
915 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
916
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
917 void
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
918 purple_keyring_close(PurpleKeyring *keyring, GError **error)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
919 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
920 PurpleKeyringClose close;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
921
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
922 if (keyring == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
923 *error = g_error_new(ERR_PIDGINKEYRING, ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
924 "No keyring passed to the function.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
925
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
926 } else {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
927 close = purple_keyring_get_close_keyring(keyring);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
928
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
929 if (close == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
930 *error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
931 "Keyring doesn't support being closed.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
932
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
933 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
934 close(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
935
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
936 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
937 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
938 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
939
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
940
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
941 void
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
942 purple_keyring_change_master(PurpleKeyringChangeMasterCallback cb,
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
943 gpointer data)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
944 {
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
945 GError *error = NULL;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
946 PurpleKeyringChangeMaster change;
34034
f508fa47f2ac Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34033
diff changeset
947 const PurpleKeyring *inuse;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
948
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
949 inuse = purple_keyring_get_inuse();
34033
910f2ed3988b Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 34032
diff changeset
950
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
951 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
952 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
953 "Keyring doesn't support master passwords.");
33998
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
954 if (cb)
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
955 cb(FALSE, error, data);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
956 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
957
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
958 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
959 change = purple_keyring_get_change_master(inuse);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
960
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
961 if (change == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
962 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
963 "Keyring doesn't support master passwords.");
33998
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
964 if (cb)
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
965 cb(FALSE, error, data);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
966
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
967 g_error_free(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
968
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
969 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
970 change(cb, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
971
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
972 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
973 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
974 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
975
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
976 /*@}*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
977
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
978
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
979 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
980 /** @name Error Codes */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
981 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
982 /*@{*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
983
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
984 GQuark purple_keyring_error_domain(void)
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
985 {
33998
5fcfc69be362 Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33997
diff changeset
986 return g_quark_from_static_string("libpurple keyring");
33970
4b6a0141a242 Fixed syntax and types error. keyring.c and keyring.h will now compile, but will issue warnings with -Wall
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33969
diff changeset
987 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
988
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
989 /*}@*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
990

mercurial