]> granicus.if.org Git - neomutt/commitdiff
Minor fixes to the x-label patch from David.
authorKevin McCarthy <kevin@8t8.us>
Sun, 29 Jan 2017 02:47:26 +0000 (18:47 -0800)
committerRichard Russon <rich@flatcap.org>
Fri, 10 Feb 2017 03:32:55 +0000 (03:32 +0000)
Add L10N comment to sort menu.  Mark a couple strings for localization.

Use ascii_strncasecmp() for the X-Label header comparison.

Simplify label_message() using mutt library routines.

Bind label editing to "Y" instead of "y".  "y" is already used in the
default sample muttrc to display mailboxes.

copy.c
curs_main.c
headers.c

diff --git a/copy.c b/copy.c
index faf383894b981a9c9a17ed97cc1f648bde528c16..23e094e64895eae47466bb75495e83ed4cac1ff6 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -125,7 +125,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags,
       }
 
       if (flags & CH_UPDATE_LABEL &&
-         mutt_strncasecmp ("X-Label:", buf, 8) == 0)
+         ascii_strncasecmp ("X-Label:", buf, 8) == 0)
        continue;
 
       if (!ignore && fputs (buf, out) == EOF)
@@ -455,7 +455,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
   }
 #endif
 
-  if (flags & CH_UPDATE_LABEL && h->xlabel_changed)
+  if (flags & CH_UPDATE_LABEL)
   {
     h->xlabel_changed = 0;
     if (h->env->x_label != NULL)
index 75f61d95da3a55b2994fa8a0e5d27963d1a1ac4a..8b386de3b35559dfabe83f8b88644a633b418108 100644 (file)
@@ -2843,9 +2843,14 @@ int mutt_index_menu (void)
        if (rc > 0) {
          Context->changed = 1;
          menu->redraw = REDRAW_FULL;
+          /* L10N: This is displayed when the x-label on one or more
+           * messages is edited. */
          mutt_message (_("%d labels changed."), rc);
        }
        else {
+          /* L10N: This is displayed when editing an x-label, but no messages
+           * were updated.  Possibly due to canceling at the prompt or if the new
+           * label is the same as the old label. */
          mutt_message (_("No labels changed."));
        }
        break;
index e51f5b41d462c853d938f499870698b177afb8c1..c6c2e7b8be3fa315effa6951d525270927304f60 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -222,17 +222,9 @@ static int label_message(HEADER *hdr, char *new)
 {
   if (hdr == NULL)
     return 0;
-  if (hdr->env->x_label == NULL && new == NULL)
+  if (mutt_strcmp (hdr->env->x_label, new) == 0)
     return 0;
-  if (hdr->env->x_label != NULL && new != NULL &&
-      strcmp(hdr->env->x_label, new) == 0)
-    return 0;
-  if (hdr->env->x_label != NULL)
-    FREE(&hdr->env->x_label);
-  if (new == NULL)
-    hdr->env->x_label = NULL;
-  else
-    hdr->env->x_label = safe_strdup(new);
+  mutt_str_replace (&hdr->env->x_label, new);
   return hdr->changed = hdr->xlabel_changed = 1;
 }