]> granicus.if.org Git - mutt/commitdiff
[patch-0.94.4i.tlr.get_attachment.1-2] Get the attachment
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 28 Aug 1998 00:58:25 +0000 (00:58 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 28 Aug 1998 00:58:25 +0000 (00:58 +0000)
time stamping business right.

attach.c

index 275ec3d31367bdbde7a002ce9478302cd6471f3b..5492d61a4760b34a57afb279e77f726082e426ac 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -46,6 +46,7 @@ int mutt_get_tmp_attachment (BODY *a)
   char tempfile[_POSIX_PATH_MAX];
   rfc1524_entry *entry = rfc1524_new_entry();
   FILE *fpin = NULL, *fpout = NULL;
+  struct stat st;
   
   if(a->unlink)
     return 0;
@@ -56,6 +57,9 @@ int mutt_get_tmp_attachment (BODY *a)
                          tempfile, sizeof(tempfile));
   
   rfc1524_free_entry(&entry);
+
+  if(stat(a->filename, &st) == -1)
+    return -1;
   
   if((fpin = fopen(a->filename, "r")) && (fpout = safe_fopen(tempfile, "w")))
   {
@@ -63,6 +67,9 @@ int mutt_get_tmp_attachment (BODY *a)
     FREE(&a->filename);
     a->filename = safe_strdup(tempfile);
     a->unlink = 1;
+
+    if(a->stamp >= st.st_mtime)
+      mutt_stamp_attachment(a);
   }
   else
     mutt_perror(fpin ? tempfile : a->filename);