FolderItem *dest,
MsgInfoList *msglist,
GRelation *relation);
+static gint imap_expunge (Folder *folder,
+ FolderItem *dest);
static gint imap_remove_all_msg (Folder *folder,
FolderItem *item);
IMAPFlags flags,
GSList *tags,
int do_add);
-static gint imap_cmd_expunge (IMAPSession *session);
+static gint imap_cmd_expunge (IMAPSession *session, gboolean force);
static void imap_path_separator_subst (gchar *str,
gchar separator);
imap_class.copy_msgs = imap_copy_msgs;
imap_class.remove_msg = imap_remove_msg;
imap_class.remove_msgs = imap_remove_msgs;
+ imap_class.expunge = imap_expunge;
imap_class.remove_all_msg = imap_remove_all_msg;
imap_class.is_msg_changed = imap_is_msg_changed;
imap_class.change_flags = imap_change_flags;
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 ok;
}
} /* else we just need to expunge */
- ok = imap_cmd_expunge(session);
+ ok = imap_cmd_expunge(session, folder->account->imap_use_trash);
if (ok != MAILIMAP_NO_ERROR) {
log_warning(LOG_PROTOCOL, _("can't expunge\n"));
g_free(destdir);
g_slist_free(tags);
continue;
}
- if (tags != NULL) {
- g_slist_free(msginfo->tags);
- msginfo->tags = NULL;
- }
+ g_slist_free(msginfo->tags);
+ msginfo->tags = NULL;
+
for (cur = tags; cur; cur = cur->next) {
gchar *real_tag = imap_modified_utf7_to_utf8(cur->data, TRUE);
gint id = 0;
got_alien_tags = TRUE;
}
if (!g_slist_find(msginfo->tags, GINT_TO_POINTER(id))) {
- msginfo->tags = g_slist_append(
+ msginfo->tags = g_slist_prepend(
msginfo->tags,
GINT_TO_POINTER(id));
}
g_free(real_tag);
}
+ if (msginfo->tags)
+ msginfo->tags = g_slist_reverse(msginfo->tags);
slist_free_strings(tags);
g_slist_free(tags);
msginfo->folder = item;
return r;
}
- if (data_status->st_info_list == NULL) {
- mailimap_mailbox_data_status_free(data_status);
- debug_print("status->st_info_list == NULL\n");
+ if (data_status == NULL || data_status->st_info_list == NULL) {
+ debug_print("data_status %p\n", data_status);
+ if (data_status) {
+ debug_print("data_status->st_info_list %p\n", data_status->st_info_list);
+ mailimap_mailbox_data_status_free(data_status);
+ }
return MAILIMAP_ERROR_BAD_STATE;
}
return MAILIMAP_NO_ERROR;
}
-static gint imap_cmd_expunge(IMAPSession *session)
+static gint imap_cmd_expunge(IMAPSession *session, gboolean do_expunge)
{
int r;
+ if (!do_expunge)
+ return MAILIMAP_NO_ERROR;
+
if (prefs_common.work_offline &&
!inc_offline_should_override(FALSE,
_("Claws Mail needs network access in order "
return MAILIMAP_NO_ERROR;
}
+gint imap_expunge(Folder *folder, FolderItem *item)
+{
+ IMAPSession *session = imap_session_get(folder);
+ if (session == NULL)
+ return -1;
+
+ return imap_cmd_expunge(session, TRUE);
+}
+
static void imap_path_separator_subst(gchar *str, gchar separator)
{
gchar *p;
return ok;
}
- if (!session->uidplus) {
- ok = imap_cmd_expunge(session);
- } else {
- gchar *uidstr;
+ ok = imap_cmd_expunge(session, folder->account->imap_use_trash);
- uidstr = g_strdup_printf("%u", uid);
- ok = imap_cmd_expunge(session);
- g_free(uidstr);
- }
if (ok != MAILIMAP_NO_ERROR) {
log_warning(LOG_PROTOCOL, _("can't expunge\n"));
return ok;