talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 15f0d14a0896c91f90bc10b9b5f0ad5a2e194828
parent aff2b647d279f1b995e9186f77ee30ab5fe5f8b1
Author: Colin Leroy <colin@colino.net>
Date:   Wed,  1 Oct 2008 07:07:23 +0000

2008-10-01 [colin]	3.5.0cvs143

	* src/imap.c
		Real fix for FS-unsafe chars on win32

Diffstat:
MChangeLog | 5+++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/imap.c | 49++++++++++++++++++++++++++++++++++---------------
4 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-01 [colin] 3.5.0cvs143 + + * src/imap.c + Real fix for FS-unsafe chars on win32 + 2008-10-01 [colin] 3.5.0cvs142 * src/imap.c diff --git a/PATCHSETS b/PATCHSETS @@ -3554,3 +3554,4 @@ ( cvs diff -u -r 1.22.2.20 -r 1.22.2.21 src/addrbook.c; cvs diff -u -r 1.6.10.18 -r 1.6.10.19 src/addrharvest.c; cvs diff -u -r 1.382.2.480 -r 1.382.2.481 src/compose.c; cvs diff -u -r 1.18.2.26 -r 1.18.2.27 src/jpilot.c; cvs diff -u -r 1.79.2.65 -r 1.79.2.66 src/mh.c; cvs diff -u -r 1.3.2.58 -r 1.3.2.59 src/prefs_themes.c; cvs diff -u -r 1.47.2.48 -r 1.47.2.49 src/procheader.c; cvs diff -u -r 1.49.2.117 -r 1.49.2.118 src/procmime.c; cvs diff -u -r 1.395.2.392 -r 1.395.2.393 src/summaryview.c; cvs diff -u -r 1.36.2.152 -r 1.36.2.153 src/common/utils.c; cvs diff -u -r 1.9.2.23 -r 1.9.2.24 src/gtk/sslcertwindow.c; ) > 3.5.0cvs140.patchset ( cvs diff -u -r 1.2.2.16 -r 1.2.2.17 src/ldapctrl.c; cvs diff -u -r 1.115.2.209 -r 1.115.2.210 src/main.c; cvs diff -u -r 1.3.2.59 -r 1.3.2.60 src/prefs_themes.c; cvs diff -u -r 1.1.2.15 -r 1.1.2.16 src/printing.c; ) > 3.5.0cvs141.patchset ( cvs diff -u -r 1.179.2.231 -r 1.179.2.232 src/imap.c; ) > 3.5.0cvs142.patchset +( cvs diff -u -r 1.179.2.232 -r 1.179.2.233 src/imap.c; ) > 3.5.0cvs143.patchset diff --git a/configure.ac b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=5 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=142 +EXTRA_VERSION=143 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/imap.c b/src/imap.c @@ -2487,6 +2487,36 @@ static gchar *imap_folder_get_path(Folder *folder) return folder_path; } +#ifdef G_OS_WIN32 +static gchar *imap_encode_unsafe_chars(const gchar *str) +{ + gchar *ret = NULL, *o_ret; + gchar *i; + if (!str) + return NULL; + ret = g_malloc(3*strlen(str)+1); + o_ret = ret; + for (i = str; *i; i++) { + switch(*i) { + case ':': + case '|': + case '<': + case '>': + case '*': + case '?': + case '#': + *ret++ = '%'; + *ret++ = '0'+(*i/10); + *ret++ = '0'+(*i%10); + break; + default: + *ret++ = *i; + } + } + *ret++ = '\0'; + return o_ret; +} +#endif static gchar *imap_item_get_path(Folder *folder, FolderItem *item) { gchar *folder_path, *path; @@ -2497,22 +2527,11 @@ static gchar *imap_item_get_path(Folder *folder, FolderItem *item) folder_path = imap_folder_get_path(folder); g_return_val_if_fail(folder_path != NULL, NULL); - item_path = g_strdup(item->path); -#ifdef G_OS_WIN32 - if (strchr(item_path, ':') || - strchr(item_path, '|') || - strchr(item_path, '<') || - strchr(item_path, '>') || - strchr(item_path, '*') || - strchr(item_path, '?') || - strchr(item_path, '#') || - strchr(item_path, ':') - ) { - g_free(item_path); - item_path = g_malloc(strlen(item->path)*3 +1); - qp_encode_line(item_path, item->path); - } +#ifdef G_OS_UNIX + item_path = g_strdup(item->path); +#else + item_path = imap_encode_unsafe_chars(item->path); #endif if (g_path_is_absolute(folder_path)) {