[balsa/autocrypt] minor Autocrypt fixes



commit 24a336ac6d7f1a4e22f04a2ac852d3944d05556e
Author: Albrecht Dreß <albrecht dress arcor de>
Date:   Sat Jan 5 12:50:41 2019 -0500

    minor Autocrypt fixes
    
    * 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
    
    Signed-off-by: Peter Bloomfield <PeterBloomfield bellsouth net>

 ChangeLog            | 12 ++++++++++++
 libbalsa/autocrypt.c |  8 ++++++--
 po/ChangeLog         |  6 ++++++
 po/POTFILES.in       |  1 +
 4 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index da0139b33..968787ed0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2019-01-05  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       minor Autocrypt fixes
+
+       * 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
+
 2018-12-18  Peter Bloomfield  <pbloomfield bellsouth net>
 
        * src/mailbox-conf.c (create_local_mailbox_dialog): avoid
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/ChangeLog b/po/ChangeLog
index 1fdfc5403..f5f7e1ed9 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-05  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       reviewed by: <delete if not using a buddy>
+
+       * POTFILES.in:
+
 2017-09-13  Peter Bloomfield  <pbloomfield bellsouth net>
 
        reviewed by: <delete if not using a buddy>
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]