45 const char *schema =
"BEGIN TRANSACTION; "
47 "CREATE TABLE account ("
48 "email_addr text primary key not null, "
51 "prefer_encrypt int, "
55 "email_addr text primary key not null, "
57 "autocrypt_timestamp int, "
60 "prefer_encrypt int, "
61 "gossip_timestamp int, "
63 "gossip_keydata text);"
65 "CREATE TABLE peer_history ("
66 "peer_email_addr text not null, "
71 "CREATE INDEX peer_history_email "
75 "CREATE TABLE gossip_history ("
76 "peer_email_addr text not null, "
77 "sender_email_addr text, "
80 "gossip_keydata text);"
82 "CREATE INDEX gossip_history_email "
86 "CREATE TABLE schema ("
89 "INSERT into schema (version) values (1);"
93 if (sqlite3_exec(
AutocryptDB, schema, NULL, NULL, &errmsg) != SQLITE_OK)
109 sqlite3_stmt *stmt = NULL;
112 if (sqlite3_prepare_v2(
AutocryptDB,
"SELECT version FROM schema;", -1, &stmt, NULL) != SQLITE_OK)
115 if (sqlite3_step(stmt) != SQLITE_ROW)
118 int version = sqlite3_column_int(stmt, 0);
126 mutt_error(
_(
"Autocrypt database version is too new"));
136 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.