libpurple/keyring.c

Thu, 14 Aug 2008 19:47:00 +0000

author
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
date
Thu, 14 Aug 2008 19:47:00 +0000
branch
soc.2008.masterpassword
changeset 33991
0eb45874d73a
parent 33987
9beebdbf44d6
child 33992
a4299c59c1b0
permissions
-rw-r--r--

Made more calls asynch, enhanced error checking and reporting.

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"
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
36
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
37 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
38 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
39
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
40 static void purple_keyring_pref_cb(const char *, PurplePrefType, gconstpointer, gpointer);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
41 static PurpleKeyring * purple_keyring_find_keyring_by_id(char * id);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
42 static void purple_keyring_drop_passwords(const PurpleKeyring * keyring);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
43 static void purple_keyring_set_inuse_check_error_cb(const PurpleAccount *,GError *,gpointer);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
44 static void purple_keyring_set_inuse_got_pw_cb(PurpleAccount *, gchar *, GError *, gpointer);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
45
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
46
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
47 /******************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
48 /** @name PurpleKeyring */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
49 /******************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
50 /*@{*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
51
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
52 struct _PurpleKeyring
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
53 {
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
54 char * name; // a user friendly 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
55 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
56 PurpleKeyringRead read_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
57 PurpleKeyringSave save_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
58 PurpleKeyringClose close_keyring;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
59 PurpleKeyringChangeMaster change_master;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
60 PurpleKeyringImportPassword import_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
61 PurpleKeyringExportPassword export_password;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
62 PurpleKeyringReadSync read_sync;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
63 PurpleKeyringSaveSync save_sync;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
64 gpointer r1; /* RESERVED */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
65 gpointer r2; /* RESERVED */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
66 gpointer r3; /* RESERVED */
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
67 };
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
68
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
69 struct _PurpleKeyringChangeTracker
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
70 {
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
71 GError * error; /* could probably be dropped */
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
72 PurpleKeyringSetInUseCallback cb;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
73 gpointer data;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
74 const PurpleKeyring * new;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
75 const PurpleKeyring * old; /* we are done when : finished == TRUE && read_outstanding == 0 */
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
76 int read_outstanding;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
77 gboolean finished;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
78 gboolean abort;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
79 gboolean force;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
80 };
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
81
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
82 struct _PurpleKeyringCbInfo
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
83 {
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
84 gpointer cb;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
85 gpointer data;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
86 };
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
87
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
88 /* Constructor */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
89 PurpleKeyring *
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
90 purple_keyring_new()
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
91 {
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
92 return g_malloc0(sizeof(PurpleKeyring));
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
93 }
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 /* Destructor */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
96 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
97 purple_keyring_free(PurpleKeyring * keyring)
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 g_free(keyring);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
100 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
101 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
102
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
103 /* Accessors */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
104 const char *
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
105 purple_keyring_get_name(const PurpleKeyring * keyring)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
106 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
107 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
108
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
109 return keyring->name;
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
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
112 const char *
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
113 purple_keyring_get_id(const PurpleKeyring * keyring)
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
114 {
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
115 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
116
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
117 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
118 }
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
119
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
120 PurpleKeyringRead
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
121 purple_keyring_get_read_password(const PurpleKeyring * keyring)
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 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
124
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
125 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
126 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
127
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
128 PurpleKeyringSave
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
129 purple_keyring_get_save_password(const PurpleKeyring * 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 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
132
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
133 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
134 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
135
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
136 PurpleKeyringReadSync
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
137 purple_keyring_get_read_sync(const PurpleKeyring * keyring)
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 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
140
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
141 return keyring->read_sync;
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
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
144 PurpleKeyringSaveSync
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
145 purple_keyring_get_save_sync(const PurpleKeyring * keyring)
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 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
148
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
149 return keyring->save_sync;
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
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
152 PurpleKeyringClose
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
153 purple_keyring_get_close_keyring(const PurpleKeyring * keyring)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
154 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
155 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
156
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
157 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
158 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
159
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
160 PurpleKeyringChangeMaster
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
161 purple_keyring_get_change_master(const PurpleKeyring * keyring)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
162 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
163 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
164
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
165 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
166 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
167
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
168 PurpleKeyringImportPassword
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
169 purple_keyring_get_import_password(const PurpleKeyring * keyring)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
170 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
171 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
172
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
173 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
174 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
175
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
176 PurpleKeyringExportPassword
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
177 purple_keyring_get_export_password(const PurpleKeyring * keyring)
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 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
180
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
181 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
182 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
183
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
184 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
185 purple_keyring_set_name(PurpleKeyring * keyring, char * name)
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 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
188
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
189 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
190 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
191
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
192 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
193 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
194
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
195 void
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
196 purple_keyring_set_id(PurpleKeyring * keyring, char * 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
197 {
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
198 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
199
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
200 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
201 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
202
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
203 return;
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
204 }
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
205
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
206 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
207 purple_keyring_set_read_password(PurpleKeyring * keyring, PurpleKeyringRead read)
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->read_password = read;
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 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
214 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
215
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
216 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
217 purple_keyring_set_save_password(PurpleKeyring * keyring, PurpleKeyringSave save)
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 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
220
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
221 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
222
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
223 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
224 }
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 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
227 purple_keyring_set_read_sync(PurpleKeyring * keyring, PurpleKeyringReadSync read)
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 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
230
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
231 keyring->read_sync = read;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
232
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
233 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
234 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
235
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
236 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
237 purple_keyring_set_save_sync(PurpleKeyring * keyring, PurpleKeyringSaveSync save)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
238 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
239 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
240
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
241 keyring->save_sync = save;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
242
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
243 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
244 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
245
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
246 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
247 purple_keyring_set_close_keyring(PurpleKeyring * keyring, PurpleKeyringClose close)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
248 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
249 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
250
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
251 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
252
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
253 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
254 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
255
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
256 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
257 purple_keyring_set_change_master(PurpleKeyring * keyring, PurpleKeyringChangeMaster change)
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 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
260
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
261 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
262
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
263 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
264 }
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 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
267 purple_keyring_set_import_password(PurpleKeyring * keyring, PurpleKeyringImportPassword import)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
268 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
269 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
270
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
271 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
272
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
273 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
274 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
275
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
276 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
277 purple_keyring_set_export_password(PurpleKeyring * keyring, PurpleKeyringExportPassword export)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
278 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
279 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
280
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
281 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
282
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
283 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
284 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
285
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
286 /*@}*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
287
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
288
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
289 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
290 /** @name Keyring API */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
291 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
292 /*@{*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
293
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
294 static GList * purple_keyring_keyrings; /* list of available keyrings */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
295 static const PurpleKeyring * purple_keyring_inuse; /* keyring being used */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
296 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
297 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
298
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
299 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
300 purple_keyring_init()
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 PurpleCore * core;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
303 const char * touse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
304
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
305 /* 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
306 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
307 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
308
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
309 /* register signals */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
310 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
311
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
312 purple_signal_register(core, "keyring-register",
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
313 purple_marshal_VOID__POINTER_POINTER,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
314 NULL, 2,
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
315 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
316 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
317
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
318 purple_signal_register(core, "keyring-unregister",
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
319 purple_marshal_VOID__POINTER_POINTER,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
320 NULL, 2,
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
321 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
322 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
323
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
324 /* 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
325 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
326
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
327 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
328 purple_prefs_add_none("/purple/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
329 purple_prefs_add_string("/purple/keyring/active", FALLBACK_KEYRING);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
330 purple_keyring_to_use = g_strdup(FALLBACK_KEYRING);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
331
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
332 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
333
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
334 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
335 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
336
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
337 purple_keyring_pref_cb_id = purple_prefs_connect_callback(NULL,
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
338 "/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
339
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
340 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
341 purple_keyring_to_use);
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
342
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
343 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
344 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
345
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
346 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
347 purple_keyring_uninit()
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
348 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
349 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
350 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
351 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
352
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
353 static PurpleKeyring *
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
354 purple_keyring_find_keyring_by_id(char * id)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
355 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
356 GList * l;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
357 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
358 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
359
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
360 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
361 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
362 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
363
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
364 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
365 return keyring;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
366 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
367
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
368 return NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
369 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
370
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
371 const GList *
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
372 purple_keyring_get_keyrings()
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
373 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
374 return purple_keyring_keyrings;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
375 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
376
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
377 const PurpleKeyring *
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
378 purple_keyring_get_inuse()
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
379 {
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
380 return purple_keyring_inuse;
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
381 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
382
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
383
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
384 /* fire and forget */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
385 static void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
386 purple_keyring_drop_passwords(const PurpleKeyring * keyring)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
387 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
388 GList * cur;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
389 PurpleKeyringSave save;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
390
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
391 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
392
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
393 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
394
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
395 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
396 cur != NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
397 cur = cur->next)
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
398 save(cur->data, NULL, 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
399
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
400 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
401 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
402
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
403
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
404
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
405 static 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
406 purple_keyring_set_inuse_check_error_cb(const PurpleAccount * account,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
407 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
408 gpointer data)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
409 {
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
410
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
411 const char * name;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
412 PurpleKeyringClose close;
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
413 struct _PurpleKeyringChangeTracker * tracker;
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
414
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
415 tracker = (PurpleKeyringChangeTracker *)data;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
416
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
417 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
418
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
419 tracker->read_outstanding--;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
420
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
421 name = purple_account_get_username(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
422
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
423
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
424 if ((error != NULL) && (error->domain == ERR_PIDGINKEYRING)) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
425
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
426 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
427
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
428 switch(error->code) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
429
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
430 case ERR_NOCAP :
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
431 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
432 "Keyring could not save password for account %s : %s\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
433 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
434 break;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
435
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
436 case ERR_NOPASSWD :
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
437 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
438 "No password found while changing keyring for account %s : %s\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
439 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
440 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
441
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
442 case ERR_NOCHANNEL :
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
443 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
444 "Failed to communicate with backend while changing keyring for account %s : %s Aborting changes.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
445 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
446 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
447 break;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
448
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
449 default :
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
450 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
451 "Unknown error while changing keyring for account %s : %s\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
452 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
453 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
454 }
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 }
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
456 /* 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
457 if (tracker->finished == TRUE && tracker->read_outstanding == 0) {
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
458
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
459 if (tracker->abort == TRUE && tracker->force == FALSE) {
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
460
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
461 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
462 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
463
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
464 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
465
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
466 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
467 if (close != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
468 close(NULL);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
469
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
470 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
471 "Failed to change keyring, aborting");
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
472
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
473 /**
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
474 * FIXME : call purple_notify()
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
475 */
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
476 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
477 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
478 purple_keyring_get_id(tracker->old));
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
479 purple_keyring_pref_cb_id = purple_prefs_connect_callback(NULL,
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
480 "/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
481
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
482
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
483 } else {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
484 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
485 if (close != NULL)
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
486 close(&error);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
487
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
488 purple_keyring_inuse = tracker->new;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
489 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
490
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
491 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
492 "Successfully changed keyring.\n");
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
493
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
494 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
495 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
496 }
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
497
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
498 g_free(tracker);
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
499 }
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
500 /**
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
501 * This is kind of hackish. It will schedule an account save,
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
502 * and then return because account == NULL.
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
503 * 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
504 * 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
505 * 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
506 */
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
507 purple_account_set_password_async(NULL, NULL, NULL, NULL, NULL);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
508
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
509 return;
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
510 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
511
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
512
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
513 static void
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
514 purple_keyring_set_inuse_got_pw_cb(PurpleAccount * account,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
515 gchar * password,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
516 GError * error,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
517 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
518 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
519 const PurpleKeyring * new;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
520 PurpleKeyringSave save;
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
521 PurpleKeyringChangeTracker * tracker;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
522
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
523 tracker = (PurpleKeyringChangeTracker *)data;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
524 new = tracker->new;
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
525
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
526 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
527
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
528 if (error != NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
529
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
530 if (error->code == ERR_NOPASSWD ||
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
531 error->code == ERR_NOACCOUNT ||
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
532 tracker->force == TRUE) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
533
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
534 /* 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
535 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
536
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
537 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
538
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
539 /* 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
540 tracker->abort = TRUE;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
541 }
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
542
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
543 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
544
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
545
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
546 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
547
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
548 if (save != NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
549 /* 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
550 * 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
551 * 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
552 */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
553 save(account, password, NULL,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
554 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
555
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
556 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
557 error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
558 "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
559 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
560 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
561 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
562 }
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
563
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
564 return;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
565 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
566
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
567
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
568
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
569
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
570 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
571 purple_keyring_set_inuse(const PurpleKeyring * newkeyring,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
572 gboolean force,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
573 PurpleKeyringSetInUseCallback cb,
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
574 gpointer 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 GList * cur;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
577 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
578 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
579 PurpleKeyringClose close;
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
580 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
581 GError * error = NULL;
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
582
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
583 if (newkeyring != NULL)
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
584 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
585 newkeyring->id);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
586 else
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
587 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
588
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
589 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
590
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
591 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
592 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
593
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
594 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
595 /*
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
596 error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
597 "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
598 */
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
599 purple_debug_info("keyring", "Existing keyring cannot read passwords");
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
600
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
601 /* 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
602 * read passwords, so there no point in copying them.
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
603 * therefore we just cleanup the old and setup the new
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
604 * 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
605 */
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
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 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
608
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
609 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
610
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 if (close != 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
612 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
613
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
614 } else {
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
615 tracker = g_malloc(sizeof(PurpleKeyringChangeTracker));
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
616 oldkeyring = purple_keyring_get_inuse();
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
617
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
618 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
619 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
620 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
621 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
622 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
623 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
624 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
625 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
626 tracker->error = NULL;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
627
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
628 for (cur = purple_accounts_get_all();
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
629 (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
630 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
631
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
632 tracker->read_outstanding++;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
633
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
634 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
635 tracker->finished = TRUE;
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
636
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
637 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
638 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
639 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
640
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
641 } 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
642 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
643 newkeyring->id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
644 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
645
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
646 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
647 cb(newkeyring, TRUE, NULL, data);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
648
33973
b193c0e9044b Fixed problem in async purple_peyring_set_inuse()
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33972
diff changeset
649 return;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
650 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
651 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
652
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
653
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
654
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
655 static 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
656 purple_keyring_pref_cb(const char *pref,
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
657 PurplePrefType type,
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
658 gconstpointer 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
659 gpointer 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
660 {
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
661 PurpleKeyring * new;
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
662
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
663 g_return_if_fail(g_strcmp0(pref, "/purple/keyring/active") == 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
664 g_return_if_fail(type == PURPLE_PREF_STRING);
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
665 g_return_if_fail(id != 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
666
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
667 new = purple_keyring_get_keyring_by_id(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
668 g_return_if_fail(new != 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
669
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
670 purple_keyring_set_inuse(new, FALSE, NULL, 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
671
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
672 return;
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
673 }
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
674
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
675 GList *
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
676 purple_keyring_get_options()
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
677 {
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
678 const GList * 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
679 PurpleKeyring * keyring;
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
680 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
681
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
682 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
683 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
684 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
685
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
686 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
687 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
688 list = g_list_append(list, keyring->id);
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
689 purple_debug_info("keyring", "adding pair : %s, %s.\n",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
690 keyring->name, keyring->id);
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
691 }
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
692
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
693 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
694 }
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
695
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
696 PurpleKeyring *
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
697 purple_keyring_get_keyring_by_id(const char * 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
698 {
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 const GList * 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
700 PurpleKeyring * keyring;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
701
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
702 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
703 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
704 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
705
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
706 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
707 if (g_strcmp0(id, keyring->id) == 0)
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
708 return keyring;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
709
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
710 }
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
711 return NULL;
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
712 }
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
713
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
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
715
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
716 void
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 purple_keyring_register(PurpleKeyring * keyring)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
718 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
719 const char * keyring_id;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
720 PurpleCore * core;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
721
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
722 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
723
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
724 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
725
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
726 /* 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
727 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
728
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
729
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
730 purple_debug_info("keyring", "Registering keyring : %s\n",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
731 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
732
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
733 /* 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
734 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
735 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
736
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
737 purple_debug_info("keyring", "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
738 keyring->id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
739 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
740
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
741 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
742
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
743 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
744
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
745 purple_signal_emit(core, "keyring-register", keyring_id, keyring);
33982
58a0de711782 Added support for the PURPLE_PLUGIN_FLAG_AUTOLOAD flag, corrected a few bugs and crashed. The compatibility plugin is automatically loaded at startup, and works nicely in compatibility mode (read_sync, write_sync, import, export). Also, I played unsuccessfully with makefiles, so i moved the keyring up one directory. I've finally gotten to the point where I run "make && sudo make install" every now and then.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33981
diff changeset
746 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
747
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
748 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
749 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
750 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
751
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
752
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
753 void
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
754 purple_keyring_unregister(PurpleKeyring * keyring)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
755 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
756 PurpleCore * core;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
757 const PurpleKeyring * inuse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
758 PurpleKeyring * fallback;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
759 const char * keyring_id;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
760
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
761 g_return_if_fail(keyring != NULL);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
762
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",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
764 "Unregistering keyring %s",
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
765 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
766
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
767 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
768 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
769 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
770
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
771 inuse = purple_keyring_get_inuse();
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
772 fallback = purple_keyring_find_keyring_by_id(FALLBACK_KEYRING);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
773
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
774 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
775 if (inuse != fallback) {
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
776 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
777
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
778 } else {
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
779 fallback = NULL;
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
780 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
781 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
782 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
783
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
784 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
785 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
786
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
787 purple_debug_info("keyring", "Keyring %s unregistered", keyring->id);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
788 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
789
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
790
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
791 /*@}*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
792
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 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
795 /** @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
796 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
797 /*@{*/
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
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
800 gboolean
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
801 purple_keyring_import_password(PurpleAccount * account,
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
802 char * keyringid,
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
803 char * mode,
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
804 char * data,
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
805 GError ** error)
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
806 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
807 const PurpleKeyring * inuse;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
808 PurpleKeyringImportPassword import;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
809 const char * realid;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
810
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
811 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
812 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
813 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
814 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
815
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
816 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
817
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
818 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
819 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOKEYRING,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
820 "No keyring configured, cannot import password info");
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
821 purple_debug_info("Keyring",
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
822 "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
823 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
824 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
825 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
826
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
827 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
828 /*
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
829 * 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
830 * - 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
831 * - 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
832 */
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
833 if ((keyringid != NULL && g_strcmp0(realid, keyringid) != 0) ||
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
834 (keyringid == NULL && g_strcmp0(FALLBACK_KEYRING, realid))) {
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
835
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
836 *error = g_error_new(ERR_PIDGINKEYRING , ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
837 "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
838 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
839 "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
840 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
841 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
842 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
843
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
844 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
845 if (import == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
846 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
847 "Keyring cannot import password info.");
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
848 purple_debug_info("Keyring", "Configured keyring cannot import password info. This might be normal.");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
849 return FALSE;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
850 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
851
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
852 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
853 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
854
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
855 gboolean
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
856 purple_keyring_export_password(PurpleAccount * account,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
857 const char ** keyringid,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
858 const char ** mode,
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
859 char ** 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
860 GError ** error,
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
861 GDestroyNotify * destroy)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
862 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
863 const PurpleKeyring * inuse;
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
864 PurpleKeyringExportPassword export;
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
865
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
866 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
867
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
868 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
869 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOKEYRING,
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
870 "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
871 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
872 "No keyring configured, cannot export password info");
33983
317cd0a252c2 Fixed a bunch of bugs/errors, worked on making calls async, on configuration UI, and on Makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33982
diff changeset
873 return FALSE;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
874 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
875
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
876 *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
877
33987
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
878 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
879 "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
880 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
881 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
882 *keyringid);
9beebdbf44d6 Fixed many bugs and crashes in the keyring subsystem.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33983
diff changeset
883
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
884 if (*keyringid == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
885 *error = g_error_new(ERR_PIDGINKEYRING , ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
886 "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
887 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
888 "Configured keyring does not have a keyring id, cannot export password");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
889 return FALSE;
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 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
893
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
894 if (export == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
895 *error = g_error_new(ERR_PIDGINKEYRING , ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
896 "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
897 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
898 "Keyring cannot export password info. This might be normal");
33981
8c8fe2e5bbcd dded import/export in account.c, new version of internalkeyring.c, and added stuff to makefiles.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33978
diff changeset
899 return FALSE;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
900 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
901
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
902 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
903 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
904
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
905
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
906 /**
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
907 * This should be renamed purple_keyring_get_password() when getting
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
908 * to 3.0, while dropping purple_keyring_get_password_sync().
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 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
911 purple_keyring_get_password_async(PurpleAccount * account,
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
912 PurpleKeyringReadCallback cb,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
913 gpointer data)
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 GError * error = NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
916 const PurpleKeyring * inuse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
917 PurpleKeyringRead read;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
918
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
919 if (account == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
920 error = g_error_new(ERR_PIDGINKEYRING, ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
921 "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
922
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
923 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
924 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
925
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
926 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
927
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
928 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
929 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
930
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
931 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
932 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOKEYRING,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
933 "No keyring configured.");
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 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
936 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
937
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
938 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
939
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
940 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
941 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
942
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
943 if (read == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
944 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
945 "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
946
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
947 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
948 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
949
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
950 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
951
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
952 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
953 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
954 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
955 }
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
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
958 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
959 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
960
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
961 /**
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
962 * This should be renamed purple_keyring_set_password() when getting
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
963 * to 3.0, while dropping purple_keyring_set_password_sync().
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
964 */
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
965 void
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
966 purple_keyring_set_password_async(const PurpleAccount * account,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
967 gchar * password,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
968 GDestroyNotify destroypassword,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
969 PurpleKeyringSaveCallback cb,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
970 gpointer data)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
971 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
972 GError * error = NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
973 const PurpleKeyring * inuse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
974 PurpleKeyringSave save;
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
975 PurpleKeyringCbInfo * cbinfo;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
976
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
977 if (account == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
978 error = g_error_new(ERR_PIDGINKEYRING, ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
979 "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
980
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
981 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
982 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
983
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
984 g_error_free(error);
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
985
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
986 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
987 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
988
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
989 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
990 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOKEYRING,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
991 "No keyring configured.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
992
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
993 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
994 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
995
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
996 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
997
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
998 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
999 save = purple_keyring_get_save_password(inuse);
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1000
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1001 if (save == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1002 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1003 "Keyring cannot save password.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1004
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1005 if (cb != NULL)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1006 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
1007
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1008 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
1009
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1010 } else {
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1011 cbinfo->cb = cb;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1012 cbinfo->data = data;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1013 save(account, password, destroypassword,
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1014 purple_keyring_set_password_async, data);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1015 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1016 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1017 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1018
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1019 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1020 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1021
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1022 void
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1023 purple_keyring_set_password_async_cb(PurpleAccount * account,
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1024 GError * error,
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1025 gpointer data)
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1026 {
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1027 PurpleKeyringCbInfo * cbinfo = data;
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1028 PurpleKeyringSaveCallback cb = cbinfo->cb;
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1029
33991
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1030 if (error != NULL) {
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1031 /* FIXME : purple_notify_warning() */
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1032 }
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1033
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1034 if (cb != NULL)
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1035 cb(account, error, cbinfo->data);
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1036 g_free(data);
0eb45874d73a Made more calls asynch, enhanced error checking and reporting.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33987
diff changeset
1037 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1038 /**
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1039 * This should be dropped at 3.0 (it's here for compatibility)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1040 */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1041 const char *
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1042 purple_keyring_get_password_sync(const PurpleAccount * account)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1043 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1044 PurpleKeyringReadSync read;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1045 const PurpleKeyring * inuse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1046
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1047 if (account == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1048 return NULL;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1049
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1050 } else {
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
1051
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1052 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
1053
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1054 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1055
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1056 return NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1057
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1058 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1059
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
1060 read = purple_keyring_get_read_sync(inuse);
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1061
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1062 if (read == NULL){
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1063
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1064 return NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1065
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1066 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1067
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1068 return read(account);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1069
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1070 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1071 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1072 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1073 }
33971
96eff57a4349 Fixed warnings
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33970
diff changeset
1074
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1075 /**
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1076 * This should be dropped at 3.0 (it's here for compatibility)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1077 */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1078 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1079 purple_keyring_set_password_sync(PurpleAccount * account,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1080 const char *password)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1081 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1082 PurpleKeyringSaveSync save;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1083 const PurpleKeyring * inuse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1084
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1085 if (account != NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1086
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1087 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
1088
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1089 if (inuse != NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1090
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1091 save = purple_keyring_get_save_sync(inuse);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1092
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1093 if (save != NULL){
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1094
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1095 return save(account, password);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1096
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1097 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1098 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1099 }
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1100
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1101 return;
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1102 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1103
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1104 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1105 purple_keyring_close(PurpleKeyring * keyring,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1106 GError ** error)
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1107 {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1108 PurpleKeyringClose close;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1109
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1110 if (keyring == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1111 *error = g_error_new(ERR_PIDGINKEYRING, ERR_INVALID,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1112 "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
1113
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1114 return;
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1115
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1116 } else {
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1117 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
1118
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1119 if (close == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1120 *error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1121 "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
1122
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1123 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1124 close(error);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1125
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1126 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1127 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1128
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1129 return;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1130 }
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1131
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1132
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1133 void
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1134 purple_keyring_change_master(PurpleKeyringChangeMasterCallback cb,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1135 gpointer data)
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1136 {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1137 GError * error = NULL;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1138 PurpleKeyringChangeMaster change;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1139 const PurpleKeyring * inuse;
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1140
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1141 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
1142
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1143 if (inuse == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1144 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1145 "Keyring doesn't support master passwords.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1146
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1147 cb(FALSE, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1148
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1149 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
1150
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1151 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1152
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1153 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
1154
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1155 if (change == NULL) {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1156 error = g_error_new(ERR_PIDGINKEYRING, ERR_NOCAP,
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1157 "Keyring doesn't support master passwords.");
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1158
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1159 cb(FALSE, error, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1160
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1161 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
1162
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1163 } else {
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1164 change(cb, data);
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1165
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1166 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1167 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1168 return;
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1169 }
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1170
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1171 /*@}*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1172
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1173
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1174 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1175 /** @name Error Codes */
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1176 /***************************************/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1177 /*@{*/
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1178
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
1179 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
1180 {
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
1181 return g_quark_from_static_string("Libpurple keyring");
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
1182 }
33969
cd9387938af8 added files that were'nt in workspace
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents:
diff changeset
1183
33978
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1184 /*}@*/
2c649fae664e Final version of the API, corrected, cleaned, and documented.
Vivien Bernet-Rollande <scrouaf@soc.pidgin.im>
parents: 33976
diff changeset
1185

mercurial