]> granicus.if.org Git - neomutt/commitdiff
feature: initials
authorVsevolod Volkov <vvv@mutt.org.ua>
Sun, 31 Jan 2016 17:17:10 +0000 (17:17 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 02:33:28 +0000 (03:33 +0100)
Expando for author's initials

hdrline.c

index b844411e5f5e29cac4311c9dc85c2e1e66457c5b..9a0fa73de9c986f282ec0dcaf49b5b700b269afe 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -212,6 +212,7 @@ int mutt_user_is_recipient (HEADER *h)
  * %f = entire from line
  * %F = like %n, unless from self
  * %i = message-id
+ * %I = initials of author
  * %l = number of lines in the message
  * %L = like %F, except `lists' are displayed first
  * %m = number of messages in the mailbox
@@ -463,6 +464,31 @@ hdr_format_str (char *dest,
       mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : "<no.id>");
       break;
 
+    case 'I':
+      {
+       int iflag = FALSE;
+       int j = 0;
+
+       for (i = 0; hdr->env->from && hdr->env->from->personal &&
+                   hdr->env->from->personal[i] && j < SHORT_STRING - 1; i++)
+       {
+         if (isalpha ((int)hdr->env->from->personal[i]))
+         {
+           if (!iflag)
+           {
+             buf2[j++] = hdr->env->from->personal[i];
+             iflag = TRUE;
+           }
+         }
+         else
+           iflag = FALSE;
+       }
+
+       buf2[j] = '\0';
+      }
+      mutt_format_s (dest, destlen, prefix, buf2);
+      break;
+
     case 'l':
       if (!optional)
       {