49 const char *schema =
"BEGIN TRANSACTION; "
51 "CREATE TABLE account ("
52 "email_addr text primary key not null, "
55 "prefer_encrypt int, "
59 "email_addr text primary key not null, "
61 "autocrypt_timestamp int, "
64 "prefer_encrypt int, "
65 "gossip_timestamp int, "
67 "gossip_keydata text);"
69 "CREATE TABLE peer_history ("
70 "peer_email_addr text not null, "
75 "CREATE INDEX peer_history_email "
79 "CREATE TABLE gossip_history ("
80 "peer_email_addr text not null, "
81 "sender_email_addr text, "
84 "gossip_keydata text);"
86 "CREATE INDEX gossip_history_email "
90 "CREATE TABLE schema ("
93 "INSERT into schema (version) values (1);"
97 if (sqlite3_exec(db, schema, NULL, NULL, &errmsg) != SQLITE_OK)
100 sqlite3_free(errmsg);
113 sqlite3_stmt *stmt = NULL;
118 if (sqlite3_prepare_v2(db,
"SELECT version FROM schema;", -1, &stmt, NULL) != SQLITE_OK)
121 if (sqlite3_step(stmt) != SQLITE_ROW)
124 int version = sqlite3_column_int(stmt, 0);
132 mutt_error(
_(
"Autocrypt database version is too new"));
142 sqlite3_finalize(stmt);
Autocrypt private Module data.
Shared constants/structs that are private to Autocrypt.
Convenience wrapper for the core headers.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
@ MODULE_ID_AUTOCRYPT
ModuleAutocrypt, Autocrypt
Convenience wrapper for the library headers.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
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.
Autocrypt private Module data.
sqlite3 * autocrypt_db
Autocrypt database.
Container for Accounts, Notifications.