[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-250-g9498ea6

ticho at claws-mail.org ticho at claws-mail.org
Sun Jul 8 16:06:15 CEST 2018


The branch, gtk3 has been updated
       via  9498ea6df433164b6e0e396cad2f3d1ef92628f3 (commit)
       via  d72e497b08685612894ae259612cb2d299817a32 (commit)
       via  bac1a5d035e14498908359f8b745d7b7b2c17c3d (commit)
       via  6e78641b08b5625d8769f0a8f805bda9171249a8 (commit)
       via  ac5ac222b0699494adf727634b25f96d03c9bbaa (commit)
       via  f343a7fe7e3a4eeb90224429943b04a8083bc857 (commit)
       via  382a0b3e279e870ea786af5616998ee6ed10c563 (commit)
       via  9f648f39040a0cca2f8aebb177dd5983c10460cf (commit)
       via  2fe3b379cd67220dcfb2f9ae2d9bc05150288e4b (commit)
       via  5a4e2879f866ba138cb459be6e55b0e3e67e2147 (commit)
       via  e038e256b53afd1b711cca6a52a61d10907bb058 (commit)
       via  c28ed2b99d428e4b363c60afc7fb7721b8b50859 (commit)
      from  2d2a6e37fe885c58792666b8967aea91fee602cc (commit)

Summary of changes:
 src/account.c                         |   15 +++++-
 src/account.h                         |    1 +
 src/common/proxy.c                    |    8 ++--
 src/ldapserver.c                      |   12 +++--
 src/messageview.c                     |   85 +++++++++++++++++++--------------
 src/passwordstore.c                   |   36 ++++++++++++++
 src/passwordstore.h                   |   11 ++++-
 src/plugins/gdata/cm_gdata_contacts.c |   55 ++++++++++++++++-----
 src/plugins/managesieve/claws.def     |    2 +
 src/plugins/managesieve/managesieve.c |    2 +-
 src/plugins/managesieve/sieve_prefs.c |   34 +++++++++----
 src/plugins/pgpcore/claws.def         |   25 +---------
 src/plugins/vcalendar/claws.def       |    2 +
 src/plugins/vcalendar/vcal_folder.c   |    8 +++-
 src/prefs_account.c                   |   54 ++++++++++++++-------
 src/prefs_proxy.c                     |   45 ++++++++++++++---
 16 files changed, 276 insertions(+), 119 deletions(-)


- Log -----------------------------------------------------------------
commit 9498ea6df433164b6e0e396cad2f3d1ef92628f3
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Jul 5 22:27:44 2018 +0200

    Add "Show password" checkbox to each Proxy pref page.

diff --git a/src/prefs_account.c b/src/prefs_account.c
index 25c8569..2672f73 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -2782,7 +2782,7 @@ static void proxy_create_widget_func(PrefsPage * _page,
 	GtkWidget *proxy_frame;
 	GtkWidget *proxy_checkbtn;
 	GtkWidget *default_proxy_checkbtn;
-	GtkWidget *hbox2;
+	GtkWidget *hbox;
 	GtkWidget *label;
 	GtkWidget *socks4_radiobtn;
 	GtkWidget *socks5_radiobtn;
@@ -2792,6 +2792,8 @@ static void proxy_create_widget_func(PrefsPage * _page,
 	GtkWidget *proxy_name_entry;
 	GtkWidget *proxy_pass_entry;
 	GtkWidget *proxy_send_checkbtn;
+	GtkWidget *table;
+	GtkWidget *button;
 	gchar *buf;
 
 	vbox1 = gtk_vbox_new (FALSE, VSPACING);
@@ -2814,56 +2816,72 @@ static void proxy_create_widget_func(PrefsPage * _page,
 	vbox3 = gtk_vbox_new (FALSE, VSPACING_NARROW);
 	gtk_box_pack_start (GTK_BOX (vbox2), vbox3, FALSE, FALSE, 0);
 
-	hbox2 = gtk_hbox_new (FALSE, 8);
-	gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, FALSE, 0);
+	hbox = gtk_hbox_new (FALSE, 8);
+	gtk_box_pack_start (GTK_BOX (vbox3), hbox, FALSE, FALSE, 0);
 
 	socks4_radiobtn = gtk_radio_button_new_with_label(NULL, "SOCKS4");
-	gtk_box_pack_start (GTK_BOX (hbox2), socks4_radiobtn, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox), socks4_radiobtn, FALSE, FALSE, 0);
 	g_object_set_data(G_OBJECT(socks4_radiobtn), MENU_VAL_ID,
 			  GINT_TO_POINTER(PROXY_SOCKS4));
 
-	CREATE_RADIO_BUTTON(hbox2, socks5_radiobtn, socks4_radiobtn, "SOCKS5",
+	CREATE_RADIO_BUTTON(hbox, socks5_radiobtn, socks4_radiobtn, "SOCKS5",
 			    PROXY_SOCKS5);
 
-	hbox2 = gtk_hbox_new (FALSE, 8);
-	gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, FALSE, 0);
+	hbox = gtk_hbox_new (FALSE, 8);
+	gtk_box_pack_start (GTK_BOX (vbox3), hbox, FALSE, FALSE, 0);
 
 	label = gtk_label_new(_("Hostname"));
-	gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
 	proxy_host_entry = gtk_entry_new();
 	gtk_widget_set_size_request(proxy_host_entry, DEFAULT_ENTRY_WIDTH, -1);
-	gtk_box_pack_start(GTK_BOX(hbox2), proxy_host_entry, TRUE, TRUE, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), proxy_host_entry, TRUE, TRUE, 0);
 
 	label = gtk_label_new(_("Port"));
-	gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
 	proxy_port_spinbtn = gtk_spin_button_new_with_range(0, 65535, 1080);
 	gtk_widget_set_size_request(proxy_port_spinbtn, 64, -1);
-	gtk_box_pack_start(GTK_BOX(hbox2), proxy_port_spinbtn, FALSE, FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), proxy_port_spinbtn, FALSE, FALSE, 0);
 
 	vbox4 = gtk_vbox_new (FALSE, VSPACING_NARROW);
 	gtk_box_pack_start(GTK_BOX(vbox3), vbox4, FALSE, FALSE, 0);
 
 	PACK_CHECK_BUTTON (vbox4, proxy_auth_checkbtn, _("Use authentication"));
 
-	hbox2 = gtk_hbox_new (FALSE, 8);
-	gtk_box_pack_start (GTK_BOX (vbox4), hbox2, FALSE, FALSE, 0);
+	table = gtk_table_new(2, 4, FALSE);
+	gtk_box_pack_start (GTK_BOX (vbox4), table, FALSE, FALSE, 0);
 
 	label = gtk_label_new(_("Username"));
-	gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
+			GTK_SHRINK | GTK_FILL,
+			GTK_SHRINK | GTK_FILL, 0, 0);
 
 	proxy_name_entry = gtk_entry_new();
 	gtk_widget_set_size_request(proxy_name_entry, DEFAULT_ENTRY_WIDTH, -1);
-	gtk_box_pack_start(GTK_BOX(hbox2), proxy_name_entry, TRUE, TRUE, 0);
+	gtk_table_attach(GTK_TABLE(table), proxy_name_entry, 1, 2, 0, 1,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
 
 	label = gtk_label_new(_("Password"));
-	gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
+	gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1,
+			GTK_SHRINK | GTK_FILL,
+			GTK_SHRINK | GTK_FILL, 0, 0);
 
 	proxy_pass_entry = gtk_entry_new();
 	gtk_widget_set_size_request(proxy_pass_entry, DEFAULT_ENTRY_WIDTH, -1);
 	gtk_entry_set_visibility(GTK_ENTRY(proxy_pass_entry), FALSE);
-	gtk_box_pack_start(GTK_BOX(hbox2), proxy_pass_entry, TRUE, TRUE, 0);
+	gtk_table_attach(GTK_TABLE(table), proxy_pass_entry, 3, 4, 0, 1,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
+
+	button = gtk_check_button_new_with_label(_("Show password"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
+	gtk_table_attach(GTK_TABLE(table), button, 3, 4, 1, 2,
+			GTK_SHRINK | GTK_FILL,
+			GTK_SHRINK | GTK_FILL, 0, 0);
+	g_signal_connect(G_OBJECT(button), "toggled",
+			G_CALLBACK(prefs_account_showpwd_checkbtn_toggled), proxy_pass_entry);
 
 	gtk_box_pack_start(GTK_BOX(vbox2), gtk_hseparator_new(), FALSE, FALSE, 0);
 
@@ -2872,7 +2890,7 @@ static void proxy_create_widget_func(PrefsPage * _page,
 	CLAWS_SET_TIP(proxy_send_checkbtn,
 			_("If disabled, messages will be sent using direct connection to configured outgoing server, bypassing any configured proxy server."));
 
-	SET_TOGGLE_SENSITIVITY(proxy_auth_checkbtn, hbox2);
+	SET_TOGGLE_SENSITIVITY(proxy_auth_checkbtn, table);
 	SET_TOGGLE_SENSITIVITY(socks5_radiobtn, vbox4);
 	SET_TOGGLE_SENSITIVITY(proxy_checkbtn, vbox2);
 	SET_TOGGLE_SENSITIVITY_REVERSE(default_proxy_checkbtn, vbox3);
diff --git a/src/prefs_proxy.c b/src/prefs_proxy.c
index 1d990f7..617938b 100644
--- a/src/prefs_proxy.c
+++ b/src/prefs_proxy.c
@@ -44,6 +44,8 @@ typedef struct _ProxyPage
 	GtkWidget *proxy_pass_entry;
 } ProxyPage;
 
+static void showpwd_checkbtn_toggled(GtkToggleButton *button,
+		gpointer user_data);
 
 static void prefs_proxy_create_widget(PrefsPage *_page, GtkWindow *window,
 		gpointer data)
@@ -62,6 +64,7 @@ static void prefs_proxy_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkWidget *proxy_name_entry;
 	GtkWidget *proxy_pass_entry;
 	GtkWidget *button;
+	GtkWidget *table;
 	gchar *buf;
 
 	vbox0 = gtk_vbox_new(FALSE, VSPACING);
@@ -111,28 +114,47 @@ static void prefs_proxy_create_widget(PrefsPage *_page, GtkWindow *window,
 
 	PACK_CHECK_BUTTON(vbox2, proxy_auth_checkbtn, _("Use authentication"));
 
-	hbox = gtk_hbox_new(FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
+	table = gtk_table_new(2, 4, FALSE);
+
+	gtk_table_set_row_spacings(GTK_TABLE(table), VSPACING_NARROW);
+	gtk_table_set_col_spacings(GTK_TABLE(table), 9);
+	gtk_box_pack_start(GTK_BOX(vbox2), table, FALSE, FALSE, 0);
 
 	label = gtk_label_new(_("Username"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
+			GTK_SHRINK | GTK_FILL,
+			GTK_SHRINK | GTK_FILL, 0, 0);
 
 	proxy_name_entry = gtk_entry_new();
 	gtk_widget_set_size_request(proxy_name_entry, DEFAULT_ENTRY_WIDTH, -1);
-	gtk_box_pack_start(GTK_BOX(hbox), proxy_name_entry, TRUE, TRUE, 0);
+	gtk_table_attach(GTK_TABLE(table), proxy_name_entry, 1, 2, 0, 1,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
 
 	label = gtk_label_new(_("Password"));
-	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+	gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1,
+			GTK_SHRINK | GTK_FILL,
+			GTK_SHRINK | GTK_FILL, 0, 0);
 
 	proxy_pass_entry = gtk_entry_new();
 	gtk_widget_set_size_request(proxy_pass_entry, DEFAULT_ENTRY_WIDTH, -1);
 	gtk_entry_set_visibility(GTK_ENTRY(proxy_pass_entry), FALSE);
-	gtk_box_pack_start(GTK_BOX(hbox), proxy_pass_entry, TRUE, TRUE, 0);
+	gtk_table_attach(GTK_TABLE(table), proxy_pass_entry, 3, 4, 0, 1,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL,
+			GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
+
+	button = gtk_check_button_new_with_label(_("Show password"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
+	gtk_table_attach(GTK_TABLE(table), button, 3, 4, 1, 2,
+			GTK_SHRINK | GTK_FILL,
+			GTK_SHRINK | GTK_FILL, 0, 0);
+	g_signal_connect(G_OBJECT(button), "toggled",
+			G_CALLBACK(showpwd_checkbtn_toggled), proxy_pass_entry);
 
 	gtk_widget_show_all(vbox0);
 
 	SET_TOGGLE_SENSITIVITY(proxy_checkbtn, vbox1);
-	SET_TOGGLE_SENSITIVITY(proxy_auth_checkbtn, hbox);
+	SET_TOGGLE_SENSITIVITY(proxy_auth_checkbtn, table);
 	SET_TOGGLE_SENSITIVITY(socks5_radiobtn, vbox2);
 
 	/* Set widgets to their correct states, based on prefs. */
@@ -235,3 +257,12 @@ void prefs_proxy_done(void)
 	prefs_gtk_unregister_page((PrefsPage *)prefs_proxy);
 	g_free(prefs_proxy);
 }
+
+static void showpwd_checkbtn_toggled(GtkToggleButton *button,
+    gpointer user_data)
+{
+	gboolean active = gtk_toggle_button_get_active(button);
+	GtkWidget *entry = GTK_WIDGET(user_data);
+
+	gtk_entry_set_visibility(GTK_ENTRY(entry), active);
+}

commit d72e497b08685612894ae259612cb2d299817a32
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Jul 5 09:54:11 2018 +0200

    More Windows build fixes.
    
    Patch by Abhay S. Kushwaha.

diff --git a/src/plugins/managesieve/claws.def b/src/plugins/managesieve/claws.def
index 9a634db..5652381 100644
--- a/src/plugins/managesieve/claws.def
+++ b/src/plugins/managesieve/claws.def
@@ -34,8 +34,10 @@ md5_hex_hmac
 message_search_other
 passcrypt_decrypt
 password_get
+passwd_store_get
 passwd_store_get_account
 passwd_store_set_account
+passwd_store_has_password_account
 prefs_account_get_privacy_prefs
 prefs_account_register_page
 prefs_account_set_privacy_prefs
diff --git a/src/plugins/managesieve/managesieve.c b/src/plugins/managesieve/managesieve.c
index d1cbcc4..c145715 100644
--- a/src/plugins/managesieve/managesieve.c
+++ b/src/plugins/managesieve/managesieve.c
@@ -1006,7 +1006,7 @@ static gint sieve_session_connect(SieveSession *session)
 
 	if (ac->use_proxy) {
 		if (ac->use_default_proxy) {
-			proxy_info = (ProxyInfo *)&(prefs_common.proxy_info);
+			proxy_info = (ProxyInfo *)&(prefs_common_get_prefs()->proxy_info);
 			if (proxy_info->use_proxy_auth)
 				proxy_info->proxy_pass = passwd_store_get(PWS_CORE, PWS_CORE_PROXY,
 					PWS_CORE_PROXY_PASS);

commit bac1a5d035e14498908359f8b745d7b7b2c17c3d
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jul 1 22:07:17 2018 +0200

    Cleanup after moving Managesieve passwords to password store.
    
    Since the password was moved to password store, there is one
    less element in accounts' Managesieve config string. The
    "failed reading Sieve config elements" warning should not be
    printed if it's just password that's missing.

diff --git a/src/plugins/managesieve/sieve_prefs.c b/src/plugins/managesieve/sieve_prefs.c
index bbacb31..63e5dbd 100644
--- a/src/plugins/managesieve/sieve_prefs.c
+++ b/src/plugins/managesieve/sieve_prefs.c
@@ -480,8 +480,9 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
 	gchar enable, use_host, use_port;
 	guchar tls_type, auth, auth_type;
 	gsize len;
+	gint num;
 #if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
-	/* Windows sscanf() does not understand the %ms format yet, so we
+	/* Non-GNU sscanf() does not understand the %ms format, so we
 	 * have to do the allocation of target buffer ourselves before
 	 * calling sscanf(), and copy the host string to config->host.
 	 */
@@ -507,9 +508,9 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
 	enc_userid[0] = '\0';
 	enc_passwd[0] = '\0';
 #if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
-	if (sscanf(confstr, "%c%c %255s %c%hu %hhu %hhu %hhu %255s %255s",
+	if ((num = sscanf(confstr, "%c%c %255s %c%hu %hhu %hhu %hhu %255s %255s",
 #else
-	if (sscanf(confstr, "%c%c %ms %c%hu %hhu %hhu %hhu %255s %255s",
+	if ((num = sscanf(confstr, "%c%c %ms %c%hu %hhu %hhu %hhu %255s %255s",
 #endif
 			&enable, &use_host,
 #if defined(G_OS_WIN32) || defined(__OpenBSD__) || defined(__FreeBSD__)
@@ -522,8 +523,19 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
 			&auth,
 			&auth_type,
 			enc_userid,
-			enc_passwd) != 10)
-		g_warning("failed reading Sieve config elements");
+			enc_passwd)) != 10) {
+			/* This (10th element missing) will happen on any recent
+			 * configuration, where the password is already in
+			 * passwordstore, and not in this config string. We have
+			 * to read the 10th element in order not to break older
+			 * configurations, and to move the password to password
+			 * store.
+			 * If there are not 10 nor 9 elements, something is wrong. */
+		if (num != 9) {
+			g_warning("failed reading Sieve config elements");
+		}
+	}
+	debug_print("Read %d Sieve config elements\n", num);
 
 	/* Scan enums separately, for endian purposes */
 	config->tls_type = tls_type;
@@ -544,8 +556,11 @@ struct SieveAccountConfig *sieve_prefs_account_get_config(
 	}
 
 	config->userid = g_base64_decode(enc_userid, &len);
-	if (enc_passwd[0]) {
-		// migrate password from passcrypt to passwordstore
+
+	/* migrate password from passcrypt to passwordstore, if
+	 * it's not there yet */
+	if (enc_passwd[0] != '\0' &&
+			!passwd_store_has_password_account(account->account_id, "sieve")) {
 		gchar *pass = g_base64_decode(enc_passwd, &len);
 		passcrypt_decrypt(pass, len);
 		passwd_store_set_account(account->account_id, "sieve",
@@ -568,7 +583,7 @@ void sieve_prefs_account_set_config(
 		enc_userid = g_base64_encode(config->userid, len);
 	}
 
-	confstr = g_strdup_printf("%c%c %s %c%hu %hhu %hhu %hhu %s %s",
+	confstr = g_strdup_printf("%c%c %s %c%hu %hhu %hhu %hhu %s",
 			config->enable ? 'y' : 'n',
 			config->use_host ? 'y' : 'n',
 			config->host && config->host[0] ? config->host : "!",
@@ -577,8 +592,7 @@ void sieve_prefs_account_set_config(
 			config->tls_type,
 			config->auth,
 			config->auth_type,
-			enc_userid ? enc_userid : "",
-			"");
+			enc_userid ? enc_userid : "");
 
 	if (enc_userid)
 		g_free(enc_userid);

commit 6e78641b08b5625d8769f0a8f805bda9171249a8
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jul 1 21:56:16 2018 +0200

    Added a password store function to check if a password exists.

diff --git a/src/passwordstore.c b/src/passwordstore.c
index 5709f15..97f44d3 100644
--- a/src/passwordstore.c
+++ b/src/passwordstore.c
@@ -208,6 +208,33 @@ gchar *passwd_store_get(PasswordBlockType block_type,
 	return password;
 }
 
+/* Checks if a password exists in the password store.
+ * No decryption happens. */
+gboolean passwd_store_has_password(PasswordBlockType block_type,
+		const gchar *block_name,
+		const gchar *password_id)
+{
+	PasswordBlock *block;
+
+	g_return_val_if_fail(block_type < NUM_PWS_TYPES, FALSE);
+	g_return_val_if_fail(block_name != NULL, FALSE);
+	g_return_val_if_fail(password_id != NULL, FALSE);
+
+	/* find correct block */
+	if ((block = _get_block(block_type, block_name)) == NULL) {
+		debug_print("Block (%d/%s) not found.\n", block_type, block_name);
+		return FALSE;
+	}
+
+	/* do we have specified password in this block? */
+	if (g_hash_table_lookup(block->entries, password_id) != NULL) {
+		return TRUE; /* yes */
+	}
+
+	return FALSE; /* no */
+}
+
+
 gboolean passwd_store_delete_block(PasswordBlockType block_type,
 		const gchar *block_name)
 {
@@ -250,6 +277,15 @@ gchar *passwd_store_get_account(gint account_id,
 	return ret;
 }
 
+gboolean passwd_store_has_password_account(gint account_id,
+		const gchar *password_id)
+{
+	gchar *uid = g_strdup_printf("%d", account_id);
+	gboolean ret = passwd_store_has_password(PWS_ACCOUNT, uid, password_id);
+	g_free(uid);
+	return ret;
+}
+
 /* Reencrypts all stored passwords. */
 void passwd_store_reencrypt_all(const gchar *old_mpwd,
 		const gchar *new_mpwd)
diff --git a/src/passwordstore.h b/src/passwordstore.h
index aeaa40d..b919820 100644
--- a/src/passwordstore.h
+++ b/src/passwordstore.h
@@ -57,6 +57,12 @@ gchar *passwd_store_get(PasswordBlockType block_type,
 		const gchar *block_name,
 		const gchar *password_id);
 
+/* Returns TRUE if such password exists in the password store,
+ * false otherwise. No decryption happens. */
+gboolean passwd_store_has_password(PasswordBlockType block_type,
+		const gchar *block_name,
+		const gchar *password_id);
+
 gboolean passwd_store_delete_block(PasswordBlockType block_type,
 		const gchar *block_name);
 
@@ -76,7 +82,10 @@ gboolean passwd_store_set_account(gint account_id,
 		const gchar *password_id,
 		const gchar *password,
 		gboolean encrypted);
-gchar *passwd_store_get_account(gint account_id, const gchar *block_name);
+gchar *passwd_store_get_account(gint account_id,
+		const gchar *password_id);
+gboolean passwd_store_has_password_account(gint account_id,
+		const gchar *password_id);
 
 /* Macros for standard, predefined password IDs. */
 #define PWS_ACCOUNT_RECV      "recv"

commit ac5ac222b0699494adf727634b25f96d03c9bbaa
Author: Paul <paul at claws-mail.org>
Date:   Fri Jun 29 18:06:48 2018 +0100

    fix memory leak, and seasoned to suit some tastes

diff --git a/src/messageview.c b/src/messageview.c
index 2c300d6..1cc2981 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -870,10 +870,10 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
 	if (ac_list == NULL) {
 		ac_list = account_find_all();
-		if ((account = select_account_from_list(ac_list,FALSE)) == NULL)
+		if ((account = select_account_from_list(ac_list, FALSE)) == NULL)
 			return -1;
 	} else if (g_list_length(ac_list) > 1) {
-		if ((account = select_account_from_list(ac_list,TRUE)) == NULL)
+		if ((account = select_account_from_list(ac_list, TRUE)) == NULL)
 			return -1;
 	} else if (ac_list != NULL)
 		account = (PrefsAccount *) ac_list->data;
@@ -2077,7 +2077,6 @@ static PrefsAccount *select_account_from_list(GList *ac_list, gboolean has_accou
 	GtkWidget *optmenu;
 	gint account_id;
 	AlertValue val;
-	gchar *text;
 
 	cm_return_val_if_fail(ac_list != NULL, NULL);
 	cm_return_val_if_fail(ac_list->data != NULL, NULL);
@@ -2088,8 +2087,9 @@ static PrefsAccount *select_account_from_list(GList *ac_list, gboolean has_accou
 	if (!optmenu)
 		return NULL;
 	account_id = ((PrefsAccount *) ac_list->data)->account_id;
-	if (has_accounts == FALSE) {
+	if (!has_accounts) {
 		gchar *tr;
+		gchar *text;
 		tr = g_strdup(C_("'%s' stands for 'To' then 'Cc'",
 		    "This message is asking for a return receipt notification\n"
 		    "but according to its '%s' and '%s' headers it was not\n"
@@ -2098,19 +2098,23 @@ static PrefsAccount *select_account_from_list(GList *ac_list, gboolean has_accou
 		text = g_strdup_printf(tr,
 		  prefs_common_translated_header_name("To"),
 		  prefs_common_translated_header_name("Cc"));
+		val = alertpanel_with_widget(
+				_("Return Receipt Notification"),
+				text,
+				_("_Cancel"), _("_Send Notification"), NULL,
+				ALERTFOCUS_FIRST, FALSE, optmenu);
 		g_free(tr);
+		g_free(text);
 	} else
-		text = _("More than one of your accounts uses the "
-			 "address that this message was sent to.\n"
-			 "Please choose which account you want to "
-			 "use for sending the receipt notification:");
-
-	val = alertpanel_with_widget(
-			_("Return Receipt Notification"),
-			text,
-			_("_Cancel"), _("_Send Notification"), NULL, ALERTFOCUS_FIRST,
-			FALSE, optmenu);
-	
+		val = alertpanel_with_widget(
+				_("Return Receipt Notification"),
+				_("More than one of your accounts uses the "
+				 "address that this message was sent to.\n"
+				 "Please choose which account you want to "
+				 "use for sending the receipt notification:"),
+				_("_Cancel"), _("_Send Notification"), NULL,
+				ALERTFOCUS_FIRST, FALSE, optmenu);
+
 	if (val != G_ALERTALTERNATE)
 		return NULL;
 	else

commit f343a7fe7e3a4eeb90224429943b04a8083bc857
Author: Paul <paul at claws-mail.org>
Date:   Fri Jun 29 15:38:33 2018 +0100

    use TRUE/FALSE instead of 1/0

diff --git a/src/messageview.c b/src/messageview.c
index da80622..2c300d6 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -870,10 +870,10 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 
 	if (ac_list == NULL) {
 		ac_list = account_find_all();
-		if ((account = select_account_from_list(ac_list,0)) == NULL)
+		if ((account = select_account_from_list(ac_list,FALSE)) == NULL)
 			return -1;
 	} else if (g_list_length(ac_list) > 1) {
-		if ((account = select_account_from_list(ac_list,1)) == NULL)
+		if ((account = select_account_from_list(ac_list,TRUE)) == NULL)
 			return -1;
 	} else if (ac_list != NULL)
 		account = (PrefsAccount *) ac_list->data;

commit 382a0b3e279e870ea786af5616998ee6ed10c563
Author: Paul <paul at claws-mail.org>
Date:   Fri Jun 29 12:51:24 2018 +0100

    when a return-receipt request is sent to an unknown addr, make the user choose which acc to send from

diff --git a/src/account.c b/src/account.c
index b51e7b8..af3383f 100644
--- a/src/account.c
+++ b/src/account.c
@@ -276,7 +276,20 @@ GList *account_find_all_from_address(GList *ac_list, const gchar *address)
 	}
 	return ac_list;
 }
-	
+
+GList *account_find_all(void)
+{
+	GList *cur;
+	PrefsAccount *ac;
+	GList *ac_list = NULL;
+
+	for (cur = account_list; cur != NULL; cur = cur->next) {
+		ac = (PrefsAccount *)cur->data;
+		ac_list = g_list_append(ac_list, ac);
+	}
+	return ac_list;
+}
+
 PrefsAccount *account_find_from_smtp_server(const gchar *address,
 					    const gchar *smtp_server)
 {
diff --git a/src/account.h b/src/account.h
index 649366b..6d9319a 100644
--- a/src/account.h
+++ b/src/account.h
@@ -48,6 +48,7 @@ void	      account_write_config_all	(void);
 
 GList        *account_find_all_from_address	(GList		*ac_list,
 						 const gchar	*address);
+GList	     *account_find_all		(void);
 PrefsAccount *account_find_from_smtp_server	(const gchar	*address,
 						 const gchar	*smtp_server);
 PrefsAccount *account_find_from_address		(const gchar	*address, gboolean newsgroups_ok);
diff --git a/src/messageview.c b/src/messageview.c
index c0db9b0..da80622 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -167,7 +167,8 @@ static void reply_cb			(GtkAction	*action,
 					 gpointer	 data);
 
 static PrefsAccount *select_account_from_list
-					(GList		*ac_list);
+					(GList		*ac_list,
+					 gboolean	 has_accounts);
 static void addressbook_open_cb		(GtkAction	*action,
 					 gpointer	 data);
 static void add_address_cb		(GtkAction	*action,
@@ -868,32 +869,13 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 	ac_list = account_find_all_from_address(ac_list, msginfo->cc);
 
 	if (ac_list == NULL) {
-		AlertValue val;
-		gchar *tr;
-		gchar *text;
-		tr = g_strdup(C_("'%s' stands for 'To' then 'Cc'",
-		    "This message is asking for a return receipt notification\n"
-		    "but according to its '%s' and '%s' headers it was not\n"
-		    "officially addressed to you.\n"
-		    "It is advised to not send the return receipt."));
-		text = g_strdup_printf(tr,
-		  prefs_common_translated_header_name("To"),
-		  prefs_common_translated_header_name("Cc"));
-		val = alertpanel_full(_("Warning"),
-		  text,
-		  _("_Don't Send"), _("_Send"), NULL, ALERTFOCUS_FIRST, FALSE,
-		  NULL, ALERT_WARNING);
-		g_free(text);
-		g_free(tr);
-		if (val != G_ALERTALTERNATE)
+		ac_list = account_find_all();
+		if ((account = select_account_from_list(ac_list,0)) == NULL)
 			return -1;
-	}
-
-	if (g_list_length(ac_list) > 1) {
-		if ((account = select_account_from_list(ac_list)) == NULL)
+	} else if (g_list_length(ac_list) > 1) {
+		if ((account = select_account_from_list(ac_list,1)) == NULL)
 			return -1;
-	}
-	else if (ac_list != NULL)
+	} else if (ac_list != NULL)
 		account = (PrefsAccount *) ac_list->data;
 	g_list_free(ac_list);
 
@@ -970,7 +952,17 @@ static gint disposition_notification_send(MsgInfo *msginfo)
 		goto FILE_ERROR;
 
 	/* From */
-	if (fprintf(fp, "From: %s\n", msginfo->to) < 0)
+	if (account->name && *account->name) {
+		notification_convert_header(&buf, account->name, strlen("From: "));
+		if (buf == NULL)
+			goto FILE_ERROR;
+		if (fprintf(fp, "From: %s <%s>\n", buf, account->address) < 0) {
+			g_free(buf);
+			goto FILE_ERROR;
+		}
+		g_free(buf);
+		buf = NULL;
+	} else
 		goto FILE_ERROR;
 
 	if (fprintf(fp, "To: %s\n", to) < 0)
@@ -2080,30 +2072,49 @@ static void select_account_cb(GtkWidget *w, gpointer data)
 	*(gint*)data = combobox_get_active_data(GTK_COMBO_BOX(w));
 }
 
-static PrefsAccount *select_account_from_list(GList *ac_list)
+static PrefsAccount *select_account_from_list(GList *ac_list, gboolean has_accounts)
 {
 	GtkWidget *optmenu;
 	gint account_id;
+	AlertValue val;
+	gchar *text;
 
 	cm_return_val_if_fail(ac_list != NULL, NULL);
 	cm_return_val_if_fail(ac_list->data != NULL, NULL);
-	
+
 	optmenu = gtkut_account_menu_new(ac_list,
 			G_CALLBACK(select_account_cb),
 			&account_id);
 	if (!optmenu)
 		return NULL;
 	account_id = ((PrefsAccount *) ac_list->data)->account_id;
-	if (alertpanel_with_widget(
-				_("Return Receipt Notification"),
-				_("More than one of your accounts uses the "
-				  "address that this message was sent to.\n"
-				  "Please choose which account you want to "
-				  "use for sending the receipt notification:"),
-			        _("_Cancel"), _("_Send Notification"), NULL, ALERTFOCUS_FIRST,
-			        FALSE, optmenu) != G_ALERTALTERNATE)
+	if (has_accounts == FALSE) {
+		gchar *tr;
+		tr = g_strdup(C_("'%s' stands for 'To' then 'Cc'",
+		    "This message is asking for a return receipt notification\n"
+		    "but according to its '%s' and '%s' headers it was not\n"
+		    "officially addressed to you.\n"
+		    "It is advised to not send the return receipt."));
+		text = g_strdup_printf(tr,
+		  prefs_common_translated_header_name("To"),
+		  prefs_common_translated_header_name("Cc"));
+		g_free(tr);
+	} else
+		text = _("More than one of your accounts uses the "
+			 "address that this message was sent to.\n"
+			 "Please choose which account you want to "
+			 "use for sending the receipt notification:");
+
+	val = alertpanel_with_widget(
+			_("Return Receipt Notification"),
+			text,
+			_("_Cancel"), _("_Send Notification"), NULL, ALERTFOCUS_FIRST,
+			FALSE, optmenu);
+	
+	if (val != G_ALERTALTERNATE)
 		return NULL;
-	return account_find_from_id(account_id);
+	else
+		return account_find_from_id(account_id);
 }
 
 /* 

commit 9f648f39040a0cca2f8aebb177dd5983c10460cf
Author: Paul <paul at claws-mail.org>
Date:   Fri Jun 29 12:02:22 2018 +0100

    vCalendar: Skip whitespace chars at the beginning of ics stream
    
    patch by Avinash Sonawane

diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
index d4217a1..9f00a9b 100644
--- a/src/plugins/vcalendar/vcal_folder.c
+++ b/src/plugins/vcalendar/vcal_folder.c
@@ -34,6 +34,7 @@
 #include <unistd.h>
 #include <curl/curl.h>
 #include <curl/curlver.h>
+#include <ctype.h>
 
 #include "account.h"
 #include "utils.h"
@@ -1832,7 +1833,12 @@ static void update_subscription_finish(const gchar *uri, gchar *feed, gboolean v
 			g_free(error);
 		return;
 	}
-	if (strncmp(feed, "BEGIN:VCALENDAR", strlen("BEGIN:VCALENDAR"))) {
+
+	gchar *tmp = feed;
+	while (*tmp && isspace((unsigned char)*tmp))
+		tmp++;
+
+	if (strncmp(tmp, "BEGIN:VCALENDAR", strlen("BEGIN:VCALENDAR"))) {
 		gchar *err_msg = _("This URL does not look like a Webcal URL:\n%s\n%s");
 
 		if (verbose && manual_update) {

commit 2fe3b379cd67220dcfb2f9ae2d9bc05150288e4b
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Tue Jun 26 18:21:56 2018 +0200

    Fix build for Windows, plus some missing symbols in claws.def files.
    
    Patches by Abhay S. Kushwaha.

diff --git a/src/common/proxy.c b/src/common/proxy.c
index 9902b0d..e790990 100644
--- a/src/common/proxy.c
+++ b/src/common/proxy.c
@@ -25,11 +25,13 @@
 #ifdef G_OS_WIN32
 #  include <winsock2.h>
 #  include <ws2tcpip.h>
+#  include <stdint.h>
+#else
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <netinet/ip.h>
 #endif
 
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
 #include "proxy.h"
 #include "socket.h"
 #include "utils.h"
diff --git a/src/plugins/pgpcore/claws.def b/src/plugins/pgpcore/claws.def
index 6473112..be6aaf1 100644
--- a/src/plugins/pgpcore/claws.def
+++ b/src/plugins/pgpcore/claws.def
@@ -21,33 +21,10 @@ hooks_register_hook
 hooks_unregister_hook
 get_rc_dir
 get_tmp_file
-gtk_cmclist_append
-gtk_cmclist_clear
-gtk_cmclist_get_row_data
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_get_type
-gtk_cmclist_new_with_titles
-gtk_cmclist_set_column_width
-gtk_cmclist_set_column_width
-gtk_cmclist_set_column_width
-gtk_cmclist_set_column_width
-gtk_cmclist_set_column_width
-gtk_cmclist_set_compare_func
-gtk_cmclist_set_compare_func
-gtk_cmclist_set_row_data_full
-gtk_cmclist_set_selection_mode
-gtk_cmclist_set_sort_type
-gtk_cmclist_sort
 gtkut_get_browse_file_btn
 gtkut_get_options_frame
 gtkut_stock_button_set_create
+gtkut_tree_view_get_selected_pointer
 gtkut_window_new
 input_dialog
 label_window_create
diff --git a/src/plugins/vcalendar/claws.def b/src/plugins/vcalendar/claws.def
index 73c25bc..8bb01be 100644
--- a/src/plugins/vcalendar/claws.def
+++ b/src/plugins/vcalendar/claws.def
@@ -101,6 +101,7 @@ inc_unlock_real
 input_dialog
 is_dir_exist
 list_free_strings
+list_free_strings_full
 log_error
 main_window_cursor_normal
 main_window_cursor_wait
@@ -141,6 +142,7 @@ procmsg_send_message_queue_with_lock
 qp_encode_line
 remove_dir_recursive
 slist_free_strings
+slist_free_strings_full
 statusbar_progress_all
 strcmp2
 strretchomp

commit 5a4e2879f866ba138cb459be6e55b0e3e67e2147
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Tue Jun 26 18:20:26 2018 +0200

    Fix some variable type mismatches in ldapsvr_connect() on Windows.

diff --git a/src/ldapserver.c b/src/ldapserver.c
index 831dd48..98fd9fe 100644
--- a/src/ldapserver.c
+++ b/src/ldapserver.c
@@ -758,6 +758,9 @@ PFldap_start_tls_s Win32_ldap_start_tls_s = NULL;
 LDAP *ldapsvr_connect(LdapControl *ctl) {
 	LDAP *ld = NULL;
 	gint rc;
+#ifndef G_OS_UNIX
+	intptr_t op;
+#endif
 	gint version;
 	gchar *uri = NULL;
 	gchar *pwd;
@@ -794,8 +797,7 @@ LDAP *ldapsvr_connect(LdapControl *ctl) {
 
 		if ((void *)op != LDAP_OPT_ON) {
 			debug_print("Enabling SSL/TLS\n");
-			op = LDAP_OPT_ON;
-			rc = ldap_set_option(ld, LDAP_OPT_SSL, (void *)&op);
+			rc = ldap_set_option(ld, LDAP_OPT_SSL, LDAP_OPT_ON);
 			if (rc != LDAP_SUCCESS) {
 				log_error(LOG_PROTOCOL, _("LDAP error (options): %d (%s)\n"),
 						rc, ldaputil_get_error(ld));
@@ -806,9 +808,9 @@ LDAP *ldapsvr_connect(LdapControl *ctl) {
 					log_error(LOG_PROTOCOL, _("LDAP error (options): %d (%s)\n"),
 							rc, ldaputil_get_error(ld));
 				} else {
-					log_print(LOG_PROTOCOL, _("LDAP (options): SSL/TLS enabled (%d)\n"), op);
+					log_print(LOG_PROTOCOL, _("LDAP (options): SSL/TLS enabled (%d)\n"), (gint)op);
 				}
-				debug_print("SSL/TLS now %d\n", op);
+				debug_print("SSL/TLS now %d\n", (gint)op);
 			}
 		}
 
@@ -857,7 +859,7 @@ LDAP *ldapsvr_connect(LdapControl *ctl) {
 			}
 			debug_print("Setting STARTTLS\n");
 			rc = Win32_ldap_start_tls_s(ld, &serv_rc, NULL, NULL, NULL);
-			debug_print("ldap_start_tls_s: %d server %d %s\n",
+			debug_print("ldap_start_tls_s: %d server %ld %s\n",
 					rc, serv_rc, ldaputil_get_error(ld));
 #else
 			debug_print("Setting STARTTLS\n");

commit e038e256b53afd1b711cca6a52a61d10907bb058
Author: Holger Berndt <hb at claws-mail.org>
Date:   Mon Jun 25 23:22:26 2018 +0200

    GData plugin: Request interactive auth only in case of auth issues
    
    At the same time, make (now potentially ignored) errors more visible
    in the status bar in the same way as background mail fetching errors
    are reported.
    
    Fixes bug #3754
    Modified version of the patch by Viacheslav Gagara on that bug report.

diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c
index e8d1034..1c6ba7d 100644
--- a/src/plugins/gdata/cm_gdata_contacts.c
+++ b/src/plugins/gdata/cm_gdata_contacts.c
@@ -501,6 +501,7 @@ static void cm_gdata_interactive_auth()
 static void cm_gdata_refresh_ready(GDataOAuth2Authorizer *auth, GAsyncResult *res, gpointer data)
 {
   GError *error = NULL;
+  gboolean start_interactive_auth = FALSE;
 
   if(gdata_authorizer_refresh_authorization_finish(GDATA_AUTHORIZER(auth), res, &error) == FALSE)
   {
@@ -508,10 +509,25 @@ static void cm_gdata_refresh_ready(GDataOAuth2Authorizer *auth, GAsyncResult *re
     if(!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
     {
       log_error(LOG_PROTOCOL, _("GData plugin: Authorization refresh error: %s\n"), error->message);
+
+      if(mainwindow_get_mainwindow())
+      {
+        mainwindow_show_error();
+      }
     }
+
+    /* Only start an interactive auth session in case of authorization issues, but not
+     * for e.g. sporadic network issues or other non-authorization-related problems. */
+    start_interactive_auth =
+        g_error_matches(error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED) ||
+        g_error_matches(error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_FORBIDDEN);
+
     g_error_free(error);
 
-    cm_gdata_interactive_auth();
+    if(start_interactive_auth)
+    {
+      cm_gdata_interactive_auth();
+    }
 
     return;
   }

commit c28ed2b99d428e4b363c60afc7fb7721b8b50859
Author: Holger Berndt <hb at claws-mail.org>
Date:   Sun Jun 24 16:16:46 2018 +0200

    GData plugin: Only allow one interactive auth session at a time

diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c
index 342b277..e8d1034 100644
--- a/src/plugins/gdata/cm_gdata_contacts.c
+++ b/src/plugins/gdata/cm_gdata_contacts.c
@@ -458,27 +458,40 @@ static void cm_gdata_auth_ready(GDataOAuth2Authorizer *auth, GAsyncResult *res,
 
 static void cm_gdata_interactive_auth()
 {
-  gchar *auth_uri;
-  gchar *auth_code;
+  static gboolean interactive_auth_running = FALSE;
 
-  log_message(LOG_PROTOCOL, _("GData plugin: Starting interactive authorization\n"));
+  gchar *auth_uri;
 
   auth_uri = gdata_oauth2_authorizer_build_authentication_uri(authorizer, cm_gdata_config.username, FALSE);
   g_return_if_fail(auth_uri);
 
-  auth_code = ask_user_for_auth_code(auth_uri);
-
-  if(auth_code)
+  if(!interactive_auth_running)
   {
-    cm_gdata_contacts_query_running = TRUE;
-    log_message(LOG_PROTOCOL, _("GData plugin: Got authorization code, requesting authorization\n"));
-    gdata_oauth2_authorizer_request_authorization_async(authorizer, auth_code, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
-    memset(auth_code, 0, strlen(auth_code));
-    g_free(auth_code);
+    gchar *auth_code;
+
+    interactive_auth_running = TRUE;
+
+    log_message(LOG_PROTOCOL, _("GData plugin: Starting interactive authorization\n"));
+
+    auth_code = ask_user_for_auth_code(auth_uri);
+
+    if(auth_code)
+    {
+      cm_gdata_contacts_query_running = TRUE;
+      log_message(LOG_PROTOCOL, _("GData plugin: Got authorization code, requesting authorization\n"));
+      gdata_oauth2_authorizer_request_authorization_async(authorizer, auth_code, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
+      memset(auth_code, 0, strlen(auth_code));
+      g_free(auth_code);
+    }
+    else
+    {
+      log_warning(LOG_PROTOCOL, _("GData plugin: No authorization code received, authorization request cancelled\n"));
+    }
+    interactive_auth_running = FALSE;
   }
   else
   {
-    log_warning(LOG_PROTOCOL, _("GData plugin: No authorization code received, authorization request cancelled\n"));
+    log_message(LOG_PROTOCOL, _("GData plugin: Interactive authorization still running, no additional session started\n"));
   }
 
   g_free(auth_uri);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list