Sun, 06 Nov 2011 06:15:18 +0000
Replace one hack with another. Maybe we want to think about something
more concrete for scheduling an account save, or maybe just refactor
some other stuff, but for now this hack doesn't make a GLib assert.
|
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 | |
|
34042
c79b32c07390
Remove duplicate function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34041
diff
changeset
|
247 | new = purple_keyring_find_keyring_by_id(id); |
|
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
|
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 | |
|
34042
c79b32c07390
Remove duplicate function.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34041
diff
changeset
|
303 | 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 | |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
368 | if ((error != NULL) && (error->domain == PURPLE_KEYRING_ERROR)) { |
|
33978
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) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
372 | case PURPLE_KEYRING_ERROR_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", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
374 | "Keyring could not save password for account %s : %s.\n", |
|
33987
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 | |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
378 | case PURPLE_KEYRING_ERROR_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", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
380 | "No password found while changing keyring for account %s : %s.\n", |
|
33987
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 | |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
384 | case PURPLE_KEYRING_ERROR_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", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
386 | "Failed to communicate with backend while changing keyring for account %s : %s. Aborting changes.\n", |
|
33987
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", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
393 | "Unknown error while changing keyring for account %s : %s.\n", |
|
33987
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", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
412 | "Failed to change keyring, aborting.\n"); |
|
33987
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 | |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
430 | purple_debug_info("keyring", "Successfully changed keyring.\n"); |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
431 | |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
432 | 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
|
433 | 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
|
434 | } |
|
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
435 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
436 | g_free(tracker); |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
437 | } |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
438 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
439 | /** |
|
34056
07643afffcdc
Replace one hack with another. Maybe we want to think about something
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34055
diff
changeset
|
440 | * This is kind of hackish. It will schedule an account save. |
|
07643afffcdc
Replace one hack with another. Maybe we want to think about something
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34055
diff
changeset
|
441 | * |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
442 | * 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
|
443 | * 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
|
444 | * 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
|
445 | */ |
|
34056
07643afffcdc
Replace one hack with another. Maybe we want to think about something
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34055
diff
changeset
|
446 | purple_account_set_remember_password(account, |
|
07643afffcdc
Replace one hack with another. Maybe we want to think about something
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34055
diff
changeset
|
447 | purple_account_get_remember_password(account)); |
|
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 | |
|
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
|
450 | static void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
451 | purple_keyring_set_inuse_got_pw_cb(PurpleAccount *account, |
|
34046
b9329fa36c70
One more missing const.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34042
diff
changeset
|
452 | const gchar *password, |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
453 | GError *error, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
454 | 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
|
455 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
456 | const PurpleKeyring *new; |
|
33971
96eff57a4349
Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33970
diff
changeset
|
457 | PurpleKeyringSave save; |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
458 | PurpleKeyringChangeTracker *tracker; |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
459 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
460 | tracker = (PurpleKeyringChangeTracker *)data; |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
461 | new = tracker->new; |
|
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
462 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
463 | 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
|
464 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
465 | if (error != NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
466 | if (error->code == PURPLE_KEYRING_ERROR_NOPASSWD || |
|
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
467 | error->code == PURPLE_KEYRING_ERROR_NOACCOUNT || |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
468 | tracker->force == TRUE) { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
469 | /* 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
|
470 | 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
|
471 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
472 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
473 | /* 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
|
474 | tracker->abort = TRUE; |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
475 | } |
|
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
|
476 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
477 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
478 | 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
|
479 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
480 | if (save != NULL) { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
481 | /* 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
|
482 | * 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
|
483 | * 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
|
484 | */ |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
485 | 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
|
486 | 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
|
487 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
488 | } else { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
489 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
490 | "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
|
491 | 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
|
492 | 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
|
493 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
494 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
495 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
496 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
497 | void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
498 | purple_keyring_set_inuse(const PurpleKeyring *newkeyring, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
499 | gboolean force, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
500 | PurpleKeyringSetInUseCallback cb, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
501 | gpointer data) |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
502 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
503 | GList *cur; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
504 | 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
|
505 | 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
|
506 | PurpleKeyringClose close; |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
507 | 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
|
508 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
509 | if (newkeyring != NULL) |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
510 | 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
|
511 | newkeyring->id); |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
512 | else |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
513 | 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
|
514 | |
|
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
|
515 | 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
|
516 | |
|
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
|
517 | 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
|
518 | 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
|
519 | |
|
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
|
520 | 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
|
521 | /* |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
522 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_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
|
523 | "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
|
524 | */ |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
525 | purple_debug_info("keyring", "Existing keyring cannot read passwords.\n"); |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
526 | |
|
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
|
527 | /* 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
|
528 | * 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
|
529 | * 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
|
530 | * 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
|
531 | */ |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
532 | |
|
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
|
533 | 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
|
534 | |
|
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
|
535 | 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
|
536 | |
|
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
|
537 | if (close != NULL) |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
538 | 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
|
539 | |
|
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
|
540 | } else { |
|
34039
52379a0a335d
Use g_new() where a struct is malloc'd.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34036
diff
changeset
|
541 | tracker = g_new(PurpleKeyringChangeTracker, 1); |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
542 | |
|
33998
5fcfc69be362
Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33997
diff
changeset
|
543 | 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
|
544 | |
|
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
|
545 | 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
|
546 | 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
|
547 | 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
|
548 | 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
|
549 | 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
|
550 | 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
|
551 | 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
|
552 | 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
|
553 | tracker->error = NULL; |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
554 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
555 | 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
|
556 | (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
|
557 | 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
|
558 | |
|
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 | tracker->read_outstanding++; |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
560 | |
|
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
|
561 | 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
|
562 | tracker->finished = TRUE; |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
563 | |
|
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
|
564 | 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
|
565 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
566 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
567 | |
|
33973
b193c0e9044b
Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33972
diff
changeset
|
568 | } 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
|
569 | 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
|
570 | newkeyring->id); |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
571 | 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
|
572 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
573 | 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
|
574 | cb(newkeyring, TRUE, NULL, data); |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
575 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
576 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
577 | |
|
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
|
578 | GList * |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
579 | 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
|
580 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
581 | const GList *keyrings; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
582 | PurpleKeyring *keyring; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
583 | 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
|
584 | |
|
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
|
585 | 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
|
586 | 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
|
587 | 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
|
588 | |
|
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 | 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
|
590 | 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
|
591 | list = g_list_append(list, 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
|
592 | } |
|
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 | |
|
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
|
594 | 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
|
595 | } |
|
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 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
597 | void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
598 | purple_keyring_register(PurpleKeyring *keyring) |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
599 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
600 | const char *keyring_id; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
601 | PurpleCore *core; |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
602 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
603 | g_return_if_fail(keyring != NULL); |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
604 | |
|
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
|
605 | 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
|
606 | |
|
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
|
607 | /* 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
|
608 | 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
|
609 | |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
610 | purple_debug_info("keyring", "Registering keyring : %s.\n", |
|
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
|
611 | 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
|
612 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
613 | /* 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
|
614 | 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
|
615 | 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
|
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 | 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
|
618 | keyring->id); |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
619 | 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
|
620 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
621 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
622 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
623 | 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
|
624 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
625 | purple_signal_emit(core, "keyring-register", keyring_id, keyring); |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
626 | 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
|
627 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
628 | 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
|
629 | 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
|
630 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
631 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
632 | void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
633 | purple_keyring_unregister(PurpleKeyring *keyring) |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
634 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
635 | PurpleCore *core; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
636 | const PurpleKeyring *inuse; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
637 | PurpleKeyring *fallback; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
638 | 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
|
639 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
640 | g_return_if_fail(keyring != NULL); |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
641 | |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
642 | purple_debug_info("keyring", "Unregistering keyring %s.\n", |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
643 | 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
|
644 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
645 | 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
|
646 | 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
|
647 | 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
|
648 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
649 | inuse = purple_keyring_get_inuse(); |
|
34036
bf17ffca901d
Give this a better name.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34034
diff
changeset
|
650 | 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
|
651 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
652 | 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
|
653 | if (inuse != fallback) { |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
654 | 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
|
655 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
656 | } else { |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
657 | fallback = NULL; |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
658 | 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
|
659 | } |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
660 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
661 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
662 | 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
|
663 | 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
|
664 | |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
665 | purple_debug_info("keyring", "Keyring %s unregistered.\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
|
666 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
667 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
668 | /*@}*/ |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
669 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
670 | |
|
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 | /** @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
|
673 | /***************************************/ |
|
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 | |
|
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
|
676 | gboolean |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
677 | purple_keyring_import_password(PurpleAccount *account, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
678 | const char *keyringid, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
679 | const char *mode, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
680 | const char *data, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
681 | GError **error) |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
682 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
683 | const PurpleKeyring *inuse; |
|
33971
96eff57a4349
Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33970
diff
changeset
|
684 | PurpleKeyringImportPassword import; |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
685 | const char *realid; |
|
33971
96eff57a4349
Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33970
diff
changeset
|
686 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
687 | 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
|
688 | 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
|
689 | 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
|
690 | 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
|
691 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
692 | 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
|
693 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
694 | if (inuse == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
695 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOKEYRING, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
696 | "No keyring configured, cannot import password info"); |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
697 | 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
|
698 | "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
|
699 | 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
|
700 | return FALSE; |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
701 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
702 | |
|
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
|
703 | 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
|
704 | /* |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
705 | * 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
|
706 | * - 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
|
707 | * - 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
|
708 | */ |
|
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
|
709 | 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
|
710 | (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
|
711 | |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
712 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_INVALID, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
713 | "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
|
714 | 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
|
715 | "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
|
716 | 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
|
717 | return FALSE; |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
718 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
719 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
720 | 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
|
721 | if (import == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
722 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
723 | "Keyring cannot import password info."); |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
724 | purple_debug_info("Keyring", "Configured keyring cannot import password info. This might be normal.\n"); |
|
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
|
725 | return FALSE; |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
726 | } |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
727 | |
|
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
|
728 | 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
|
729 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
730 | |
|
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
|
731 | gboolean |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
732 | purple_keyring_export_password(PurpleAccount *account, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
733 | const char **keyringid, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
734 | const char **mode, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
735 | char **data, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
736 | GError **error, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
737 | GDestroyNotify *destroy) |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
738 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
739 | const PurpleKeyring *inuse; |
|
33971
96eff57a4349
Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33970
diff
changeset
|
740 | PurpleKeyringExportPassword export; |
|
96eff57a4349
Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33970
diff
changeset
|
741 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
742 | 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
|
743 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
744 | if (inuse == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
745 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOKEYRING, |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
746 | "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
|
747 | purple_debug_info("keyring", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
748 | "No keyring configured, cannot export password info.\n"); |
|
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
|
749 | return FALSE; |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
750 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
751 | |
|
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
|
752 | *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
|
753 | |
|
33987
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
754 | 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
|
755 | "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
|
756 | 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
|
757 | 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
|
758 | *keyringid); |
|
9beebdbf44d6
Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33983
diff
changeset
|
759 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
760 | if (*keyringid == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
761 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_INVALID, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
762 | "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
|
763 | purple_debug_info("keyring", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
764 | "Configured keyring does not have a keyring id, cannot export password.\n"); |
|
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
|
765 | return FALSE; |
|
33978
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 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
768 | 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
|
769 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
770 | if (export == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
771 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
772 | "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
|
773 | purple_debug_info("keyring", |
|
34048
2d14a219c886
Make stuff consistent.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34047
diff
changeset
|
774 | "Keyring cannot export password info. This might be normal.\n"); |
|
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
|
775 | return FALSE; |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
776 | } |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
777 | |
|
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
|
778 | 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
|
779 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
780 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
781 | 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
|
782 | 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
|
783 | 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
|
784 | gpointer data) |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
785 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
786 | GError *error = NULL; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
787 | 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
|
788 | PurpleKeyringRead read; |
|
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 | if (account == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
791 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_INVALID, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
792 | "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
|
793 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
794 | if (cb != NULL) |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
795 | 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
|
796 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
797 | 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
|
798 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
799 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
800 | 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
|
801 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
802 | if (inuse == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
803 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOKEYRING, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
804 | "No keyring configured."); |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
805 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
806 | if (cb != NULL) |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
807 | 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
|
808 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
809 | 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
|
810 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
811 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
812 | 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
|
813 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
814 | if (read == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
815 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
816 | "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
|
817 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
818 | if (cb != NULL) |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
819 | 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
|
820 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
821 | 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
|
822 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
823 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
824 | 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
|
825 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
826 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
827 | } |
|
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 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
830 | static void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
831 | purple_keyring_set_password_async_cb(PurpleAccount *account, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
832 | GError *error, |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
833 | 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
|
834 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
835 | 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
|
836 | 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
|
837 | |
|
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
|
838 | 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
|
839 | 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
|
840 | |
|
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
|
841 | 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
|
842 | 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
|
843 | |
|
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
|
844 | 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
|
845 | 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
|
846 | _("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
|
847 | 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
|
848 | } |
|
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
|
849 | |
|
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
|
850 | 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
|
851 | 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
|
852 | 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
|
853 | } |
|
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
|
854 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
855 | void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
856 | 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
|
857 | 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
|
858 | 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
|
859 | gpointer data) |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
860 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
861 | GError *error = NULL; |
|
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
862 | 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
|
863 | PurpleKeyringSave save; |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
864 | PurpleKeyringCbInfo *cbinfo; |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
865 | |
|
33997
035d8594b66a
Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33996
diff
changeset
|
866 | 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
|
867 | |
|
33997
035d8594b66a
Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33996
diff
changeset
|
868 | 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
|
869 | if (inuse == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
870 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOKEYRING, |
|
33997
035d8594b66a
Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33996
diff
changeset
|
871 | "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
|
872 | if (cb != NULL) |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
873 | 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
|
874 | g_error_free(error); |
|
33971
96eff57a4349
Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33970
diff
changeset
|
875 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
876 | } 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
|
877 | 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
|
878 | if (save == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
879 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33997
035d8594b66a
Wrote a caching system that uses account->password to store password.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33996
diff
changeset
|
880 | "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
|
881 | if (cb != NULL) |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
882 | 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
|
883 | 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
|
884 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
885 | } else { |
|
34039
52379a0a335d
Use g_new() where a struct is malloc'd.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34036
diff
changeset
|
886 | 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
|
887 | 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
|
888 | 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
|
889 | 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
|
890 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
891 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
892 | } |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
893 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
894 | void |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
895 | 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
|
896 | { |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
897 | PurpleKeyringClose close; |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
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 | if (keyring == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
900 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_INVALID, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
901 | "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
|
902 | |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
903 | } else { |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
904 | 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
|
905 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
906 | if (close == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
907 | *error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
908 | "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
|
909 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
910 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
911 | close(error); |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
912 | |
|
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 | |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
918 | void |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
919 | purple_keyring_change_master(PurpleKeyringChangeMasterCallback cb, |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
920 | gpointer data) |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
921 | { |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
922 | 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
|
923 | PurpleKeyringChangeMaster change; |
|
34034
f508fa47f2ac
Reformat many things.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34033
diff
changeset
|
924 | 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
|
925 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
926 | inuse = purple_keyring_get_inuse(); |
|
34033
910f2ed3988b
Remove trailing whitespace.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34032
diff
changeset
|
927 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
928 | if (inuse == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
929 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
930 | "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
|
931 | if (cb) |
|
5fcfc69be362
Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33997
diff
changeset
|
932 | 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
|
933 | 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
|
934 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
935 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
936 | 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
|
937 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
938 | if (change == NULL) { |
|
34047
c2e68ddbf27c
Correctly namespace these keyring errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
34046
diff
changeset
|
939 | error = g_error_new(PURPLE_KEYRING_ERROR, PURPLE_KEYRING_ERROR_NOCAP, |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
940 | "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
|
941 | if (cb) |
|
5fcfc69be362
Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33997
diff
changeset
|
942 | 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
|
943 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
944 | 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
|
945 | |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
946 | } else { |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
947 | change(cb, data); |
|
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 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
950 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
951 | } |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
952 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
953 | /*@}*/ |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
954 | |
|
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
955 | |
|
33978
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
956 | /***************************************/ |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
957 | /** @name Error Codes */ |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
958 | /***************************************/ |
|
2c649fae664e
Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33976
diff
changeset
|
959 | /*@{*/ |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
960 | |
|
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
|
961 | 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
|
962 | { |
|
33998
5fcfc69be362
Added support for master password in pidgin's pref interface.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
33997
diff
changeset
|
963 | 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
|
964 | } |
|
33969
cd9387938af8
added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff
changeset
|
965 | |
|
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 |