[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-615-g5ae1141

ticho at claws-mail.org ticho at claws-mail.org
Fri Feb 8 21:30:40 CET 2019


The branch, gtk3 has been updated
       via  5ae1141fe8fa4a53fb57f160f9f00c89678e1a60 (commit)
       via  bd8cc4f522360cf7010316d028decb921a841d77 (commit)
       via  8c320850024aee644fcb6d4f9ae564abcf1488e9 (commit)
       via  84af95468c04456d89002ccf42b4fe56d3ce8b0a (commit)
       via  577c2d3a4da4238b43f9aa4bcb6c9363b61748dc (commit)
       via  b53607c2fa9977c33ba77e237be7550353396b8e (commit)
       via  3166cdab193fb24aa2d8a82c2686361e3e3275a9 (commit)
       via  e6a6008a144604ffc77613d7caa55532fa9a0eaf (commit)
       via  bdc4080ad4250eab3c2184806c9fe29aaef27e39 (commit)
       via  8eee8f13df0325b9c75bb062246d619da9066276 (commit)
       via  e7c4908bd2c86b302d5fe58877297ae1fcfefe23 (commit)
       via  e243f0fd1705a03b8f507750e8a4849b24d0f28d (commit)
       via  fe3595020e736b5866581dadc3ebee9b8a970fc7 (commit)
       via  021f303fef328e0ea788b3bb0262ab6602cb118f (commit)
       via  a05fe7ad8f96cfbd075dacca9fb9a58b0e66ea43 (commit)
       via  562f0293a833cbef00db1f8e87886acc2ff170c4 (commit)
      from  831126c3a1b3bd63e740bfb8ef1171220fbc6e3e (commit)

Summary of changes:
 configure.ac                                |    2 +-
 src/addrindex.c                             |    4 ++
 src/common/Makefile.am                      |    2 +-
 src/common/pkcs5_pbkdf2.c                   |   24 ++++----
 src/common/session.c                        |    5 +-
 src/common/socket.c                         |   25 +++++---
 src/common/utils.c                          |   16 +++--
 src/common/utils.h                          |    6 ++
 src/common/w32_stdio.c                      |   34 -----------
 src/common/w32_unistd.c                     |    2 +-
 src/main.c                                  |   10 +++-
 src/mainwindow.c                            |   43 ++++++++++++++
 src/matcher.c                               |    2 +-
 src/mh.c                                    |    2 +-
 src/plugins/libravatar/libravatar_missing.c |    6 +-
 src/plugins/pgpcore/sgpgme.c                |    2 +-
 src/plugins/rssyl/parse822.c                |    2 +-
 src/plugins/rssyl/rssyl.c                   |    4 +-
 src/plugins/rssyl/rssyl_add_item.c          |    6 +-
 src/plugins/vcalendar/vcal_folder.c         |   11 ++--
 src/plugins/vcalendar/vcal_manager.c        |    2 +-
 src/plugins/vcalendar/vcal_meeting_gtk.c    |    2 +-
 src/prefs_display_header.c                  |   84 +++++++++++++--------------
 src/prefs_summaries.c                       |   12 ++++
 24 files changed, 179 insertions(+), 129 deletions(-)
 delete mode 100644 src/common/w32_stdio.c


- Log -----------------------------------------------------------------
commit 5ae1141fe8fa4a53fb57f160f9f00c89678e1a60
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Feb 8 19:49:27 2019 +0100

    Fix a small memory leak in rssyl_remove_msgs()

diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
index 7b0938c..fdd1816 100644
--- a/src/plugins/rssyl/rssyl.c
+++ b/src/plugins/rssyl/rssyl.c
@@ -873,7 +873,6 @@ static gint rssyl_remove_msgs(Folder *folder, FolderItem *item,
 {
 	gboolean need_scan = FALSE;
 	MsgInfoList *cur;
-	gchar *file;
 	gint processed = 0;
 
 	RFolderItem *ritem = (RFolderItem *)item;
@@ -885,6 +884,7 @@ static gint rssyl_remove_msgs(Folder *folder, FolderItem *item,
 	rssyl_deleted_update(ritem);
 
 	for (cur = msglist; cur != NULL; cur = cur->next) {
+		gchar *file;
 		MsgInfo *msginfo = (MsgInfo *)cur->data;
 
 		if (msginfo == NULL)
@@ -898,9 +898,9 @@ static gint rssyl_remove_msgs(Folder *folder, FolderItem *item,
 
 		if (claws_unlink(file) < 0) {
 			FILE_OP_ERROR(file, "unlink");
-			g_free(file);
 		}
 
+		g_free(file);
 		processed++;
 	}
 

commit bd8cc4f522360cf7010316d028decb921a841d77
Author: Paul <paul at claws-mail.org>
Date:   Tue Jan 29 13:30:26 2019 +0000

    put displayed headers on the right, hidden headers on the left. a layout shared by other, similar prefs windows

diff --git a/src/prefs_display_header.c b/src/prefs_display_header.c
index 3c43ebe..10cbe84 100644
--- a/src/prefs_display_header.c
+++ b/src/prefs_display_header.c
@@ -291,6 +291,47 @@ static void prefs_display_header_create(void)
 	gtk_widget_show (list_view_hbox);
 	gtk_box_pack_start (GTK_BOX (vbox1), list_view_hbox, TRUE, TRUE, 0);
 
+	/* hidden headers list */
+
+	list_view_hbox2 = gtk_hbox_new (FALSE, 8);
+	gtk_widget_show (list_view_hbox2);
+	gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox2, TRUE, TRUE, 0);
+
+	list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL);
+	gtk_widget_set_size_request (list_view_scrolledwin, 200, 210);
+	gtk_widget_show (list_view_scrolledwin);
+	gtk_box_pack_start (GTK_BOX (list_view_hbox2), list_view_scrolledwin,
+			    TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin),
+					    GTK_SHADOW_IN);
+
+	hidden_headers_list_view = prefs_display_header_list_view_create
+					(_("Hidden headers"));
+	gtk_widget_show (hidden_headers_list_view);
+	gtk_container_add (GTK_CONTAINER (list_view_scrolledwin),
+			   hidden_headers_list_view);
+
+	btn_vbox = gtk_vbox_new (FALSE, 8);
+	gtk_widget_show (btn_vbox);
+	gtk_box_pack_start (GTK_BOX (list_view_hbox2), btn_vbox, FALSE, FALSE, 0);
+
+	reg_btn = gtk_button_new_from_stock (GTK_STOCK_ADD);
+	gtk_widget_show (reg_btn);
+	gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0);
+	g_signal_connect (G_OBJECT (reg_btn), "clicked",
+			    G_CALLBACK
+			    (prefs_display_header_register_cb),
+			    GINT_TO_POINTER(TRUE));
+	del_btn = gtk_button_new_from_stock (GTK_STOCK_DELETE);
+	gtk_widget_show (del_btn);
+	gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0);
+	g_signal_connect (G_OBJECT	 (del_btn), "clicked",
+			    G_CALLBACK (prefs_display_header_delete_cb),
+			    hidden_headers_list_view);
+
 	/* display headers list */
 
 	list_view_hbox1 = gtk_hbox_new (FALSE, 8);
@@ -353,49 +394,6 @@ static void prefs_display_header_create(void)
 	g_signal_connect (G_OBJECT (down_btn), "clicked",
 			  G_CALLBACK (prefs_display_header_down), NULL);
 
-	/* hidden headers list */
-
-	list_view_hbox2 = gtk_hbox_new (FALSE, 8);
-	gtk_widget_show (list_view_hbox2);
-	gtk_box_pack_start (GTK_BOX (list_view_hbox), list_view_hbox2, TRUE, TRUE, 0);
-
-	list_view_scrolledwin = gtk_scrolled_window_new (NULL, NULL);
-	gtk_widget_set_size_request (list_view_scrolledwin, 200, 210);
-	gtk_widget_show (list_view_scrolledwin);
-	gtk_box_pack_start (GTK_BOX (list_view_hbox2), list_view_scrolledwin,
-			    TRUE, TRUE, 0);
-	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin),
-					GTK_POLICY_AUTOMATIC,
-					GTK_POLICY_AUTOMATIC);
-	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin),
-					    GTK_SHADOW_IN);
-
-	hidden_headers_list_view = prefs_display_header_list_view_create
-					(_("Hidden headers"));
-	gtk_widget_show (hidden_headers_list_view);
-	gtk_container_add (GTK_CONTAINER (list_view_scrolledwin),
-			   hidden_headers_list_view);
-
-	btn_vbox = gtk_vbox_new (FALSE, 8);
-	gtk_widget_show (btn_vbox);
-	gtk_box_pack_start (GTK_BOX (list_view_hbox2), btn_vbox, FALSE, FALSE, 0);
-
-	reg_btn = gtk_button_new_from_stock (GTK_STOCK_ADD);
-	gtk_widget_show (reg_btn);
-	gtk_box_pack_start (GTK_BOX (btn_vbox), reg_btn, FALSE, TRUE, 0);
-	g_signal_connect (G_OBJECT (reg_btn), "clicked",
-			    G_CALLBACK
-			    (prefs_display_header_register_cb),
-			    GINT_TO_POINTER(TRUE));
-	del_btn = gtk_button_new_from_stock (GTK_STOCK_DELETE);
-	gtk_widget_show (del_btn);
-	gtk_box_pack_start (GTK_BOX (btn_vbox), del_btn, FALSE, TRUE, 0);
-	g_signal_connect (G_OBJECT	 (del_btn), "clicked",
-			    G_CALLBACK (prefs_display_header_delete_cb),
-			    hidden_headers_list_view);
-
-	
-
 	PACK_CHECK_BUTTON (vbox, checkbtn_other_headers,
 			   _("Show all unspecified headers"));
 	SET_TOGGLE_SENSITIVITY (checkbtn_other_headers, list_view_hbox2);

commit 8c320850024aee644fcb6d4f9ae564abcf1488e9
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 27 11:45:38 2019 +0100

    Fix possible stack overflow in vcalendar's Curl data handler
    
    Allocate the VLA on heap instead.

diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
index 20a4011..8ea78e5 100644
--- a/src/plugins/vcalendar/vcal_folder.c
+++ b/src/plugins/vcalendar/vcal_folder.c
@@ -1550,17 +1550,20 @@ static size_t curl_recv(void *buf, size_t size, size_t nmemb, void *stream)
 {
 	struct CBuf *buffer = (struct CBuf *)stream;
 	gchar *tmp = NULL;
-	gchar tmpbuf[size*nmemb + 1];
+	gchar *tmpbuf = g_malloc0(size*nmemb + 1);
+
+	g_return_val_if_fail(tmpbuf != NULL, 0);
 
 	memcpy(tmpbuf, buf, size*nmemb);
-	tmpbuf[size*nmemb] = '\0';
 
 	if (buffer->str) {
+		/* If the buffer already has contents, append the new data. */
 		tmp = g_strconcat(buffer->str, tmpbuf, NULL);
+		g_free(tmpbuf);
 		g_free(buffer->str);
 		buffer->str = tmp;
 	} else {
-		buffer->str = g_strdup(tmpbuf);
+		buffer->str = tmpbuf;
 	}
 
 	return size*nmemb;

commit 84af95468c04456d89002ccf42b4fe56d3ce8b0a
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 27 11:38:36 2019 +0100

    Use hardcoded SHA digest length in pkcs5_pbkdf2.c
    
    This makes -Wvla happy and saves us two GnuTLS API calls
    with no real downside.

diff --git a/src/common/pkcs5_pbkdf2.c b/src/common/pkcs5_pbkdf2.c
index 1475a33..6f83fe5 100644
--- a/src/common/pkcs5_pbkdf2.c
+++ b/src/common/pkcs5_pbkdf2.c
@@ -26,6 +26,8 @@
 #include <stdio.h>
 
 #define CHECKSUM_BLOCKLEN 64
+#define SHA1_DIGESTLEN 20
+
 /*
  * HMAC-SHA-1 (from RFC 2202).
  */
@@ -34,21 +36,20 @@ hmac_sha1(const guchar *text, size_t text_len, const guchar *key,
     size_t key_len, guchar *digest)
 {
 	GChecksum *cksum;
-	gssize digestlen = g_checksum_type_get_length(G_CHECKSUM_SHA1);
 	gsize outlen;
 	guchar k_pad[CHECKSUM_BLOCKLEN];
-	guchar tk[digestlen];
+	guchar tk[SHA1_DIGESTLEN];
 	gint i;
 
 	if (key_len > CHECKSUM_BLOCKLEN) {
 		cksum = g_checksum_new(G_CHECKSUM_SHA1);
 		g_checksum_update(cksum, key, key_len);
-		outlen = digestlen;
+		outlen = SHA1_DIGESTLEN;
 		g_checksum_get_digest(cksum, tk, &outlen);
 		g_checksum_free(cksum);
 
 		key = tk;
-		key_len = digestlen;
+		key_len = SHA1_DIGESTLEN;
 	}
 
 	memset(k_pad, 0, sizeof k_pad);
@@ -59,7 +60,7 @@ hmac_sha1(const guchar *text, size_t text_len, const guchar *key,
 	cksum = g_checksum_new(G_CHECKSUM_SHA1);
 	g_checksum_update(cksum, k_pad, CHECKSUM_BLOCKLEN);
 	g_checksum_update(cksum, text, text_len);
-	outlen = digestlen;
+	outlen = SHA1_DIGESTLEN;
 	g_checksum_get_digest(cksum, digest, &outlen);
 	g_checksum_free(cksum);
 
@@ -70,8 +71,8 @@ hmac_sha1(const guchar *text, size_t text_len, const guchar *key,
 
 	cksum = g_checksum_new(G_CHECKSUM_SHA1);
 	g_checksum_update(cksum, k_pad, CHECKSUM_BLOCKLEN);
-	g_checksum_update(cksum, digest, digestlen);
-	outlen = digestlen;
+	g_checksum_update(cksum, digest, SHA1_DIGESTLEN);
+	outlen = SHA1_DIGESTLEN;
 	g_checksum_get_digest(cksum, digest, &outlen);
 	g_checksum_free(cksum);
 }
@@ -86,9 +87,8 @@ gint
 pkcs5_pbkdf2(const gchar *pass, size_t pass_len, const guchar *salt,
     size_t salt_len, guchar *key, size_t key_len, guint rounds)
 {
-	gssize digestlen = g_checksum_type_get_length(G_CHECKSUM_SHA1);
-	guchar *asalt, obuf[digestlen];
-	guchar d1[digestlen], d2[digestlen];
+	guchar *asalt, obuf[SHA1_DIGESTLEN];
+	guchar d1[SHA1_DIGESTLEN], d2[SHA1_DIGESTLEN];
 	guint i, j;
 	guint count;
 	size_t r;
@@ -119,7 +119,7 @@ pkcs5_pbkdf2(const gchar *pass, size_t pass_len, const guchar *salt,
 				obuf[j] ^= d1[j];
 		}
 
-		r = MIN(key_len, digestlen);
+		r = MIN(key_len, SHA1_DIGESTLEN);
 		memcpy(key, obuf, r);
 		key += r;
 		key_len -= r;
@@ -132,3 +132,5 @@ pkcs5_pbkdf2(const gchar *pass, size_t pass_len, const guchar *salt,
 
 	return 0;
 }
+
+#undef SHA1_DIGESTLEN

commit 577c2d3a4da4238b43f9aa4bcb6c9363b61748dc
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 27 10:50:22 2019 +0100

    Make is_toplvl_domain() aware that TLDs can be longer than 6 characters

diff --git a/src/common/utils.c b/src/common/utils.c
index dbf3fd8..8757567 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -3491,12 +3491,11 @@ static GHashTable *create_domain_tab(void)
 
 static gboolean is_toplvl_domain(GHashTable *tab, const gchar *first, const gchar *last)
 {
-	const gint MAX_LVL_DOM_NAME_LEN = 6;
-	gchar buf[MAX_LVL_DOM_NAME_LEN + 1];
-	const gchar *m = buf + MAX_LVL_DOM_NAME_LEN + 1;
+	gchar buf[BUFFSIZE + 1];
+	const gchar *m = buf + BUFFSIZE + 1;
 	register gchar *p;
 
-	if (last - first > MAX_LVL_DOM_NAME_LEN || first > last)
+	if (last - first > BUFFSIZE || first > last)
 		return FALSE;
 
 	for (p = buf; p < m &&  first < last; *p++ = *first++)

commit b53607c2fa9977c33ba77e237be7550353396b8e
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Jan 25 23:27:18 2019 +0100

    Do not define our own strcasestr() if it is available

diff --git a/configure.ac b/configure.ac
index a358527..fd833eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -419,7 +419,7 @@ AC_CHECK_SIZEOF(unsigned long, 4)
 
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
-AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
+AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr strcasestr \
 	       uname flock lockf inet_aton inet_addr \
 	       fchmod mkstemp truncate getuid regcomp)
 
diff --git a/src/common/utils.c b/src/common/utils.c
index 5cb5515..dbf3fd8 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -300,6 +300,7 @@ gchar *strcrchomp(gchar *str)
 	return str;
 }
 
+#ifndef HAVE_STRCASESTR
 /* Similar to `strstr' but this function ignores the case of both strings.  */
 gchar *strcasestr(const gchar *haystack, const gchar *needle)
 {
@@ -307,6 +308,7 @@ gchar *strcasestr(const gchar *haystack, const gchar *needle)
 
 	return strncasestr(haystack, haystack_len, needle);
 }
+#endif /* HAVE_STRCASESTR */
 
 gchar *strncasestr(const gchar *haystack, gint haystack_len, const gchar *needle)
 {
diff --git a/src/common/utils.h b/src/common/utils.h
index c063592..09db918 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -280,8 +280,10 @@ gchar *strretchomp	(gchar		*str);
 gchar *strtailchomp	(gchar		*str,
 			 gchar		 tail_char);
 gchar *strcrchomp	(gchar		*str);
+#ifndef HAVE_STRCASESTR
 gchar *strcasestr	(const gchar	*haystack,
 			 const gchar	*needle);
+#endif /* HAVE_STRCASESTR */
 gchar *strncasestr	(const gchar	*haystack,
 			 gint		 haystack_len,
 			 const gchar	*needle);

commit 3166cdab193fb24aa2d8a82c2686361e3e3275a9
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 20:00:49 2019 +0100

    Fix a compiler warning

diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c
index b037ef7..79c0c92 100644
--- a/src/plugins/pgpcore/sgpgme.c
+++ b/src/plugins/pgpcore/sgpgme.c
@@ -357,7 +357,7 @@ gchar *sgpgme_sigstat_info_full(gpgme_ctx_t ctx, gpgme_verify_result_t status)
 		}
 
 		memset(buf, 0, sizeof(buf));
-		fast_strftime(buf, sizeof(buf)-1, prefs_common_get_prefs()->date_format, localtime_r(&sig->timestamp, &lt));
+		fast_strftime(buf, sizeof(buf)-1, prefs_common_get_prefs()->date_format, localtime_r((time_t *)&sig->timestamp, &lt));
 		g_string_append_printf(siginfo,
 			_("Signature made on %s using %s key ID %s\n"),
 			buf, keytype, keyid);

commit e6a6008a144604ffc77613d7caa55532fa9a0eaf
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 19:45:23 2019 +0100

    Remove unneeded w32_stdio.c

diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 805db4d..b5a5759 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -15,7 +15,7 @@ noinst_LTLIBRARIES = libclawscommon.la
 
 if OS_WIN32
 arch_sources = w32_reg.c w32_signal.c w32_stat.c \
-               w32_stdio.c w32_stdlib.c w32_string.c w32_time.c \
+               w32_stdlib.c w32_string.c w32_time.c \
                w32_unistd.c w32_wait.c w32_account.c
 arch_headers = w32lib.h
 else
diff --git a/src/common/w32_stdio.c b/src/common/w32_stdio.c
deleted file mode 100644
index af6a3ed..0000000
--- a/src/common/w32_stdio.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* w32_dirent.c  - Posix emulation layer for Sylpheed (Claws)
- *
- * This file is part of w32lib.
- *
- * w32lib is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * w32lib is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information and a list of changes, see w32lib.h
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "w32lib.h"
-
-#if MINGW64_VERSION < 200
-FILE *popen( const char *command, const char *type ){
-  return NULL;
-}
-#endif
-
-int pclose( FILE *stream ){
-  return -1;
-}

commit bdc4080ad4250eab3c2184806c9fe29aaef27e39
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 19:41:00 2019 +0100

    Disable operations around the x_display variable on non-Unix

diff --git a/src/main.c b/src/main.c
index f9ffe07..c9c49ab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -171,7 +171,9 @@ static SnDisplay *sn_display = NULL;
 
 static gint lock_socket = -1;
 static gint lock_socket_tag = 0;
+#ifdef G_OS_UNIX
 static gchar *x_display = NULL;
+#endif
 typedef enum 
 {
 	ONLINE_MODE_DONT_CHANGE,
@@ -2441,7 +2443,7 @@ static gint prohibit_duplicate_launch(void)
 			claws_fputs(buf, stdout);
 		}
 	} else {
-#ifndef G_OS_WIN32
+#ifdef G_OS_UNIX
 		gchar buf[BUFSIZ];
 		fd_write_all(uxsock, "get_display\n", 12);
 		memset(buf, 0, sizeof(buf));
@@ -2533,8 +2535,10 @@ static void lock_socket_input_cb(gpointer data,
 
 	if (!strncmp(buf, "popup", 5)) {
 		main_window_popup(mainwin);
+#ifdef G_OS_UNIX
 	} else if (!strncmp(buf, "get_display", 11)) {
 		fd_write_all(sock, x_display, strlen(x_display));
+#endif
 	} else if (!strncmp(buf, "receive_all", 11)) {
 		inc_all_account_mail(mainwin, FALSE, FALSE,
 				     prefs_common.newmail_notify_manu);

commit 8eee8f13df0325b9c75bb062246d619da9066276
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 19:33:34 2019 +0100

    Use G_GSIZE_FORMAT for printing time_t values

diff --git a/src/matcher.c b/src/matcher.c
index 1186dba..b4cd61d 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -952,7 +952,7 @@ static gboolean matcherprop_match(MatcherProp *prop,
 				&& prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_HIGH) {
 			if (ret) {
 				log_print(LOG_DEBUG_FILTERING,
-						"message date [ %ld ] is after [ %d ]\n",
+						"message date [ %"G_GSIZE_FORMAT" ] is after [ %d ]\n",
 						info->date_t, prop->value);
 			} else {
 				log_print(LOG_DEBUG_FILTERING,
diff --git a/src/mh.c b/src/mh.c
index 0500ada..135975c 100644
--- a/src/mh.c
+++ b/src/mh.c
@@ -1468,6 +1468,6 @@ static void mh_set_mtime(Folder *folder, FolderItem *item)
 	}
 
 	item->mtime = s.st_mtime;
-	debug_print("MH: forced mtime of %s to %ld\n", item->name?item->name:"(null)", item->mtime);
+	debug_print("MH: forced mtime of %s to %"G_GSIZE_FORMAT"\n", item->name?item->name:"(null)", item->mtime);
 	g_free(path);
 }
diff --git a/src/plugins/libravatar/libravatar_missing.c b/src/plugins/libravatar/libravatar_missing.c
index 8f3ebde..9878bab 100644
--- a/src/plugins/libravatar/libravatar_missing.c
+++ b/src/plugins/libravatar/libravatar_missing.c
@@ -83,7 +83,7 @@ close_exit:
 static void missing_save_item(gpointer key, gpointer value, gpointer data)
 {
 	FILE *file = (FILE *)data;
-	gchar *line = g_strdup_printf("%s %lu\n", (gchar *)key, *(time_t *)value);
+	gchar *line = g_strdup_printf("%s %"G_GSIZE_FORMAT"\n", (gchar *)key, *(time_t *)value);
 	if (claws_fputs(line, file) < 0)
 		g_warning("error saving missing item");
 	g_free(line);
@@ -138,10 +138,10 @@ void missing_add_md5(GHashTable *table, const gchar *md5)
 		seen = g_malloc0(sizeof(time_t));
 		*seen = t;
 		g_hash_table_insert(table, g_strdup(md5), seen);
-		debug_print("New md5 %s added with time %lu\n", md5, t);
+		debug_print("New md5 %s added with time %"G_GSIZE_FORMAT"\n", md5, t);
 	} else {
 		*seen = t; /* just update */
-		debug_print("Updated md5 %s with time %lu\n", md5, t);
+		debug_print("Updated md5 %s with time %"G_GSIZE_FORMAT"\n", md5, t);
 	}
 }
 
diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c
index 9190889..4732afa 100644
--- a/src/plugins/rssyl/parse822.c
+++ b/src/plugins/rssyl/parse822.c
@@ -137,7 +137,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
 				/* Last-Seen timestamp */
 				if( !strcmp(line[0], "X-RSSyl-Last-Seen") ) {
 					ctx->last_seen = atol(line[1]);
-					debug_print("RSSyl: got last_seen timestamp %ld\n", ctx->last_seen);
+					debug_print("RSSyl: got last_seen timestamp %"G_GSIZE_FORMAT"\n", ctx->last_seen);
 				}
 
 				/* ID */
diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c
index 0eeb21b..4123008 100644
--- a/src/plugins/rssyl/rssyl_add_item.c
+++ b/src/plugins/rssyl/rssyl_add_item.c
@@ -311,13 +311,13 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 	/* If one of the timestamps is empty, set it to value of the other one. */
 	if( feed_item_get_date_modified(feed_item) == -1 &&
 			feed_item_get_date_published(feed_item) >= 0 ) {
-		debug_print("RSSyl: setting missing moddate to pubdate %ld\n",
+		debug_print("RSSyl: setting missing moddate to pubdate %"G_GSIZE_FORMAT"\n",
 				feed_item_get_date_published(feed_item));
 		feed_item_set_date_modified(feed_item,
 				feed_item_get_date_published(feed_item));
 	} else if( feed_item_get_date_published(feed_item) == -1 &&
 			feed_item_get_date_modified(feed_item) >= 0 ) {
-		debug_print("RSSyl: setting missing pubdate to modddate %ld\n",
+		debug_print("RSSyl: setting missing pubdate to modddate %"G_GSIZE_FORMAT"\n",
 				feed_item_get_date_modified(feed_item));
 		feed_item_set_date_published(feed_item,
 				feed_item_get_date_modified(feed_item));
@@ -325,7 +325,7 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 			feed_item_get_date_published(feed_item) == -1 &&
 			feed_item_get_sourcedate(feed_item) >= 0 ) {
 		/* If neither item date is set, use date from source (Atom only). */
-		debug_print("RSSyl: setting missing pubdate and moddate to feed source date %ld\n",
+		debug_print("RSSyl: setting missing pubdate and moddate to feed source date %"G_GSIZE_FORMAT"\n",
 				feed_item_get_sourcedate(feed_item));
 		feed_item_set_date_modified(feed_item,
 				feed_item_get_sourcedate(feed_item));
diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
index db6acf3..20a4011 100644
--- a/src/plugins/vcalendar/vcal_folder.c
+++ b/src/plugins/vcalendar/vcal_folder.c
@@ -1170,7 +1170,7 @@ static void vcal_set_mtime(Folder *folder, FolderItem *item)
 	}
 
 	item->mtime = s.st_mtime;
-	debug_print("VCAL: forced mtime of %s to %ld\n",
+	debug_print("VCAL: forced mtime of %s to %"G_GSIZE_FORMAT"\n",
 			item->name?item->name:"(null)", item->mtime);
 	g_free(path);
 }
diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c
index a6c84f7..b93d91c 100644
--- a/src/plugins/vcalendar/vcal_manager.c
+++ b/src/plugins/vcalendar/vcal_manager.c
@@ -926,7 +926,7 @@ void vcal_manager_save_event (VCalEvent *event, gboolean export_after)
 	xml_tag_add_attr(tag, xml_attr_new("type", tmp));
 	g_free(tmp);
 	
-	tmp = g_strdup_printf("%ld", event->postponed);
+	tmp = g_strdup_printf("%"G_GSIZE_FORMAT, event->postponed);
 	xml_tag_add_attr(tag, xml_attr_new("postponed", tmp));
 	g_free(tmp);
 	
diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c
index 0e570ad..7f3105f 100644
--- a/src/plugins/vcalendar/vcal_meeting_gtk.c
+++ b/src/plugins/vcalendar/vcal_meeting_gtk.c
@@ -1838,7 +1838,7 @@ void multisync_export(void)
 	list = vcal_folder_get_waiting_events();
 	for (cur = list; cur; cur = cur->next) {
 		VCalEvent *event = (VCalEvent *)cur->data;
-		file = g_strdup_printf("multisync%ld-%d",
+		file = g_strdup_printf("multisync%"G_GSIZE_FORMAT"-%d",
 				time(NULL), i);
 
 		i++;

commit e7c4908bd2c86b302d5fe58877297ae1fcfefe23
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 19:15:04 2019 +0100

    Replace deprecated _sleep() with Sleep() in w32_unistd.c

diff --git a/src/common/w32_unistd.c b/src/common/w32_unistd.c
index d263581..11a2dda 100644
--- a/src/common/w32_unistd.c
+++ b/src/common/w32_unistd.c
@@ -36,7 +36,7 @@ pid_t fork( void ){
 }
 
 unsigned int sleep( unsigned int seconds ){
-  _sleep(seconds * 1000);
+  Sleep(seconds * 1000);
   return 0;
 }
 

commit e243f0fd1705a03b8f507750e8a4849b24d0f28d
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 19:06:32 2019 +0100

    Add a menu item to open debug log file on Windows

diff --git a/src/common/utils.c b/src/common/utils.c
index 110817a..5cb5515 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -4715,3 +4715,10 @@ gboolean get_serverportfp_from_filename(const gchar *str, gchar **server, gchar
 		return TRUE;
 }
 
+#ifdef G_OS_WIN32
+gchar *win32_debug_log_path(void)
+{
+	return g_strconcat(g_get_tmp_dir(), G_DIR_SEPARATOR_S,
+			"claws-win32.log", NULL);
+}
+#endif
diff --git a/src/common/utils.h b/src/common/utils.h
index d51cc00..c063592 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -544,4 +544,8 @@ gboolean get_random_bytes(void *buf, size_t count);
 
 gboolean get_serverportfp_from_filename(const gchar *str, gchar **server, gchar **port, gchar **fp);
 
+#ifdef G_OS_WIN32
+gchar *win32_debug_log_path(void);
+#endif
+
 #endif /* __UTILS_H__ */
diff --git a/src/main.c b/src/main.c
index 32ff6c4..f9ffe07 100644
--- a/src/main.c
+++ b/src/main.c
@@ -735,8 +735,8 @@ static void win32_log(const gchar *log_domain, GLogLevelFlags log_level, const g
 
 static void win32_open_log(void)
 {
-	gchar *logfile = g_strconcat(g_get_tmp_dir(), G_DIR_SEPARATOR_S, "claws-win32.log", NULL);
-	gchar *oldlogfile = g_strconcat(g_get_tmp_dir(), G_DIR_SEPARATOR_S, "claws-win32.log.bak", NULL);
+	gchar *logfile = win32_debug_log_path();
+	gchar *oldlogfile = g_strconcat(logfile, ".bak", NULL);
 
 	if (is_file_exist(logfile)) {
 		if (rename_force(logfile, oldlogfile) < 0)
diff --git a/src/mainwindow.c b/src/mainwindow.c
index a5ad013..a019dd7 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -18,6 +18,11 @@
 
 #include "defs.h"
 
+#ifdef G_OS_WIN32
+#define UNICODE
+#define _UNICODE
+#endif
+
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
@@ -187,6 +192,9 @@ static void log_window_show_cb	(GtkAction	*action,
 				  gpointer	 data);
 static void filtering_debug_window_show_cb	(GtkAction	*action,
 				  gpointer	 data);
+#ifdef G_OS_WIN32
+static void debug_log_show_cb(GtkAction *action, gpointer data);
+#endif
 
 static void inc_cancel_cb		(GtkAction	*action,
 				  gpointer	 data);
@@ -779,6 +787,9 @@ static GtkActionEntry mainwin_entries[] =
 	/* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
 	{"Tools/FilteringLog",                       NULL, N_("Filtering Lo_g"), NULL, NULL, G_CALLBACK(filtering_debug_window_show_cb) }, 
 	{"Tools/NetworkLog",                         NULL, N_("Network _Log"), "<shift><control>L", NULL, G_CALLBACK(log_window_show_cb) }, 
+#ifdef G_OS_WIN32
+	{"Tools/DebugLog",                           NULL, N_("Debug _Log"), NULL, NULL, G_CALLBACK(debug_log_show_cb) },
+#endif
 	/* {"Tools/---",                             NULL, "---", NULL, NULL, NULL }, */
 	{"Tools/ForgetSessionPasswords",             NULL, N_("_Forget all session passwords"), NULL, NULL, G_CALLBACK(forget_session_passwords_cb) }, 
 #ifndef PASSWORD_CRYPTO_OLD
@@ -1835,6 +1846,9 @@ MainWindow *main_window_create()
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator7", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "FilteringLog", "Tools/FilteringLog", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "NetworkLog", "Tools/NetworkLog", GTK_UI_MANAGER_MENUITEM)
+#ifdef G_OS_WIN32
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "DebugLog", "Tools/DebugLog", GTK_UI_MANAGER_MENUITEM)
+#endif
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "Separator8", "Tools/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "ForgetSessionPasswords", "Tools/ForgetSessionPasswords", GTK_UI_MANAGER_MENUITEM)
 #ifndef PASSWORD_CRYPTO_OLD
@@ -3077,6 +3091,7 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
 		UPDATE_STATE(M_MASTER_PASSPHRASE);
 	}
 #endif
+
 #undef UPDATE_STATE
 
 	return state;
@@ -4309,6 +4324,34 @@ static void filtering_debug_window_show_cb(GtkAction *action, gpointer data)
 	log_window_show(mainwin->filtering_debugwin);
 }
 
+#ifdef G_OS_WIN32
+static void debug_log_show_cb(GtkAction *action, gpointer data)
+{
+	GError *error = NULL;
+	gchar *logpath8 = win32_debug_log_path();
+	gunichar2 *logpath16;
+
+	debug_print("opening '%s'\n", logpath8);
+
+	logpath16 = g_utf8_to_utf16(logpath8, -1, NULL, NULL, &error);
+
+	if (error != NULL) {
+		g_warning("couldn't convert debug log path '%s' to UTF-16: %s",
+				logpath8, error->message);
+		g_error_free(error);
+		g_free(logpath16);
+		return;
+	}
+
+	HINSTANCE ret = ShellExecute(NULL, NULL, (LPCWSTR)logpath16,
+			NULL, NULL, SW_SHOW);
+
+	g_free(logpath8);
+	g_free(logpath16);
+	debug_print("ShellExecute result: %"G_GSIZE_FORMAT"\n", (gsize)ret);
+}
+#endif
+
 static void inc_cancel_cb(GtkAction *action, gpointer data)
 {
 	inc_cancel_all();

commit fe3595020e736b5866581dadc3ebee9b8a970fc7
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 17:32:27 2019 +0100

    Only call the fd_is_w32_socket() check on Windows
    
    This saves us one unnecessary getsockopt() call before
    each socket read and write.

diff --git a/src/common/socket.c b/src/common/socket.c
index 7751f62..fdc1589 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -241,21 +241,19 @@ void refresh_resolvers(void)
 #define SOCKET_IS_VALID(s) 	(s != -1)
 #endif
 
+#ifdef G_OS_WIN32
 /* Due to the fact that socket under Windows are not represented by
    standard file descriptors, we sometimes need to check whether a
    given file descriptor is actually a socket.  This is done by
    testing for an error.  Returns true under W32 if FD is a socket. */
 static int fd_is_w32_socket(gint fd)
 {
-#ifdef G_OS_WIN32
         gint optval;
         gint retval = sizeof(optval);
         
         return !getsockopt(fd, SOL_SOCKET, SO_TYPE, (char*)&optval, &retval);
-#else
-        return 0;
-#endif 
 }
+#endif
 
 gint fd_connect_inet(gushort port)
 {
@@ -1245,8 +1243,11 @@ static gint fd_read(gint fd, gchar *buf, gint len)
 	if (fd_check_io(fd, G_IO_IN) < 0)
 		return -1;
 
-        if (fd_is_w32_socket(fd))
-                return recv(fd, buf, len, 0);
+#ifdef G_OS_WIN32
+	if (fd_is_w32_socket(fd))
+		return recv(fd, buf, len, 0);
+#endif
+
 	return read(fd, buf, len);
 }
 
@@ -1312,8 +1313,11 @@ gint fd_write(gint fd, const gchar *buf, gint len)
 	if (fd_check_io(fd, G_IO_OUT) < 0)
 		return -1;
 
-        if (fd_is_w32_socket (fd))
-                return send(fd, buf, len, 0);
+#ifdef G_OS_WIN32
+	if (fd_is_w32_socket (fd))
+		return send(fd, buf, len, 0);
+#endif
+
 	return write(fd, buf, len);
 }
 
@@ -1369,10 +1373,13 @@ gint fd_write_all(gint fd, const gchar *buf, gint len)
 #ifndef G_OS_WIN32
 		signal(SIGPIPE, SIG_IGN);
 #endif
+
+#ifdef G_OS_WIN32
 		if (fd_is_w32_socket(fd))
 			n = send(fd, buf, len, 0);
 		else
-                        n = write(fd, buf, len);
+#endif
+			n = write(fd, buf, len);
 
 		if (n <= 0) {
 			log_error(LOG_PROTOCOL, _("write on fd%d: %s\n"), fd, g_strerror(errno));

commit 021f303fef328e0ea788b3bb0262ab6602cb118f
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jan 20 14:45:08 2019 +0100

    Fix session proxy initialization for Windows
    
    Fixes bug #4145: proxy server for sending doesn't work

diff --git a/src/common/session.c b/src/common/session.c
index 2dc0a0a..a6f19ea 100644
--- a/src/common/session.c
+++ b/src/common/session.c
@@ -122,7 +122,6 @@ void session_init(Session *session, const void *prefs_account, gboolean is_smtp)
  */
 gint session_connect(Session *session, const gchar *server, gushort port)
 {
-#ifdef G_OS_UNIX
 	session->server = g_strdup(server);
 	session->port = port;
 
@@ -131,6 +130,7 @@ gint session_connect(Session *session, const gchar *server, gushort port)
 		port = session->proxy_info->proxy_port;
 	}
 
+#ifdef G_OS_UNIX
 	session->conn_id = sock_connect_async(server, port, session_connect_cb,
 					      session);
 	if (session->conn_id < 0) {
@@ -145,9 +145,6 @@ gint session_connect(Session *session, const gchar *server, gushort port)
 #else
 	SockInfo *sock;
 
-	session->server = g_strdup(server);
-	session->port = port;
-
 	sock = sock_connect(server, port);
 	if (sock == NULL) {
 		g_warning("can't connect to server.");

commit a05fe7ad8f96cfbd075dacca9fb9a58b0e66ea43
Author: Paul <paul at claws-mail.org>
Date:   Thu Jan 17 10:06:34 2019 +0000

    save checkbox choices of display/summaries/defaults prefs

diff --git a/src/prefs_summaries.c b/src/prefs_summaries.c
index 156f05c..2a8b0a8 100644
--- a/src/prefs_summaries.c
+++ b/src/prefs_summaries.c
@@ -812,6 +812,18 @@ static void prefs_summaries_save(PrefsPage *_page)
 			GTK_COMBO_BOX(page->optmenu_sort_type));
 	prefs_common.next_unread_msg_dialog = combobox_get_active_data(
 			GTK_COMBO_BOX(page->optmenu_nextunreadmsgdialog));
+	prefs_common.folder_default_thread =  gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(page->checkbtn_folder_default_thread));
+	prefs_common.folder_default_thread_collapsed =  gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(page->checkbtn_folder_default_thread_collapsed));
+	prefs_common.folder_default_hide_read_threads =  gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(page->checkbtn_folder_default_hide_read_threads));
+	prefs_common.folder_default_hide_read_msgs =  gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(page->checkbtn_folder_default_hide_read_msgs));
+	prefs_common.folder_default_hide_del_msgs =  gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(page->checkbtn_folder_default_hide_del_msgs));
+	prefs_common.folder_default_hide_del_msgs =  gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(page->checkbtn_folder_default_hide_del_msgs));
 
 	main_window_reflect_prefs_all();
 }

commit 562f0293a833cbef00db1f8e87886acc2ff170c4
Author: Andrej Kacian <ticho at local>
Date:   Wed Jan 16 18:36:55 2019 +0100

    Fix crash when LDAP address source is defined in index, but LDAP support is disabled
    
    AddressIfFrag is being cast to AddrBookBase, so it too
    needs to have the two mandatory members at the beginning.

diff --git a/src/addrindex.c b/src/addrindex.c
index 82c2fed..62d4aa9 100644
--- a/src/addrindex.c
+++ b/src/addrindex.c
@@ -162,6 +162,8 @@ static gint addrindex_write_to			( AddressIndex *addrIndex,
  */
 typedef struct _AddressIfFrag AddressIfFragment;
 struct _AddressIfFrag {
+	AddressBookType type;
+	AddressCache *addressCache;
 	gchar *name;
 	GList *children;
 	GList *attributes;
@@ -1013,6 +1015,8 @@ static AddressIfFragment *addrindex_read_fragment( XMLFile *file ) {
 
 	/* Create new fragment */
 	fragment = g_new0( AddressIfFragment, 1 );
+	fragment->type = ADBOOKTYPE_NONE;
+	fragment->addressCache = NULL;
 	fragment->name = g_strdup( xtag->tag );
 	fragment->children = NULL;
 	fragment->attributes = NULL;

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list