Let the user change his mind

This commit is contained in:
Colin Leroy 2004-07-09 17:59:54 +00:00
parent a11dca502f
commit 4b6b3d711c
6 changed files with 72 additions and 16 deletions

View file

@ -1,3 +1,12 @@
2004-07-09 [colin] 0.9.11cvs17.21
* src/messageview.c
* src/pop.c
* src/pop.h
Allow user to change his mind
and postpone decision (by
unmarking the mail)
2004-07-09 [colin] 0.9.11cvs17.20
* src/messageview.c

View file

@ -14,3 +14,4 @@
( cvs diff -u -r 1.94.2.13 -r 1.94.2.14 src/messageview.c; ) > 0.9.11cvs17.18.patchset
( cvs diff -u -r 1.56.2.7 -r 1.56.2.8 src/pop.c; ) > 0.9.11cvs17.19.patchset
( cvs diff -u -r 1.94.2.14 -r 1.94.2.15 src/messageview.c; cvs diff -u -r 1.56.2.8 -r 1.56.2.9 src/pop.c; cvs diff -u -r 1.17.2.5 -r 1.17.2.6 src/pop.h; ) > 0.9.11cvs17.20.patchset
( cvs diff -u -r 1.94.2.15 -r 1.94.2.16 src/messageview.c; cvs diff -u -r 1.56.2.9 -r 1.56.2.10 src/pop.c; cvs diff -u -r 1.17.2.6 -r 1.17.2.7 src/pop.h; ) > 0.9.11cvs17.21.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=11
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=17.20
EXTRA_VERSION=17.21
EXTRA_RELEASE=
if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then

View file

@ -80,9 +80,11 @@ static void return_receipt_send_clicked (NoticeView *noticeview,
MsgInfo *msginfo);
static void partial_recv_show (NoticeView *noticeview,
MsgInfo *msginfo);
static void partial_recv_dload_clicked (NoticeView *noticeview,
static void partial_recv_dload_clicked (NoticeView *noticeview,
MsgInfo *msginfo);
static void partial_recv_del_clicked (NoticeView *noticeview,
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 (gpointer data,
guint action,
@ -1085,21 +1087,23 @@ static void partial_recv_show(NoticeView *noticeview, MsgInfo *msginfo)
break;
case POP3_PARTIAL_DLOAD_DLOAD:
text = g_strdup_printf(_("This message has been partially "
"retrieved and is planned for "
"download;\nit is %s."),
"retrieved;\nit is %s and will be downloaded."),
to_human_readable(
(off_t)(msginfo->total_size)));
button1 = _("Mark for deletion");
button1_cb = partial_recv_del_clicked;
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 and is planned for "
"deletion;\nit is %s."),
"retrieved;\nit is %s. and will be deleted."),
to_human_readable(
(off_t)(msginfo->total_size)));
button1 = _("Mark for download");
button1_cb = partial_recv_dload_clicked;
button2 = _("Unmark");
button2_cb = partial_recv_unmark_clicked;
break;
default:
return;
@ -1176,6 +1180,33 @@ static void partial_recv_del_clicked(NoticeView *noticeview,
g_free(file);
}
static void partial_recv_unmark_clicked(NoticeView *noticeview,
MsgInfo *msginfo)
{
MsgInfo *tmpmsginfo;
gchar *file;
file = procmsg_get_message_file_path(msginfo);
if (!file) {
g_warning("can't get message file path.\n");
return;
}
tmpmsginfo = procheader_parse_file(file, msginfo->flags, TRUE, TRUE);
tmpmsginfo->folder = msginfo->folder;
tmpmsginfo->msgnum = msginfo->msgnum;
if (pop3_unmark(tmpmsginfo->account_server,
tmpmsginfo->account_login,
tmpmsginfo->partial_recv, file) == 0) {
msginfo->planned_download = POP3_PARTIAL_DLOAD_UNKN;
partial_recv_show(noticeview, msginfo);
}
procmsg_msginfo_free(tmpmsginfo);
g_free(file);
}
static void select_account_cb(GtkWidget *w, gpointer data)
{
*(gint*)data = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(w)));

View file

@ -781,10 +781,13 @@ static int pop3_uidl_mark_mail(const gchar *server, const gchar *login,
fprintf(fpnew, "%s\t%ld\t%s\n",
uidl, recv_time, partial_recv);
} else {
gchar *stat = "0";
if (download == POP3_PARTIAL_DLOAD_DLOAD)
stat = filename;
if (download == POP3_PARTIAL_DLOAD_UNKN)
stat = "1";
fprintf(fpnew, "%s\t%ld\t%s\n",
uidl, recv_time,
download == POP3_PARTIAL_DLOAD_DLOAD
? filename : "0");
uidl, recv_time, stat);
}
}
fclose(fpnew);
@ -811,9 +814,10 @@ static int pop3_uidl_mark_mail(const gchar *server, const gchar *login,
buf[len]='\0';
if (start) {
start = FALSE;
fprintf(fpnew, "SC-Marked-For-Download: %d\n",
download);
printf("buf '%s'\n", buf);
if (download != POP3_PARTIAL_DLOAD_UNKN)
fprintf(fpnew, "SC-Marked-For-Download: %d\n",
download);
if(strlen(buf) > strlen("SC-Marked-For-Download: x\n")
&& !strncmp(buf, "SC-Marked-For-Download:",
strlen("SC-Marked-For-Download:"))) {
@ -841,12 +845,19 @@ int pop3_mark_for_delete(const gchar *server, const gchar *login,
}
int pop3_mark_for_download(const gchar *server, const gchar *login,
const gchar *muidl, const gchar *filename)
const gchar *muidl, const gchar *filename)
{
return pop3_uidl_mark_mail(server, login, muidl, filename,
POP3_PARTIAL_DLOAD_DLOAD);
}
int pop3_unmark(const gchar *server, const gchar *login,
const gchar *muidl, const gchar *filename)
{
return pop3_uidl_mark_mail(server, login, muidl, filename,
POP3_PARTIAL_DLOAD_UNKN);
}
gint pop3_write_uidl_list(Pop3Session *session)
{
gchar *path;

View file

@ -173,5 +173,9 @@ int pop3_mark_for_delete (const gchar *server,
const gchar *login,
const gchar *uidl,
const gchar *filename);
int pop3_unmark (const gchar *server,
const gchar *login,
const gchar *uidl,
const gchar *filename);
#endif /* __POP_H__ */