summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--copy.c8
-rw-r--r--headers.c4
-rw-r--r--imap/imap.c5
-rw-r--r--mh.c7
-rw-r--r--mutt.h6
-rw-r--r--muttlib.c5
6 files changed, 17 insertions, 18 deletions
diff --git a/copy.c b/copy.c
index b120ff0a..fa1240ab 100644
--- a/copy.c
+++ b/copy.c
@@ -342,6 +342,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags,
CH_NOQFROM ignore ">From " line
CH_UPDATE_IRT update the In-Reply-To: header
CH_UPDATE_REFS update the References: header
+ CH_UPDATE_LABEL update the X-Label: header
prefix
string to use if CH_PREFIX is set
@@ -355,7 +356,8 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
if (h->env)
flags |= ((h->env->changed & MUTT_ENV_CHANGED_IRT) ? CH_UPDATE_IRT : 0)
- | ((h->env->changed & MUTT_ENV_CHANGED_REFS) ? CH_UPDATE_REFS : 0);
+ | ((h->env->changed & MUTT_ENV_CHANGED_REFS) ? CH_UPDATE_REFS : 0)
+ | ((h->env->changed & MUTT_ENV_CHANGED_XLABEL) ? CH_UPDATE_LABEL : 0);
if (mutt_copy_hdr (in, out, h->offset, h->content->offset, flags, prefix) == -1)
return -1;
@@ -424,7 +426,6 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
if ((flags & CH_UPDATE_LABEL) && h->env->x_label)
{
- h->xlabel_changed = 0;
temp_hdr = h->env->x_label;
/* env->x_label isn't currently stored with direct references
* elsewhere. Context->label_hash strdups the keys. But to be
@@ -523,9 +524,6 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body,
_mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context, hdr, 0);
}
- if (hdr->xlabel_changed)
- chflags |= CH_UPDATE_LABEL;
-
if ((flags & MUTT_CM_NOHEADER) == 0)
{
if (flags & MUTT_CM_PREFIX)
diff --git a/headers.c b/headers.c
index 9b60023c..e1a15d7f 100644
--- a/headers.c
+++ b/headers.c
@@ -267,7 +267,9 @@ static int label_message(CONTEXT *ctx, HEADER *hdr, char *new)
if (hdr->env->x_label != NULL)
label_ref_inc(ctx, hdr->env->x_label);
- return hdr->changed = hdr->xlabel_changed = 1;
+ hdr->changed = 1;
+ hdr->env->changed |= MUTT_ENV_CHANGED_XLABEL;
+ return 1;
}
int mutt_label_message(HEADER *hdr)
diff --git a/imap/imap.c b/imap/imap.c
index 736e399e..95be7614 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -1321,8 +1321,8 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
/* if the message has been rethreaded or attachments have been deleted
* we delete the message and reupload it.
* This works better if we're expunging, of course. */
- if ((h->env && h->env->changed) ||
- h->attach_del || h->xlabel_changed)
+ /* TODO: why the h->env check? */
+ if ((h->env && h->env->changed) || h->attach_del)
{
/* NOTE and TODO:
*
@@ -1359,7 +1359,6 @@ int imap_sync_mailbox (CONTEXT* ctx, int expunge, int* index_hint)
/* TODO: why the check for h->env? Is this possible? */
if (h->env)
h->env->changed = 0;
- h->xlabel_changed = 0;
#if USE_HCACHE
idata->hcache = imap_hcache_open (idata, NULL);
#endif
diff --git a/mh.c b/mh.c
index 8f6255d0..8d44f0fb 100644
--- a/mh.c
+++ b/mh.c
@@ -1879,8 +1879,7 @@ static int mh_sync_message (CONTEXT * ctx, int msgno)
HEADER *h = ctx->hdrs[msgno];
/* TODO: why the h->env check? */
- if (h->attach_del || h->xlabel_changed ||
- (h->env && h->env->changed))
+ if (h->attach_del || (h->env && h->env->changed))
{
if (mh_rewrite_message (ctx, msgno) != 0)
return -1;
@@ -1904,8 +1903,7 @@ static int maildir_sync_message (CONTEXT * ctx, int msgno)
int rc = 0;
/* TODO: why the h->env check? */
- if (h->attach_del || h->xlabel_changed ||
- (h->env && h->env->changed))
+ if (h->attach_del || (h->env && h->env->changed))
{
/* when doing attachment deletion/rethreading, fall back to the MH case. */
if (mh_rewrite_message (ctx, msgno) != 0)
@@ -2043,7 +2041,6 @@ int mh_sync_mailbox (CONTEXT * ctx, int *index_hint)
}
}
else if (ctx->hdrs[i]->changed || ctx->hdrs[i]->attach_del ||
- ctx->hdrs[i]->xlabel_changed ||
(ctx->magic == MUTT_MAILDIR
&& (option (OPTMAILDIRTRASH) || ctx->hdrs[i]->trash)
&& (ctx->hdrs[i]->deleted != ctx->hdrs[i]->trash)))
diff --git a/mutt.h b/mutt.h
index 84b662f6..3457156f 100644
--- a/mutt.h
+++ b/mutt.h
@@ -656,8 +656,9 @@ typedef struct alias
short num;
} ALIAS;
-#define MUTT_ENV_CHANGED_IRT (1<<0) /* In-Reply-To changed to link/break threads */
-#define MUTT_ENV_CHANGED_REFS (1<<1) /* References changed to break thread */
+#define MUTT_ENV_CHANGED_IRT (1<<0) /* In-Reply-To changed to link/break threads */
+#define MUTT_ENV_CHANGED_REFS (1<<1) /* References changed to break thread */
+#define MUTT_ENV_CHANGED_XLABEL (1<<2) /* X-Label edited */
typedef struct envelope
{
@@ -817,7 +818,6 @@ typedef struct header
* This flag is used by the maildir_trash
* option.
*/
- unsigned int xlabel_changed : 1; /* editable - used for syncing */
/* timezone of the sender of this message */
unsigned int zhours : 5;
diff --git a/muttlib.c b/muttlib.c
index bafbe93e..812765f7 100644
--- a/muttlib.c
+++ b/muttlib.c
@@ -800,7 +800,10 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra)
MOVE_ELEM(message_id);
MOVE_ELEM(supersedes);
MOVE_ELEM(date);
- MOVE_ELEM(x_label);
+ if (!(base->changed & MUTT_ENV_CHANGED_XLABEL))
+ {
+ MOVE_ELEM(x_label);
+ }
if (!(base->changed & MUTT_ENV_CHANGED_REFS))
{
MOVE_ELEM(references);