Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 97754 | Differences between
and this patch

Collapse All | Expand All

(-)mutt-1.5.5.1-orig/commands.c (-4 / +8 lines)
Lines 663-673 void _mutt_save_message (HEADER *h, CONT Link Here
663
  if (decode || decrypt)
663
  if (decode || decrypt)
664
    mutt_parse_mime_message (Context, h);
664
    mutt_parse_mime_message (Context, h);
665
665
666
  if (mutt_append_message (ctx, Context, h, cmflags, chflags) == 0 && delete)
666
  if (mutt_append_message (ctx, Context, h, cmflags, chflags) == 0)
667
  {
667
  {
668
    mutt_set_flag (Context, h, M_DELETE, 1);
668
    if (delete)
669
    if (option (OPTDELETEUNTAG))
669
    {
670
      mutt_set_flag (Context, h, M_TAG, 0);
670
      mutt_set_flag (Context, h, M_DELETE, 1);
671
      if (option (OPTDELETEUNTAG))
672
	mutt_set_flag (Context, h, M_TAG, 0);
673
    }
674
    mutt_set_flag (Context, h, M_APPENDED, 1);
671
  }
675
  }
672
}
676
}
673
677
(-)mutt-1.5.5.1-orig/flags.c (-1 / +18 lines)
Lines 65-71 void _mutt_set_flag (CONTEXT *ctx, HEADE Link Here
65
      else if (h->deleted)
65
      else if (h->deleted)
66
      {
66
      {
67
	h->deleted = 0;
67
	h->deleted = 0;
68
	if (upd_ctx) ctx->deleted--;
68
	if (upd_ctx)
69
	{
70
	  ctx->deleted--;
71
	  if (h->appended)
72
	    ctx->appended--;
73
	}
74
	h->appended = 0; /* when undeleting, also reset the appended flag */
69
#ifdef USE_IMAP
75
#ifdef USE_IMAP
70
        /* see my comment above */
76
        /* see my comment above */
71
	if (ctx->magic == M_IMAP) 
77
	if (ctx->magic == M_IMAP) 
Lines 84-89 void _mutt_set_flag (CONTEXT *ctx, HEADE Link Here
84
	 */
90
	 */
85
	if (ctx->magic == M_MAILDIR && upd_ctx && h->trash)
91
	if (ctx->magic == M_MAILDIR && upd_ctx && h->trash)
86
	  ctx->changed = 1;
92
	  ctx->changed = 1;
93
      }
94
      break;
95
96
    case M_APPENDED:
97
      if (bf)
98
      {
99
	if (!h->appended)
100
	{
101
	  h->appended = 1;
102
	  if (upd_ctx) ctx->appended++;
103
	}
87
      }
104
      }
88
      break;
105
      break;
89
106
(-)mutt-1.5.5.1-orig/globals.h (+1 lines)
Lines 110-115 WHERE char *StChars; Link Here
110
WHERE char *Status;
110
WHERE char *Status;
111
WHERE char *Tempdir;
111
WHERE char *Tempdir;
112
WHERE char *Tochars;
112
WHERE char *Tochars;
113
WHERE char *TrashPath;
113
WHERE char *Username;
114
WHERE char *Username;
114
WHERE char *Visual;
115
WHERE char *Visual;
115
116
(-)mutt-1.5.5.1-orig/imap/message.c (+2 lines)
Lines 624-629 int imap_copy_messages (CONTEXT* ctx, HE Link Here
624
        if (ctx->hdrs[n]->tagged)
624
        if (ctx->hdrs[n]->tagged)
625
        {
625
        {
626
          mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1);
626
          mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1);
627
	  mutt_set_flag (ctx, ctx->hdrs[n], M_APPENDED, 1);
627
          if (option (OPTDELETEUNTAG))
628
          if (option (OPTDELETEUNTAG))
628
            mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0);
629
            mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0);
629
        }
630
        }
Lines 631-636 int imap_copy_messages (CONTEXT* ctx, HE Link Here
631
    else
632
    else
632
    {
633
    {
633
      mutt_set_flag (ctx, h, M_DELETE, 1);
634
      mutt_set_flag (ctx, h, M_DELETE, 1);
635
      mutt_set_flag (ctx, h, M_APPENDED, 1);
634
      if (option (OPTDELETEUNTAG))
636
      if (option (OPTDELETEUNTAG))
635
        mutt_set_flag (ctx, h, M_TAG, 0);
637
        mutt_set_flag (ctx, h, M_TAG, 0);
636
    }
638
    }
(-)mutt-1.5.5.1-orig/init.h (+10 lines)
Lines 2559-2564 struct option_t MuttVars[] = { Link Here
2559
  ** by \fIyou\fP.  The sixth character is used to indicate when a mail
2559
  ** by \fIyou\fP.  The sixth character is used to indicate when a mail
2560
  ** was sent to a mailing-list you subscribe to (default: L).
2560
  ** was sent to a mailing-list you subscribe to (default: L).
2561
  */
2561
  */
2562
  { "trash",		DT_PATH, R_NONE, UL &TrashPath, 0 },
2563
  /*
2564
  ** .pp
2565
  ** If set, this variable specifies the path of the trash folder where the
2566
  ** mails marked for deletion will be moved, instead of being irremediably
2567
  ** purged.
2568
  ** .pp
2569
  ** NOTE: When you delete a message in the trash folder, it is really
2570
  ** deleted, so that you have a way to clean the trash.
2571
  */
2562
#ifdef USE_SOCKET
2572
#ifdef USE_SOCKET
2563
  { "tunnel",            DT_STR, R_NONE, UL &Tunnel, UL 0 },
2573
  { "tunnel",            DT_STR, R_NONE, UL &Tunnel, UL 0 },
2564
  /*
2574
  /*
(-)mutt-1.5.5.1-orig/mutt.h (+3 lines)
Lines 197-202 enum Link Here
197
  M_DELETE,
197
  M_DELETE,
198
  M_UNDELETE,
198
  M_UNDELETE,
199
  M_DELETED,
199
  M_DELETED,
200
  M_APPENDED,
200
  M_FLAG,
201
  M_FLAG,
201
  M_TAG,
202
  M_TAG,
202
  M_UNTAG,
203
  M_UNTAG,
Lines 636-641 typedef struct header Link Here
636
  unsigned int mime : 1;    		/* has a Mime-Version header? */
637
  unsigned int mime : 1;    		/* has a Mime-Version header? */
637
  unsigned int flagged : 1; 		/* marked important? */
638
  unsigned int flagged : 1; 		/* marked important? */
638
  unsigned int tagged : 1;
639
  unsigned int tagged : 1;
640
  unsigned int appended : 1; /* has been saved */
639
  unsigned int deleted : 1;
641
  unsigned int deleted : 1;
640
  unsigned int changed : 1;
642
  unsigned int changed : 1;
641
  unsigned int attach_del : 1; 		/* has an attachment marked for deletion */
643
  unsigned int attach_del : 1; 		/* has an attachment marked for deletion */
Lines 764-769 typedef struct Link Here
764
  int new;			/* how many new messages? */
766
  int new;			/* how many new messages? */
765
  int unread;			/* how many unread messages? */
767
  int unread;			/* how many unread messages? */
766
  int deleted;			/* how many deleted messages */
768
  int deleted;			/* how many deleted messages */
769
  int appended;                 /* how many saved messages? */
767
  int flagged;			/* how many flagged messages */
770
  int flagged;			/* how many flagged messages */
768
  int msgnotreadyet;		/* which msg "new" in pager, -1 if none */
771
  int msgnotreadyet;		/* which msg "new" in pager, -1 if none */
769
#if defined USE_POP || defined USE_IMAP
772
#if defined USE_POP || defined USE_IMAP
(-)mutt-1.5.5.1-orig/muttlib.c (-1 / +3 lines)
Lines 1181-1187 int mutt_save_confirm (const char *s, st Link Here
1181
      return 1;
1181
      return 1;
1182
    }
1182
    }
1183
1183
1184
    if (option (OPTCONFIRMAPPEND))
1184
    if (option (OPTCONFIRMAPPEND) &&
1185
	(!TrashPath || (mutt_strcmp (s, TrashPath) != 0)))
1186
      /* if we're appending to the trash, there's no point in asking */
1185
    {
1187
    {
1186
      snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s);
1188
      snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s);
1187
      if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO)
1189
      if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO)
(-)mutt-1.5.5.1-orig/mx.c (+62 lines)
Lines 815-820 static int sync_mailbox (CONTEXT *ctx, i Link Here
815
  return rc;
815
  return rc;
816
}
816
}
817
817
818
/* move deleted mails to the trash folder */
819
static int trash_append (CONTEXT *ctx)
820
{
821
    CONTEXT *ctx_trash;
822
    int i = 0;
823
    struct stat st, stc;
824
825
    if (!TrashPath || !ctx->deleted ||
826
	(ctx->magic == M_MAILDIR && option (OPTMAILDIRTRASH)))
827
      return 0;
828
829
    for (;i < ctx->msgcount && (!ctx->hdrs[i]->deleted ||
830
				ctx->hdrs[i]->appended); i++);
831
    if (i == ctx->msgcount)
832
      return 0; /* nothing to be done */
833
834
    if (mutt_save_confirm (TrashPath, &st) != 0)
835
    {
836
      mutt_error _("message(s) not deleted");
837
      return -1;
838
    }
839
840
    if (lstat (ctx->path, &stc) == 0 && stc.st_ino == st.st_ino
841
	&& stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev)
842
      return 0;  /* we are in the trash folder: simple sync */
843
844
    if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL)
845
    {
846
      for (i = 0 ; i < ctx->msgcount ; i++)
847
	if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
848
	    && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
849
	  {
850
	    mx_close_mailbox (ctx_trash, NULL);
851
	    return -1;
852
	  }
853
854
      mx_close_mailbox (ctx_trash, NULL);
855
    }
856
    else
857
    {
858
      mutt_error _("Can't open trash folder");
859
      return -1;
860
    }
861
862
    return 0;
863
}
864
818
/* save changes and close mailbox */
865
/* save changes and close mailbox */
819
int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
866
int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
820
{
867
{
Lines 954-959 int mx_close_mailbox (CONTEXT *ctx, int Link Here
954
	  if (mutt_append_message (&f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0)
1001
	  if (mutt_append_message (&f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0)
955
	  {
1002
	  {
956
	    mutt_set_flag (ctx, ctx->hdrs[i], M_DELETE, 1);
1003
	    mutt_set_flag (ctx, ctx->hdrs[i], M_DELETE, 1);
1004
	    mutt_set_flag (ctx, ctx->hdrs[i], M_APPENDED, 1);
957
	  }
1005
	  }
958
	  else
1006
	  else
959
	  {
1007
	  {
Lines 975-980 int mx_close_mailbox (CONTEXT *ctx, int Link Here
975
    return 0;
1023
    return 0;
976
  }
1024
  }
977
  
1025
  
1026
  /* copy mails to the trash before expunging */
1027
  if (purge && ctx->deleted)
1028
    if (trash_append (ctx) != 0)
1029
    {
1030
      ctx->closing = 0;
1031
      return -1;
1032
    }
1033
978
#ifdef USE_IMAP
1034
#ifdef USE_IMAP
979
  /* allow IMAP to preserve the deleted flag across sessions */
1035
  /* allow IMAP to preserve the deleted flag across sessions */
980
  if (ctx->magic == M_IMAP)
1036
  if (ctx->magic == M_IMAP)
Lines 1167-1172 int mx_sync_mailbox (CONTEXT *ctx, int * Link Here
1167
   * mx_update_tables, so ctx->deleted is 0 when it comes back */
1223
   * mx_update_tables, so ctx->deleted is 0 when it comes back */
1168
  msgcount = ctx->msgcount;
1224
  msgcount = ctx->msgcount;
1169
  deleted = ctx->deleted;
1225
  deleted = ctx->deleted;
1226
1227
  if (purge && ctx->deleted)
1228
  {
1229
    if (trash_append (ctx) == -1)
1230
      return -1;
1231
  } 
1170
1232
1171
#ifdef USE_IMAP
1233
#ifdef USE_IMAP
1172
  if (ctx->magic == M_IMAP)
1234
  if (ctx->magic == M_IMAP)
(-)mutt-1.5.5.1-orig/postpone.c (+3 lines)
Lines 275-280 int mutt_get_postponed (CONTEXT *ctx, HE Link Here
275
  /* finished with this message, so delete it. */
275
  /* finished with this message, so delete it. */
276
  mutt_set_flag (PostContext, h, M_DELETE, 1);
276
  mutt_set_flag (PostContext, h, M_DELETE, 1);
277
277
278
  /* and consider it saved, so that it won't be moved to the trash folder */
279
  mutt_set_flag (PostContext, h, M_APPENDED, 1);
280
278
  /* update the count for the status display */
281
  /* update the count for the status display */
279
  PostCount = PostContext->msgcount - PostContext->deleted;
282
  PostCount = PostContext->msgcount - PostContext->deleted;
280
283
(-)mutt-1.5.5.1-orig/PATCHES (+1 lines)
Line 1 Link Here
1
patch-1.5.5.1.cd.trash_folder.3.4

Return to bug 97754