commit - 3bee5e333b0cd31a94320fd358bad06344eba5b4
commit + 75f38640c54eecc76d361e138ca86aa3f427defc
blob - 7a48c3dcd41e289873e33d8e60f280b3c2f44db5
blob + 135a926f134ca9360a905e00613cc63f7239c70f
--- src/Makefile.am
+++ src/Makefile.am
news.c \
noticeview.c \
oauth2.c \
- partial_download.c \
password.c \
passwordstore.c \
pop.c \
blob - 316af245785af05b996928bd42cd810bf55bf4a2
blob + 055d47117ef1a68d764ea6cdd22a9272f8b9f91c
--- src/account.c
+++ src/account.c
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);
blob - 879d9095471533d9a617640e1c49cf6440e7b8f4
blob + 5a25fff81334f4082ace47d1b5853a79f6ab1f55
--- src/folder.c
+++ src/folder.c
#include "log.h"
#include "folder_item_prefs.h"
#include "remotefolder.h"
-#include "partial_download.h"
#include "statusbar.h"
#include "gtkutils.h"
#include "compose.h"
if (msginfo->planned_download != 0) {
int old_planned = msginfo->planned_download;
- partial_unmark(msginfo);
/* little hack to reenable after */
msginfo->planned_download = old_planned;
}
}
}
}
- 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) {
}
procmsg_msginfo_free(&newmsginfo);
-
if (num > lastnum)
lastnum = num;
}
blob - 1c7af9df07afe91991da94997d3c9c20864bc675
blob + 7aadfc4a4aa2e719071b7a7160295a71d6e16534
--- src/folderview.c
+++ src/folderview.c
#include "statusbar.h"
#include "hooks.h"
#include "folderutils.h"
-#include "partial_download.h"
#include "prefs_folder_column.h"
#include "quicksearch.h"
#include "manual.h"
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);
blob - 9f6fe7e9a897c29e0debee787f296a682000536c
blob + 66e3096d29cb0fe9681ca9d22d6957802f6337d7
--- src/messageview.c
+++ src/messageview.c
#include "send_message.h"
#include "stock_pixmap.h"
#include "hooks.h"
-#include "partial_download.h"
#include "inc.h"
#include "log.h"
#include "privacy.h"
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);
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);
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));
blob - 073fc04323eb2410c79e42fa85bf8aba07c7fef5
blob + 1b08bde0b9e28881fdaebc9cc34857e075bf7f2d
--- src/messageview.h
+++ src/messageview.h
/* 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;
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);
blob - 61b4853b7159f0d8a8ed9aa697533052d16ad3cc
blob + 53a6a67275cbad8092750af8cb3b38c15342855a
--- src/mimeview.c
+++ src/mimeview.c
{
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)
blob - 7f86ad7c18a2d37d95ea9c1b4fdb9e483068e454 (mode 644)
blob + /dev/null
--- src/partial_download.c
+++ /dev/null
-/*
- * 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;
-}
blob - 2a4119af7ca34e9e03caa496068d71fca4c2093b
blob + f20c8b936904854f81c0029cdfa06c4b55df14f8
--- src/partial_download.h
+++ src/partial_download.h
/*
* 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
*
* 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__
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__ */
blob - 86b7281b1b62cd387d84baeddde0b9e94b0a8431
blob + e268fa1859b5b3f30641cfe7f585b4bd99e54f42
--- src/pop.c
+++ src/pop.c
#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"
gint buf_len;
guint32 num;
time_t recv_time;
- gint partial_recv;
const gchar *p = data;
const gchar *lastp = data + len;
const gchar *newline;
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)) {
}
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;
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 &&
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);
blob - e2108de4718a696e33b4ebdfa37ce23f8e20dbe0
blob + 9e3a8faf8b1f845c48186163d336ec2128f905a9
--- src/prefs_account.c
+++ src/prefs_account.c
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;
&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},
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;
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);
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;
blob - 4af20f630971559f357827e09ae14dd1f0c2f339
blob + 0adc07be8725ec8e38d07b0d276a91f0bfd00876
--- src/prefs_account.h
+++ src/prefs_account.h
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;
blob - 5a5cc9537a31c7e8a2c407b33bbfdcd665e79fb5
blob + 6fcc5530c5b690d052467aa0b0b92fa1d1bbf37d
--- src/procmsg.c
+++ src/procmsg.c
#include "news.h"
#include "hooks.h"
#include "msgcache.h"
-#include "partial_download.h"
#include "mainwindow.h"
#include "summaryview.h"
#include "log.h"
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);
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);
blob - 5d166fdcac4a887d5fcce8005496c17f9afc5c8f
blob + 660b4aad1cc3d7ebfe49dfa9418ace54b72c5ae0
--- src/summaryview.c
+++ src/summaryview.c
#include "description_window.h"
#include "folderutils.h"
#include "quicksearch.h"
-#include "partial_download.h"
#include "log.h"
#include "manual.h"
#include "manage_window.h"
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);
blob - 765ab08825f0358d7561ae40f127b6689f42bf28
blob + 70499fccc5c2e9bf22147a7d46d661fa6455d48d
--- src/textview.c
+++ src/textview.c
}
}
- if (continue_write == FALSE) {
- messageview_show_partial_display(
- textview->messageview,
- textview->messageview->msginfo,
- mimeinfo->length);
- }
GTK_EVENTS_FLUSH();
}