44 const char *schema =
"BEGIN TRANSACTION; "
46 "CREATE TABLE account ("
47 "email_addr text primary key not null, "
50 "prefer_encrypt int, "
54 "email_addr text primary key not null, "
56 "autocrypt_timestamp int, "
59 "prefer_encrypt int, "
60 "gossip_timestamp int, "
62 "gossip_keydata text);"
64 "CREATE TABLE peer_history ("
65 "peer_email_addr text not null, "
70 "CREATE INDEX peer_history_email "
74 "CREATE TABLE gossip_history ("
75 "peer_email_addr text not null, "
76 "sender_email_addr text, "
79 "gossip_keydata text);"
81 "CREATE INDEX gossip_history_email "
85 "CREATE TABLE schema ("
88 "INSERT into schema (version) values (1);"
92 if (sqlite3_exec(
AutocryptDB, schema, NULL, NULL, &errmsg) != SQLITE_OK)
108 sqlite3_stmt *stmt = NULL;
111 if (sqlite3_prepare_v2(
AutocryptDB,
"SELECT version FROM schema;", -1, &stmt, NULL) != SQLITE_OK)
114 if (sqlite3_step(stmt) != SQLITE_ROW)
117 int version = sqlite3_column_int(stmt, 0);
125 mutt_error(
_(
"Autocrypt database version is too new"));
135 sqlite3_finalize(stmt);
sqlite3 * AutocryptDB
Handle to the open Autocrypt database.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
Convenience wrapper for the library headers.
int mutt_autocrypt_schema_update(void)
Update the version number of the Autocrypt database schema.
int mutt_autocrypt_schema_init(void)
Set up an Autocrypt database.