<<< Date Index >>>     <<< Thread Index >>>

Re: compose.c,v 3.23



On Wednesday, 03 August 2005 at 07:35, Brendan Cully wrote:
> > I'd put this information into the BODY structure, to keep it close
> > to "unlink"; see below.
> 
> I thought of that, but preferred to have the state exist only where it
> might actually do something. BODY is used in practically every file in
> mutt, and almost none of them need to worry about whether mutt owns
> the file. So almost everywhere but in compose.c, unowned is just
> clutter.I don't feel strongly about it though.

Along those lines (making code less global/more local) I wonder if you
have any opinions about the sort of patch attached below? I think it'd
be nice if mutt.h/protos.h didn't contain every exported function in
mutt, because the result is any time any one of those functions
changes, make has to rebuild every file. Not to mention it's source
pollution.

> > On another note, I'm not even convinced that this entire thing is a
> > bug that needs fixing...  The more I think about this the more I
> > think the original behavior is the right one, and the patch should
> > be backed out again.
> 
> I guess my argument is that toggle-unlink is intuitively like the
> difference between save-message and copy-message: first you move the
> attachment somewhere else, then you unlink it. In normal usage (when
> you send or postpone the message), mutt behaves
> non-destructively. Having it actually destroy something that can't be
> recreated, with no warning, seems a little less intuitive.
> 
> > In particular if you consider that the attachments in question will
> > also be deleted from the disk when you *cancel* a message.  Now, why
> > on earth should mutt treat an attachment differently when the
> > *attachment* is cancelled than when the *message* is cancelled?
> 
> It shouldn't. My take on this is that a bug remains in OP_EXIT :)
> Patch attached.

I ended up committing this, just for posterity. If you really want to
roll it back, my feelings won't be too hurt though.
Index: attach.c
===================================================================
RCS file: /home/roessler/cvs/mutt/attach.c,v
retrieving revision 3.14
diff -u -p -r3.14 attach.c
--- attach.c    3 Feb 2005 17:01:42 -0000       3.14
+++ attach.c    4 Aug 2005 06:26:57 -0000
@@ -23,6 +23,7 @@
 
 #include "mutt.h"
 #include "mutt_menu.h"
+#include "attach.h"
 #include "mutt_curses.h"
 #include "keymap.h"
 #include "rfc1524.h"
Index: attach.h
===================================================================
RCS file: /home/roessler/cvs/mutt/attach.h,v
retrieving revision 3.2
diff -u -p -r3.2 attach.h
--- attach.h    4 Oct 2003 20:34:59 -0000       3.2
+++ attach.h    4 Aug 2005 06:26:58 -0000
@@ -18,6 +18,26 @@
 
 /* common protos for compose / attach menus */
 
+#ifndef _ATTACH_H_
+#define _ATTACH_H_ 1
+
+#include "mutt_menu.h"
+
+typedef struct attachptr
+{
+  BODY *content;
+  int parent_type;
+  char *tree;
+  int level;
+  int num;
+  unsigned int unowned : 1;   /* don't unlink on detach */
+} ATTACHPTR;
+
+ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *,
+                                  int, int);
+void mutt_update_tree (ATTACHPTR **, short);
+int mutt_view_attachment (FILE*, BODY *, int, HEADER *, ATTACHPTR **, short);
+
 int mutt_tag_attach (MUTTMENU *menu, int n, int m);
 int mutt_attach_display_loop (MUTTMENU *menu, int op, FILE *fp, HEADER *hdr,
                              BODY *cur, ATTACHPTR ***idxp, short *idxlen, 
short *idxmax,
@@ -32,3 +52,5 @@ void mutt_attach_bounce (FILE *, HEADER 
 void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
 void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
 void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
+
+#endif /* _ATTACH_H_ */
\ No newline at end of file
Index: browser.c
===================================================================
RCS file: /home/roessler/cvs/mutt/browser.c,v
retrieving revision 3.14
diff -u -p -r3.14 browser.c
--- browser.c   17 Feb 2005 03:33:00 -0000      3.14
+++ browser.c   4 Aug 2005 06:26:58 -0000
@@ -23,6 +23,7 @@
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "attach.h"
 #include "buffy.h"
 #include "mapping.h"
 #include "sort.h"
Index: curs_main.c
===================================================================
RCS file: /home/roessler/cvs/mutt/curs_main.c,v
retrieving revision 3.25
diff -u -p -r3.25 curs_main.c
--- curs_main.c 30 Jul 2005 04:13:07 -0000      3.25
+++ curs_main.c 4 Aug 2005 06:26:59 -0000
@@ -23,6 +23,7 @@
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "mutt_menu.h"
+#include "attach.h"
 #include "mailbox.h"
 #include "mapping.h"
 #include "sort.h"
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.47
diff -u -p -r3.47 mutt.h
--- mutt.h      2 Aug 2005 16:10:42 -0000       3.47
+++ mutt.h      4 Aug 2005 06:26:59 -0000
@@ -848,16 +848,6 @@ typedef struct
   unsigned int closing : 1;    /* mailbox is being closed */
 } CONTEXT;
 
-typedef struct attachptr
-{
-  BODY *content;
-  int parent_type;
-  char *tree;
-  int level;
-  int num;
-  unsigned int unowned : 1;   /* don't unlink on detach */
-} ATTACHPTR;
-
 typedef struct
 {
   FILE *fpin;
Index: mutt_menu.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt_menu.h,v
retrieving revision 3.2
diff -u -p -r3.2 mutt_menu.h
--- mutt_menu.h 4 Oct 2003 20:34:59 -0000       3.2
+++ mutt_menu.h 4 Aug 2005 06:26:59 -0000
@@ -20,6 +20,9 @@
  * This file is named mutt_menu.h so it doesn't collide with ncurses menu.h
  */
 
+#ifndef _MUTT_MENU_H_
+#define _MUTT_MENU_H_ 1
+
 #include "keymap.h"
 #include "mutt_regex.h"
 
@@ -108,3 +111,5 @@ int mutt_menuLoop (MUTTMENU *);
 /* used in both the index and pager index to make an entry. */
 void index_make_entry (char *, size_t, struct menu_t *, int);
 int index_color (int);
+
+#endif /* _MUTT_MENU_H_ */
Index: pager.h
===================================================================
RCS file: /home/roessler/cvs/mutt/pager.h,v
retrieving revision 3.1
diff -u -p -r3.1 pager.h
--- pager.h     11 Dec 2002 11:19:40 -0000      3.1
+++ pager.h     4 Aug 2005 06:27:00 -0000
@@ -16,6 +16,8 @@
  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  */ 
 
+#include "attach.h"
+
 /* dynamic internal flags */
 #define M_SHOWFLAT     (1<<0)
 #define M_SHOWCOLOR    (1<<1)
Index: protos.h
===================================================================
RCS file: /home/roessler/cvs/mutt/protos.h,v
retrieving revision 3.30
diff -u -p -r3.30 protos.h
--- protos.h    1 Aug 2005 16:38:00 -0000       3.30
+++ protos.h    4 Aug 2005 06:27:00 -0000
@@ -116,8 +116,6 @@ int mutt_hcache_delete(void *db, const c
 #endif /* USE_HCACHE */
 
 
-ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *, 
int, int);
-
 time_t mutt_decrease_mtime (const char *, struct stat *);
 time_t mutt_local_tz (time_t);
 time_t mutt_mktime (struct tm *, int);
@@ -248,7 +246,6 @@ void mutt_tag_set_flag (int, int);
 void mutt_unblock_signals (void);
 void mutt_unblock_signals_system (int);
 void mutt_update_encoding (BODY *a);
-void mutt_update_tree (ATTACHPTR **, short);
 void mutt_version (void);
 void mutt_view_attachments (HEADER *);
 void mutt_write_address_list (ADDRESS *adr, FILE *fp, int linelen, int 
display);
@@ -347,7 +344,6 @@ int mutt_compose_menu (HEADER *, char *,
 int mutt_thread_set_flag (HEADER *, int, int, int);
 int mutt_user_is_recipient (HEADER *);
 void mutt_update_num_postponed (void);
-int mutt_view_attachment (FILE*, BODY *, int, HEADER *, ATTACHPTR **, short);
 int mutt_wait_filter (pid_t);
 int mutt_which_case (const char *);
 int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int, 
char *);

Attachment: pgpnP6itabNGY.pgp
Description: PGP signature