commit 75f38640c54eecc76d361e138ca86aa3f427defc
parent 3bee5e333b0cd31a94320fd358bad06344eba5b4
Author: Oliver Lowe <o@olowe.co>
Date: Mon, 18 Aug 2025 09:34:09 +1000
Remove POP partial donwload feature
Just download the whole thing
Diffstat:
15 files changed, 9 insertions(+), 709 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -83,7 +83,6 @@ claws_mail_SOURCES = \
news.c \
noticeview.c \
oauth2.c \
- partial_download.c \
password.c \
passwordstore.c \
pop.c \
diff --git a/src/account.c b/src/account.c
@@ -954,8 +954,6 @@ static void account_clone(GtkWidget *widget, gpointer data)
ACP_FASSIGN(msg_leave_hour);
ACP_FASSIGN(recv_at_getall);
ACP_FASSIGN(sd_rmmail_on_download);
- ACP_FASSIGN(enable_size_limit);
- ACP_FASSIGN(size_limit);
ACP_FASSIGN(filter_on_recv);
ACP_FASSIGN(filterhook_on_recv);
ACP_FDUP(inbox);
diff --git a/src/folder.c b/src/folder.c
@@ -49,7 +49,6 @@
#include "log.h"
#include "folder_item_prefs.h"
#include "remotefolder.h"
-#include "partial_download.h"
#include "statusbar.h"
#include "gtkutils.h"
#include "compose.h"
@@ -3392,7 +3391,6 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
if (msginfo->planned_download != 0) {
int old_planned = msginfo->planned_download;
- partial_unmark(msginfo);
/* little hack to reenable after */
msginfo->planned_download = old_planned;
}
@@ -3526,14 +3524,7 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
}
}
}
- if (newmsginfo != NULL
- && msginfo->planned_download == POP3_PARTIAL_DLOAD_DELE) {
- partial_mark_for_delete(newmsginfo);
- }
- if (newmsginfo != NULL
- && msginfo->planned_download == POP3_PARTIAL_DLOAD_DLOAD) {
- partial_mark_for_download(newmsginfo);
- }
+
if (!MSG_IS_POSTFILTERED (msginfo->flags)) {
procmsg_msginfo_set_flags ( msginfo, MSG_POSTFILTERED, 0);
if (newmsginfo) {
@@ -3543,7 +3534,6 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
}
procmsg_msginfo_free(&newmsginfo);
-
if (num > lastnum)
lastnum = num;
}
diff --git a/src/folderview.c b/src/folderview.c
@@ -50,7 +50,6 @@
#include "statusbar.h"
#include "hooks.h"
#include "folderutils.h"
-#include "partial_download.h"
#include "prefs_folder_column.h"
#include "quicksearch.h"
#include "manual.h"
@@ -2454,10 +2453,6 @@ static void folderview_empty_trash_cb(GtkAction *action, gpointer data)
MsgInfo * msginfo = (MsgInfo *) cur->data;
if (MSG_IS_LOCKED(msginfo->flags))
continue;
- /* is it partially received? (partial_recv isn't cached) */
- if (msginfo->total_size != 0 &&
- msginfo->size != (off_t)msginfo->total_size)
- partial_mark_for_delete(msginfo);
}
procmsg_msg_list_free(mlist);
diff --git a/src/messageview.c b/src/messageview.c
@@ -55,7 +55,6 @@
#include "send_message.h"
#include "stock_pixmap.h"
#include "hooks.h"
-#include "partial_download.h"
#include "inc.h"
#include "log.h"
#include "privacy.h"
@@ -80,14 +79,6 @@ static gboolean key_pressed (GtkWidget *widget,
GdkEventKey *event,
MessageView *messageview);
-static void partial_recv_show (NoticeView *noticeview,
- MsgInfo *msginfo);
-static void partial_recv_dload_clicked (NoticeView *noticeview,
- MsgInfo *msginfo);
-static void partial_recv_del_clicked (NoticeView *noticeview,
- MsgInfo *msginfo);
-static void partial_recv_unmark_clicked (NoticeView *noticeview,
- MsgInfo *msginfo);
static void save_as_cb (GtkAction *action,
gpointer data);
void messageview_save_as (MessageView *messageview);
@@ -1072,12 +1063,6 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
main_create_mailing_list_menu(messageview->mainwin, messageview->msginfo);
- if (messageview->msginfo && messageview->msginfo->extradata
- && messageview->msginfo->extradata->partial_recv
- && !noticeview_is_visible(messageview->noticeview))
- partial_recv_show(messageview->noticeview,
- messageview->msginfo);
-
if (find_broken_part(mimeinfo) != NULL) {
noticeview_set_icon(messageview->noticeview,
STOCK_PIXMAP_NOTICE_WARN);
@@ -1452,123 +1437,6 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
return mimeview_pass_key_press_event(messageview->mimeview, event);
}
-static void messageview_show_partial_display_cb(NoticeView *noticeview, MessageView *messageview)
-{
- messageview->show_full_text = TRUE;
- main_window_cursor_wait(mainwindow_get_mainwindow());
- noticeview_hide(messageview->noticeview);
- messageview->partial_display_shown = FALSE;
- GTK_EVENTS_FLUSH();
- mimeview_handle_cmd(messageview->mimeview, "cm://display_as_text", NULL, NULL);
- main_window_cursor_normal(mainwindow_get_mainwindow());
-}
-
-void messageview_show_partial_display(MessageView *messageview, MsgInfo *msginfo,
- size_t length)
-{
- gchar *msg = g_strdup_printf(_("Show all %s."), to_human_readable((goffset)length));
- noticeview_set_icon(messageview->noticeview, STOCK_PIXMAP_NOTICE_WARN);
- noticeview_set_text(messageview->noticeview, _("Only the first megabyte of text is shown."));
- noticeview_set_button_text(messageview->noticeview, msg);
- g_free(msg);
- noticeview_set_button_press_callback(messageview->noticeview,
- G_CALLBACK(messageview_show_partial_display_cb),
- (gpointer) messageview);
- noticeview_show(messageview->noticeview);
- messageview->partial_display_shown = TRUE;
-}
-
-static void partial_recv_show(NoticeView *noticeview, MsgInfo *msginfo)
-{
- gchar *text = NULL;
- gchar *button1 = NULL;
- gchar *button2 = NULL;
- void *button1_cb = NULL;
- void *button2_cb = NULL;
-
- if (!msginfo->extradata)
- return;
- if (!partial_msg_in_uidl_list(msginfo)) {
- text = g_strdup_printf(_("This message has been partially "
- "retrieved,\nand has been deleted from the "
- "server."));
- } else {
- switch (msginfo->planned_download) {
- case POP3_PARTIAL_DLOAD_UNKN:
- text = g_strdup_printf(_("This message has been "
- "partially retrieved;\nit is %s."),
- to_human_readable(
- (goffset)(msginfo->total_size)));
- button1 = _("Mark for download");
- button2 = _("Mark for deletion");
- button1_cb = partial_recv_dload_clicked;
- button2_cb = partial_recv_del_clicked;
- break;
- case POP3_PARTIAL_DLOAD_DLOAD:
- text = g_strdup_printf(_("This message has been "
- "partially retrieved;\nit is %s and "
- "will be downloaded."),
- to_human_readable(
- (goffset)(msginfo->total_size)));
- button1 = _("Unmark");
- button1_cb = partial_recv_unmark_clicked;
- button2 = _("Mark for deletion");
- button2_cb = partial_recv_del_clicked;
- break;
- case POP3_PARTIAL_DLOAD_DELE:
- text = g_strdup_printf(_("This message has been "
- "partially retrieved;\nit is %s and "
- "will be deleted."),
- to_human_readable(
- (goffset)(msginfo->total_size)));
- button1 = _("Mark for download");
- button1_cb = partial_recv_dload_clicked;
- button2 = _("Unmark");
- button2_cb = partial_recv_unmark_clicked;
- break;
- default:
- return;
- }
- }
-
- noticeview_set_icon(noticeview, STOCK_PIXMAP_NOTICE_WARN);
- noticeview_set_text(noticeview, text);
- g_free(text);
- noticeview_set_button_text(noticeview, button1);
- noticeview_set_button_press_callback(noticeview,
- G_CALLBACK(button1_cb), (gpointer) msginfo);
-
- noticeview_set_2ndbutton_text(noticeview, button2);
- noticeview_set_2ndbutton_press_callback(noticeview,
- G_CALLBACK(button2_cb), (gpointer) msginfo);
-
- noticeview_show(noticeview);
-}
-
-static void partial_recv_dload_clicked(NoticeView *noticeview,
- MsgInfo *msginfo)
-{
- if (partial_mark_for_download(msginfo) == 0) {
- partial_recv_show(noticeview, msginfo);
- }
-}
-
-static void partial_recv_del_clicked(NoticeView *noticeview,
- MsgInfo *msginfo)
-{
- if (partial_mark_for_delete(msginfo) == 0) {
- partial_recv_show(noticeview, msginfo);
- }
-}
-
-static void partial_recv_unmark_clicked(NoticeView *noticeview,
- MsgInfo *msginfo)
-{
- if (partial_unmark(msginfo) == 0) {
- partial_recv_show(noticeview, msginfo);
- }
-}
-
static void select_account_cb(GtkWidget *w, gpointer data)
{
*(gint*)data = combobox_get_active_data(GTK_COMBO_BOX(w));
diff --git a/src/messageview.h b/src/messageview.h
@@ -64,16 +64,15 @@ struct _MessageView
/* this message was filtered by an action */
gboolean filtered;
-
+
/* From messageview_show */
gboolean all_headers;
gint msginfo_update_callback_id;
gboolean updating;
gboolean deferred_destroy;
-
+
gboolean show_full_text;
- gboolean partial_display_shown;
gboolean update_needed;
GtkUIManager *ui_manager;
GList *trail;
@@ -129,9 +128,7 @@ void messageview_print (MsgInfo *msginfo,
gint sel_end,
gint partnum);
void messageview_list_urls (MessageView *msgview);
-void messageview_show_partial_display (MessageView *msgview,
- MsgInfo *msginfo,
- size_t length);
+
gboolean messageview_nav_has_prev(MessageView *messageview);
gboolean messageview_nav_has_next(MessageView *messageview);
MsgInfo *messageview_nav_get_prev(MessageView *messageview);
diff --git a/src/mimeview.c b/src/mimeview.c
@@ -906,11 +906,6 @@ gboolean mimeview_show_part(MimeView *mimeview, MimeInfo *partinfo)
{
MimeViewer *viewer;
- if (mimeview->messageview->partial_display_shown) {
- noticeview_hide(mimeview->messageview->noticeview);
- mimeview->messageview->partial_display_shown = FALSE;
- }
-
viewer = get_viewer_for_mimeinfo(mimeview, partinfo);
if (viewer == NULL) {
if (mimeview->mimeviewer != NULL)
diff --git a/src/partial_download.c b/src/partial_download.c
@@ -1,438 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2018 Colin Leroy <colin@colino.net>
- * and the Claws Mail team
- *
- * This program 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.
- *
- * This program 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/>.
- *
- */
-
-/* Partial download:
- * A mail which has been completely downloaded will have no special headers,
- * and its entry in the uidl file will end by 0 (POP3_TOTALLY_RECEIVED);
- *
- * A mail which has been partially downloaded will have some special headers,
- * and its entry in the uidl file will first be 1 (POP3_PARTIALLY_RECEIVED);
- * the special headers will be including "SC-Marked-For-Download" which can
- * have three values:
- * 0 (POP3_PARTIAL_DLOAD_UNKN) meaning that the user has not yet chosen to
- * download the mail or let it be deleted - this header is absent until the
- * user first chooses an action
- * 1 (POP3_PARTIAL_DLOAD_DLOAD) meaning that the user wants to finish
- * downloading the mail
- * 2 (POP3_PARTIAL_DLOAD_DELE) meaning that the user does not want to finish
- * downloading the mail
- * When updating this header to POP3_PARTIAL_DLOAD_DLOAD, the uidl line of
- * this mail will end with the mail's physical path, which Claws Mail will remove
- * after having downloaded the complete mail. msg->partial_recv will equal
- * 2 (POP3_MUST_COMPLETE_RECV).
- * When updating this header to POP3_PARTIAL_DLOAD_DELE, the uidl line of
- * this mail will be 0 (POP3_TOTALLY_RECEIVED), which will let Claws Mail delete
- * this mail from the server as soon as the leave_time preference specifies.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#include "claws-features.h"
-#endif
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#include "partial_download.h"
-#include "utils.h"
-#include "pop.h"
-#include "folder.h"
-#include "procheader.h"
-#include "msgcache.h"
-#include "file-utils.h"
-
-int partial_msg_in_uidl_list(MsgInfo *msginfo)
-{
- gchar *path;
- FILE *fp;
- gchar buf[POPBUFSIZE];
- gchar uidl[POPBUFSIZE];
- time_t recv_time;
- time_t now;
- gchar *sanitized_uid = NULL;
-
- if (!msginfo->extradata)
- return FALSE;
-
- sanitized_uid = g_strdup(msginfo->extradata->account_login);
-
- subst_for_filename(sanitized_uid);
-
- if (!msginfo->extradata->account_server
- || !msginfo->extradata->account_login
- || !msginfo->extradata->partial_recv)
- return FALSE;
-
- path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl", G_DIR_SEPARATOR_S, msginfo->extradata->account_server,
- "-", msginfo->extradata->account_login, NULL);
- if ((fp = g_fopen(path, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(path, "g_fopen");
- g_free(path);
- path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl-", msginfo->extradata->account_server,
- "-", sanitized_uid, NULL);
- if ((fp = g_fopen(path, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(path, "g_fopen");
- g_free(sanitized_uid);
- g_free(path);
- return FALSE;
- }
- }
- g_free(sanitized_uid);
- g_free(path);
-
- now = time(NULL);
-
- while (fgets(buf, sizeof(buf), fp) != NULL) {
- gchar tmp[POPBUFSIZE];
- strretchomp(buf);
- recv_time = RECV_TIME_NONE;
-
- if (sscanf(buf, "%s\t%ld\t%s", uidl, (long int *) &recv_time,
- tmp) < 2) {
- if (sscanf(buf, "%s", uidl) != 1)
- continue;
- else {
- recv_time = now;
- }
- }
- if (!strcmp(uidl, msginfo->extradata->partial_recv)) {
- fclose(fp);
- return TRUE;
- }
- }
-
- fclose(fp);
- return FALSE;
-}
-
-static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
-{
- gchar *path;
- gchar *pathnew;
- FILE *fp;
- FILE *fpnew;
- gchar buf[POPBUFSIZE];
- gchar uidl[POPBUFSIZE];
- time_t recv_time;
- time_t now;
- gchar partial_recv[POPBUFSIZE];
- int err = -1;
- gchar *filename;
- MsgInfo *tinfo;
- gchar *sanitized_uid = NULL;
-
- filename = procmsg_get_message_file_path(msginfo);
- if (!filename) {
- g_warning("can't get message file path");
- return err;
- }
- tinfo = procheader_parse_file(filename, msginfo->flags, TRUE, TRUE);
-
- if (!tinfo->extradata) {
- g_free(filename);
- return err;
- }
-
- sanitized_uid = g_strdup(tinfo->extradata->account_login);
- subst_for_filename(sanitized_uid);
-
- if (!tinfo->extradata->account_server
- || !tinfo->extradata->account_login
- || !tinfo->extradata->partial_recv) {
- goto bail;
- }
- path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl", G_DIR_SEPARATOR_S, tinfo->extradata->account_server,
- "-", sanitized_uid, NULL);
-
- if ((fp = g_fopen(path, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(path, "g_fopen");
- g_free(path);
- path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl-", tinfo->extradata->account_server,
- "-", tinfo->extradata->account_login, NULL);
- if ((fp = g_fopen(path, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(path, "g_fopen");
- g_free(path);
- goto bail;
- }
- }
-
- pathnew = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl", G_DIR_SEPARATOR_S, tinfo->extradata->account_server,
- "-", sanitized_uid, ".new", NULL);
-
- g_free(sanitized_uid);
-
- if ((fpnew = g_fopen(pathnew, "wb")) == NULL) {
- FILE_OP_ERROR(pathnew, "g_fopen");
- fclose(fp);
- g_free(path);
- g_free(pathnew);
- goto bail;
- }
-
- now = time(NULL);
-
- while (fgets(buf, sizeof(buf), fp) != NULL) {
- strretchomp(buf);
- recv_time = RECV_TIME_NONE;
- sprintf(partial_recv,"0");
-
- if (sscanf(buf, "%s\t%ld\t%s",
- uidl, (long int *) &recv_time, partial_recv) < 2) {
- if (sscanf(buf, "%s", uidl) != 1)
- continue;
- else {
- recv_time = now;
- }
- }
- if (strcmp(tinfo->extradata->partial_recv, uidl)) {
- if (fprintf(fpnew, "%s\t%ld\t%s\n",
- uidl, (long int) recv_time, partial_recv) < 0) {
- FILE_OP_ERROR(pathnew, "fprintf");
- fclose(fpnew);
- fclose(fp);
- g_free(path);
- g_free(pathnew);
- goto bail;
- }
- } else {
- gchar *stat = NULL;
- if (download == POP3_PARTIAL_DLOAD_DLOAD) {
- gchar *folder_id = folder_item_get_identifier(
- msginfo->folder);
- stat = g_strdup_printf("%s:%d",
- folder_id, msginfo->msgnum);
- g_free(folder_id);
- }
- else if (download == POP3_PARTIAL_DLOAD_UNKN)
- stat = g_strdup("1");
- else if (download == POP3_PARTIAL_DLOAD_DELE)
- stat = g_strdup("0");
-
- if (fprintf(fpnew, "%s\t%ld\t%s\n",
- uidl, (long int) recv_time, stat) < 0) {
- FILE_OP_ERROR(pathnew, "fprintf");
- fclose(fpnew);
- fclose(fp);
- g_free(path);
- g_free(pathnew);
- goto bail;
- }
- g_free(stat);
- }
- }
- if (safe_fclose(fpnew) == EOF) {
- FILE_OP_ERROR(pathnew, "fclose");
- fclose(fp);
- g_free(path);
- g_free(pathnew);
- goto bail;
- }
- fclose(fp);
-
- move_file(pathnew, path, TRUE);
-
- g_free(path);
- g_free(pathnew);
-
- if ((fp = g_fopen(filename,"rb")) == NULL) {
- FILE_OP_ERROR(filename, "g_fopen");
- goto bail;
- }
- pathnew = g_strdup_printf("%s.new", filename);
- if ((fpnew = g_fopen(pathnew, "wb")) == NULL) {
- FILE_OP_ERROR(pathnew, "g_fopen");
- fclose(fp);
- g_free(pathnew);
- goto bail;
- }
-
- if (fprintf(fpnew, "SC-Marked-For-Download: %d\n",
- download) < 0) {
- FILE_OP_ERROR(pathnew, "fprintf");
- fclose(fpnew);
- fclose(fp);
- g_free(pathnew);
- goto bail;
- }
- while (fgets(buf, sizeof(buf)-1, fp) != NULL) {
- if(strlen(buf) > strlen("SC-Marked-For-Download: x\n")
- && !strncmp(buf, "SC-Marked-For-Download:",
- strlen("SC-Marked-For-Download:"))) {
- if (fprintf(fpnew, "%s",
- buf+strlen("SC-Marked-For-Download: x\n")) < 0) {
- FILE_OP_ERROR(pathnew, "fprintf");
- fclose(fpnew);
- fclose(fp);
- g_free(pathnew);
- goto bail;
- }
- continue;
- } else if (strlen(buf) == strlen("SC-Marked-For-Download: x\n")
- && !strncmp(buf, "SC-Marked-For-Download:",
- strlen("SC-Marked-For-Download:"))) {
- continue;
- }
- if (fprintf(fpnew, "%s", buf) < 0) {
- FILE_OP_ERROR(pathnew, "fprintf");
- fclose(fpnew);
- fclose(fp);
- g_free(pathnew);
- goto bail;
- }
- }
- if (safe_fclose(fpnew) == EOF) {
- FILE_OP_ERROR(pathnew, "fclose");
- fclose(fp);
- g_free(pathnew);
- goto bail;
- }
-
- fclose(fp);
- if (rename_force(pathnew, filename) != 0) {
- g_free(pathnew);
- goto bail;
- }
-
- g_free(pathnew);
- msginfo->planned_download = download;
- msgcache_update_msg(msginfo->folder->cache, msginfo);
-
- err = 0;
-bail:
- g_free(filename);
- procmsg_msginfo_free(&tinfo);
-
- return err;
-}
-
-int partial_mark_for_delete(MsgInfo *msginfo)
-{
- return partial_uidl_mark_mail(msginfo, POP3_PARTIAL_DLOAD_DELE);
-}
-
-int partial_mark_for_download(MsgInfo *msginfo)
-{
- return partial_uidl_mark_mail(msginfo, POP3_PARTIAL_DLOAD_DLOAD);
-}
-
-int partial_unmark(MsgInfo *msginfo)
-{
- return partial_uidl_mark_mail(msginfo, POP3_PARTIAL_DLOAD_UNKN);
-}
-
-void partial_delete_old(const gchar *file)
-{
- gchar *id = g_strdup(file);
- gchar *snum = strrchr(file, ':');
- int num = 0;
- FolderItem *item = NULL;
-
- debug_print("too big message updated, should remove %s\n", file?file:"(null)");
-
- if (snum) {
- snum++;
- } else {
- g_free(id);
- return; /* not a real problem */
- }
-
- num = atoi(snum);
-
- if (strrchr(id, ':'))
- *(strrchr(id, ':'))='\0';
-
- item = folder_find_item_from_identifier(id);
- if (item) {
- debug_print("removing %d in %s\n", num, id);
- folder_item_remove_msg(item, num);
- }
- g_free(id);
-}
-
-gchar *partial_get_filename(const gchar *server, const gchar *login,
- const gchar *muidl)
-{
- gchar *path;
- gchar *result = NULL;
- FILE *fp;
- gchar buf[POPBUFSIZE];
- gchar uidl[POPBUFSIZE];
- time_t recv_time;
- time_t now;
- gchar *sanitized_uid = g_strdup(login);
-
- subst_for_filename(sanitized_uid);
-
- path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl", G_DIR_SEPARATOR_S,
- server, "-", sanitized_uid, NULL);
- if ((fp = g_fopen(path, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(path, "g_fopen");
- g_free(path);
- path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
- "uidl-", server,
- "-", sanitized_uid, NULL);
- if ((fp = g_fopen(path, "rb")) == NULL) {
- if (ENOENT != errno) FILE_OP_ERROR(path, "g_fopen");
- g_free(sanitized_uid);
- g_free(path);
- return result;
- }
- }
- g_free(sanitized_uid);
- g_free(path);
-
- now = time(NULL);
-
- while (fgets(buf, sizeof(buf), fp) != NULL) {
- gchar tmp[POPBUFSIZE];
- strretchomp(buf);
- recv_time = RECV_TIME_NONE;
-
- if (sscanf(buf, "%s\t%ld\t%s", uidl, (long int *) &recv_time,
- tmp) < 2) {
- if (sscanf(buf, "%s", uidl) != 1)
- continue;
- else {
- recv_time = now;
- }
- }
- if (!strcmp(muidl, uidl)) {
- result = g_strdup(tmp);
- break;
- }
- }
-
- fclose(fp);
-
- return result;
-}
diff --git a/src/partial_download.h b/src/partial_download.h
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Colin Leroy <colin@colino.net>
+ * Copyright (C) 1999-2012 Colin Leroy <colin@colino.net>
* and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifndef __PARTIAL_DOWNLOAD_H__
#define __PARTIAL_DOWNLOAD_H__
@@ -41,13 +41,4 @@ typedef enum {
POP3_MUST_COMPLETE_RECV = 2
} PartialDownloadStatus;
-gint partial_msg_in_uidl_list (MsgInfo *msginfo);
-int partial_mark_for_download(MsgInfo *msginfo);
-int partial_mark_for_delete (MsgInfo *msginfo);
-int partial_unmark (MsgInfo *msginfo);
-gchar *partial_get_filename (const gchar *server,
- const gchar *login,
- const gchar *muidl);
-void partial_delete_old (const gchar *file);
-
#endif /* __PARTIAL_DOWNLOAD_H__ */
diff --git a/src/pop.c b/src/pop.c
@@ -33,9 +33,9 @@
#include "pop.h"
#include "md5.h"
+#include "partial_download.h"
#include "prefs_account.h"
#include "utils.h"
-#include "partial_download.h"
#include "log.h"
#include "hooks.h"
#include "file-utils.h"
@@ -320,7 +320,6 @@ static gint pop3_getrange_uidl_recv(Pop3Session *session, const gchar *data,
gint buf_len;
guint32 num;
time_t recv_time;
- gint partial_recv;
const gchar *p = data;
const gchar *lastp = data + len;
const gchar *newline;
@@ -353,17 +352,6 @@ static gint pop3_getrange_uidl_recv(Pop3Session *session, const gchar *data,
debug_print("num %d uidl %s: unknown\n", num, id);
}
- partial_recv = (gint)(GPOINTER_TO_INT(g_hash_table_lookup(
- session->partial_recv_table, id)));
-
- if (recv_time != RECV_TIME_NONE
- || partial_recv != POP3_TOTALLY_RECEIVED) {
- session->msg[num].received =
- (partial_recv != POP3_MUST_COMPLETE_RECV);
- session->msg[num].partial_recv = partial_recv;
- if (partial_recv == POP3_MUST_COMPLETE_RECV)
- session->new_msg_exist = TRUE;
- }
if (!session->new_msg_exist &&
(recv_time == RECV_TIME_NONE ||
session->ac_prefs->rmmail)) {
@@ -452,21 +440,8 @@ static gint pop3_retr_recv(Pop3Session *session, const gchar *data, guint len)
}
g_free(mail_receive_data.data);
- if (session->msg[session->cur_msg].partial_recv
- == POP3_MUST_COMPLETE_RECV) {
- gchar *old_file = partial_get_filename(
- session->ac_prefs->recv_server,
- session->ac_prefs->userid,
- session->msg[session->cur_msg].uidl);
-
- if (old_file) {
- partial_delete_old(old_file);
- g_free(old_file);
- }
- }
/* drop_ok: 0: success 1: don't receive -1: error */
drop_ok = session->drop_message(session, file);
-
g_free(file);
if (drop_ok < 0) {
session->error_val = PS_IOERR;
@@ -915,15 +890,10 @@ static Pop3State pop3_lookup_next(Pop3Session *session)
Pop3MsgInfo *msg;
PrefsAccount *ac = session->ac_prefs;
gint size;
- gboolean size_limit_over;
for (;;) {
msg = &session->msg[session->cur_msg];
size = msg->size;
- size_limit_over =
- (ac->enable_size_limit &&
- ac->size_limit > 0 &&
- size > ac->size_limit * 1024);
if (ac->rmmail &&
msg->recv_time != RECV_TIME_NONE &&
@@ -940,20 +910,7 @@ static Pop3State pop3_lookup_next(Pop3Session *session)
return POP3_DELETE;
}
- if (size_limit_over) {
- if (!msg->received && msg->partial_recv !=
- POP3_MUST_COMPLETE_RECV) {
- pop3_top_send(session, ac->size_limit);
- return POP3_TOP;
- } else if (msg->partial_recv == POP3_MUST_COMPLETE_RECV)
- break;
-
- log_message(LOG_PROTOCOL,
- _("POP: Skipping message %d [%s] (%d bytes)\n"),
- session->cur_msg, msg->uidl?msg->uidl:" ", size);
- }
-
- if (size == 0 || msg->received || size_limit_over) {
+ if (size == 0 || msg->received) {
session->cur_total_bytes += size;
if (session->cur_msg == session->count) {
pop3_logout_send(session);
diff --git a/src/prefs_account.c b/src/prefs_account.c
@@ -155,8 +155,6 @@ typedef struct ReceivePage
GtkWidget *rmmail_checkbtn;
GtkWidget *leave_time_spinbtn;
GtkWidget *leave_hour_spinbtn;
- GtkWidget *size_limit_checkbtn;
- GtkWidget *size_limit_spinbtn;
GtkWidget *inbox_label;
GtkWidget *inbox_entry;
GtkWidget *inbox_btn;
@@ -541,13 +539,6 @@ static PrefParam receive_param[] = {
&receive_page.leave_hour_spinbtn,
prefs_set_data_from_spinbtn, prefs_set_spinbtn},
- {"enable_size_limit", "FALSE", &tmp_ac_prefs.enable_size_limit, P_BOOL,
- &receive_page.size_limit_checkbtn,
- prefs_set_data_from_toggle, prefs_set_toggle},
- {"size_limit", "1024", &tmp_ac_prefs.size_limit, P_INT,
- &receive_page.size_limit_spinbtn,
- prefs_set_data_from_spinbtn, prefs_set_spinbtn},
-
{"filter_on_receive", "TRUE", &tmp_ac_prefs.filter_on_recv, P_BOOL,
&receive_page.filter_on_recv_checkbtn,
prefs_set_data_from_toggle, prefs_set_toggle},
@@ -1504,8 +1495,6 @@ static void receive_create_widget_func(PrefsPage * _page,
GtkWidget *leave_time_spinbtn;
GtkWidget *leave_hour_label;
GtkWidget *leave_hour_spinbtn;
- GtkWidget *size_limit_checkbtn;
- GtkWidget *size_limit_spinbtn;
GtkWidget *label;
GtkWidget *filter_on_recv_checkbtn;
GtkWidget *filterhook_on_recv_checkbtn;
@@ -1647,27 +1636,6 @@ static void receive_create_widget_func(PrefsPage * _page,
SET_TOGGLE_SENSITIVITY (rmmail_checkbtn, hbox1);
- hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_widget_show (hbox1);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
-
- PACK_CHECK_BUTTON (hbox1, size_limit_checkbtn, _("Receive size limit"));
-
- CLAWS_SET_TIP(size_limit_checkbtn,
- _("Messages over this limit will be partially retrieved. "
- "When selecting them you will be able to download them fully "
- "or delete them"));
-
- size_limit_spinbtn = gtk_spin_button_new_with_range(0, 100000, 1);
- gtk_widget_show (size_limit_spinbtn);
- gtk_box_pack_start (GTK_BOX (hbox1), size_limit_spinbtn, FALSE, FALSE, 0);
-
- label = gtk_label_new (_("KiB"));
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
-
- SET_TOGGLE_SENSITIVITY (size_limit_checkbtn, size_limit_spinbtn);
-
PACK_SPACER(vbox2, vbox3, VSPACING_NARROW_2);
hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -1879,8 +1847,6 @@ static void receive_create_widget_func(PrefsPage * _page,
page->rmmail_checkbtn = rmmail_checkbtn;
page->leave_time_spinbtn = leave_time_spinbtn;
page->leave_hour_spinbtn = leave_hour_spinbtn;
- page->size_limit_checkbtn = size_limit_checkbtn;
- page->size_limit_spinbtn = size_limit_spinbtn;
page->filter_on_recv_checkbtn = filter_on_recv_checkbtn;
page->filterhook_on_recv_checkbtn = filterhook_on_recv_checkbtn;
page->inbox_label = inbox_label;
diff --git a/src/prefs_account.h b/src/prefs_account.h
@@ -104,8 +104,6 @@ struct _PrefsAccount
gint msg_leave_hour;
gboolean recv_at_getall;
gboolean sd_rmmail_on_download;
- gboolean enable_size_limit;
- gint size_limit;
gboolean filter_on_recv;
gboolean filterhook_on_recv;
gchar *inbox;
diff --git a/src/procmsg.c b/src/procmsg.c
@@ -41,7 +41,6 @@
#include "news.h"
#include "hooks.h"
#include "msgcache.h"
-#include "partial_download.h"
#include "mainwindow.h"
#include "summaryview.h"
#include "log.h"
@@ -552,10 +551,6 @@ static void procmsg_empty_trash(FolderItem *trash)
procmsg_msginfo_free(&msginfo);
continue;
}
- if (msginfo->total_size != 0 &&
- msginfo->size != (off_t)msginfo->total_size)
- partial_mark_for_delete(msginfo);
-
procmsg_msginfo_free(&msginfo);
}
g_slist_free(mlist);
@@ -1213,8 +1208,7 @@ MsgInfo *procmsg_msginfo_get_full_info_from_file(MsgInfo *msginfo, const gchar *
msginfo->extradata->returnreceiptto = g_strdup
(full_msginfo->extradata->returnreceiptto);
if (!msginfo->extradata->partial_recv && full_msginfo->extradata->partial_recv)
- msginfo->extradata->partial_recv = g_strdup
- (full_msginfo->extradata->partial_recv);
+ msginfo->extradata->partial_recv = g_strdup(full_msginfo->extradata->partial_recv);
if (!msginfo->extradata->account_server && full_msginfo->extradata->account_server)
msginfo->extradata->account_server = g_strdup
(full_msginfo->extradata->account_server);
diff --git a/src/summaryview.c b/src/summaryview.c
@@ -67,7 +67,6 @@
#include "description_window.h"
#include "folderutils.h"
#include "quicksearch.h"
-#include "partial_download.h"
#include "log.h"
#include "manual.h"
#include "manage_window.h"
@@ -4353,9 +4352,6 @@ void summary_delete(SummaryView *summaryview)
cur = cur->next) {
GtkCMCTreeNode *row = GTK_CMCTREE_NODE(cur->data);
msginfo = gtk_cmctree_node_get_row_data(ctree, row);
- if (msginfo && msginfo->total_size != 0 &&
- msginfo->size != (goffset)msginfo->total_size)
- partial_mark_for_delete(msginfo);
}
main_window_cursor_wait(summaryview->mainwin);
diff --git a/src/textview.c b/src/textview.c
@@ -1062,12 +1062,6 @@ textview_default:
}
}
- if (continue_write == FALSE) {
- messageview_show_partial_display(
- textview->messageview,
- textview->messageview->msginfo,
- mimeinfo->length);
- }
GTK_EVENTS_FLUSH();
}