libpurple/plugins/keyrings/internalkeyring.c

branch
soc.2008.masterpassword
changeset 34052
709b8f5143fa
parent 34051
07742e8210e2
child 34076
64e389ae5cc3
equal deleted inserted replaced
34051:07742e8210e2 34052:709b8f5143fa
48 #define INTERNALKEYRING_VERSION "0.8b" 48 #define INTERNALKEYRING_VERSION "0.8b"
49 #define INTERNALKEYRING_DESCRIPTION N_("This plugin provides the default password storage behaviour for libpurple. Password will be stored unencrypted.") 49 #define INTERNALKEYRING_DESCRIPTION N_("This plugin provides the default password storage behaviour for libpurple. Password will be stored unencrypted.")
50 #define INTERNALKEYRING_AUTHOR "Scrouaf (scrouaf[at]soc.pidgin.im)" 50 #define INTERNALKEYRING_AUTHOR "Scrouaf (scrouaf[at]soc.pidgin.im)"
51 #define INTERNALKEYRING_ID PURPLE_DEFAULT_KEYRING 51 #define INTERNALKEYRING_ID PURPLE_DEFAULT_KEYRING
52 52
53 #define ACTIVATE()\ 53 #define ACTIVATE() \
54 if (internal_keyring_is_active == FALSE)\ 54 if (internal_keyring_passwords == NULL) \
55 internal_keyring_open(); 55 internal_keyring_open();
56 56
57 static GHashTable *internal_keyring_passwords = NULL; 57 static GHashTable *internal_keyring_passwords = NULL;
58 static PurpleKeyring *keyring_handler = NULL; 58 static PurpleKeyring *keyring_handler = NULL;
59 static gboolean internal_keyring_is_active = FALSE;
60 59
61 /***********************************************/ 60 /***********************************************/
62 /* Keyring interface */ 61 /* Keyring interface */
63 /***********************************************/ 62 /***********************************************/
64 static void 63 static void
65 internal_keyring_open(void) 64 internal_keyring_open(void)
66 { 65 {
67 internal_keyring_passwords = g_hash_table_new_full(g_direct_hash, 66 internal_keyring_passwords = g_hash_table_new_full(g_direct_hash,
68 g_direct_equal, NULL, g_free); 67 g_direct_equal, NULL, g_free);
69 internal_keyring_is_active = TRUE;
70 } 68 }
71 69
72 static void 70 static void
73 internal_keyring_read(PurpleAccount *account, 71 internal_keyring_read(PurpleAccount *account,
74 PurpleKeyringReadCallback cb, 72 PurpleKeyringReadCallback cb,
127 125
128 126
129 static void 127 static void
130 internal_keyring_close(GError **error) 128 internal_keyring_close(GError **error)
131 { 129 {
132 internal_keyring_is_active = FALSE;
133
134 g_hash_table_destroy(internal_keyring_passwords); 130 g_hash_table_destroy(internal_keyring_passwords);
135 internal_keyring_passwords = NULL; 131 internal_keyring_passwords = NULL;
136 } 132 }
137 133
138 static gboolean 134 static gboolean

mercurial