acc_pass = account->passwd;
try_again:
pass = acc_pass;
- if (!pass && account->imap_auth_type != IMAP_AUTH_ANON) {
+ if (!pass && account->imap_auth_type != IMAP_AUTH_ANON && account->imap_auth_type != IMAP_AUTH_GSSAPI) {
gchar *tmp_pass;
tmp_pass = input_dialog_query_password_keep(account->recv_server,
account->userid,
return MAILIMAP_NO_ERROR;
Xstrdup_a(pass, tmp_pass, {g_free(tmp_pass); return MAILIMAP_NO_ERROR;});
g_free(tmp_pass);
- } else if (account->imap_auth_type == IMAP_AUTH_ANON) {
+ } else if (account->imap_auth_type == IMAP_AUTH_ANON || account->imap_auth_type == IMAP_AUTH_GSSAPI) {
pass = "";
}
statuswindow_print_all(_("Connecting to IMAP4 server %s...\n"),
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;
-
+ gchar *item_path = NULL;
+
g_return_val_if_fail(folder != NULL, NULL);
g_return_val_if_fail(item != NULL, NULL);
folder_path = imap_folder_get_path(folder);
g_return_val_if_fail(folder_path != NULL, NULL);
+
+#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)) {
- if (item->path)
+ if (item_path)
path = g_strconcat(folder_path, G_DIR_SEPARATOR_S,
- item->path, NULL);
+ item_path, NULL);
else
path = g_strdup(folder_path);
} else {
- if (item->path)
+ if (item_path)
path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
folder_path, G_DIR_SEPARATOR_S,
- item->path, NULL);
+ item_path, NULL);
else
path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
folder_path, NULL);
}
g_free(folder_path);
+ g_free(item_path);
#ifdef G_OS_WIN32
while (strchr(path, '/'))
*strchr(path, '/') = '\\';