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

Re: [PATCH] debian bug #275060 mutt: doesn't preserve a set flag (~F) when editing message



On Mon, Feb 07, 2005 at 12:34:08AM +0100, Oswald Buddenhagen wrote:
> On Sun, Feb 06, 2005 at 09:43:04PM +0900, TAKAHASHI Tamotsu wrote:
> > --- imap/message.c.orig     Sun Dec 19 19:35:57 2004
> > +++ imap/message.c  Sun Dec 19 20:07:30 2004
> > @@ -518,6 +518,8 @@
> > +  char replied[11] = " \\Answered";
> > +  char flagged[10] = " \\Flagged";
> > +  if (!msg->flags.replied)
> > +    replied[0] = '\0';
> > +  if (!msg->flags.flagged)
> > +    flagged[0] = '\0';
> > +  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen%s%s) {%lu}", mbox, 
> > replied, flagged, (unsigned long)len);
> >  
> this is neither an efficient nor an elegant way of coding this ...

Of course! :)
I made a new one. If this is still bad, would you make another one?
I am just a patchworker, not a programmer.

Thanks,
-- 
tamo
Index: imap/message.c
===================================================================
RCS file: /home/roessler/cvs/mutt/imap/message.c,v
retrieving revision 3.16
diff -u -r3.16 message.c
--- imap/message.c      3 Feb 2005 17:01:44 -0000       3.16
+++ imap/message.c      7 Feb 2005 00:18:05 -0000
@@ -556,7 +556,10 @@
   rewind (fp);
   
   imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
-  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%lu}", mbox, (unsigned 
long)len);
+  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen%s%s) {%lu}", mbox,
+           msg->flags.replied ? " \\Answered" : "",
+           msg->flags.flagged ? " \\Flagged" : "",
+           (unsigned long) len);
 
   imap_cmd_start (idata, buf);