[Patch] minor Autocrypt fixes
Albrecht Dreß <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.balsa |
|---|---|
| Message-ID | <[email protected]> |
Hi all, first of all, a happy new year to everyone! I promise to keep bothering you with patches in 2019, and here's the first one, fixing a few little issues in the autocrypt branch: - libbalsa/autocrypt.c: * add missing include, required on Debian stretch * make sure the ~/.balsa folder exists before initialising the autocrypt sub-system (otherwise an error is thrown when balsa is started for the first time) * clarify debug messages, indicating if a database entry has actually been changed - po/POTFILES.in: add libbalsa/autocrypt.c Cheers, Albrecht. _______________________________________________ balsa-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/balsa-list
autocrypt-fixes.diff
(text/x-patch, 1.9 KB)
diff --git a/libbalsa/autocrypt.c b/libbalsa/autocrypt.c
index 7c4be82c3..cfcb6aae5 100644
--- a/libbalsa/autocrypt.c
+++ b/libbalsa/autocrypt.c
@@ -24,6 +24,7 @@
#if defined ENABLE_AUTOCRYPT
+#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <sqlite3.h>
@@ -142,6 +143,9 @@ autocrypt_init(GError **error)
gboolean require_init;
int sqlite_res;
+ /* ensure that the config folder exists, otherwise Balsa will throw an error on first use */
+ libbalsa_assure_balsa_dir();
+
db_path = g_build_filename(g_get_home_dir(), ".balsa", "autocrypt.db", NULL);
require_init = (g_access(db_path, R_OK + W_OK) != 0);
sqlite_res = sqlite3_open(db_path, &autocrypt_db);
@@ -828,7 +832,7 @@ add_or_update_user_info(const AutocryptData *user_info, time_t date_header, gboo
g_set_error(error, AUTOCRYPT_ERROR_QUARK, -1, _("%s user “%s” failed: %s"), update ? _("update") : _("insert"),
user_info->addr, sqlite3_errmsg(autocrypt_db));
} else {
- g_debug("%s user '%s'", update ? "updated" : "inserted", user_info->addr);
+ g_debug("%s user '%s': %d", update ? "updated" : "inserted", user_info->addr, sqlite3_changes(autocrypt_db));
}
sqlite3_reset(query[query_idx]);
}
@@ -842,7 +846,7 @@ update_last_seen(const gchar *addr, time_t date_header, GError **error)
(sqlite3_step(query[3]) != SQLITE_DONE)) {
g_set_error(error, AUTOCRYPT_ERROR_QUARK, -1, _("update user “%s” failed: %s"), addr, sqlite3_errmsg(autocrypt_db));
} else {
- g_debug("updated last_seen for '%s'", addr);
+ g_debug("updated last_seen for '%s': %d", addr, sqlite3_changes(autocrypt_db));
}
sqlite3_reset(query[3]);
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c5ed9c68a..633e20790 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -12,6 +12,7 @@ libbalsa/address-book-osmo.c
libbalsa/address-book-vcard.c
libbalsa/address.c
libbalsa/address-view.c
+libbalsa/autocrypt.c
libbalsa/body.c
libbalsa/filter.c
libbalsa/filter-error.c
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlwrdmsACgkQTKlvDmfn 2fhcnAgAh9vY5Qrd0cQT6uxGtgHt9hzKylBbb+qGkeg5FeXXWFqL827ot1lW3RvZ VLSG8RZShSC5iUlA2e1Zu6xWNkbb+2dNGKkaZI1EBggs6WbBXcQ0m0x4GgIr0t8r eGaH38fNoBqdu1kjyQW75vgdNmmZ5VAX+oIqP3LO/9XTrQ9O1Bl5EJFGhqsPLWxW Px28wpfr/5kKHYQsjmCWarGpJQIOKCbjX/Wo6aMiLuEu9bWSOmLtd5eM/QpX+Ump /42TPYdGsilN6n85xuwp/BXIOGxke7HfJs0KiKDZ8WIhAcgsya8S8tZqac8jfmLV /KD1h6mofMAfIoXgIUbxOgh3kE6HIA== =2+k1 -----END PGP SIGNATURE-----