]> 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>
Sun, 6 Mar 2016 02:34:41 +0000 (02:34 +0000)
Expando for author's initials

hdrline.c

index 21adc282a9645fc3db87b1ce54821d0e5eb52f1d..e14e5553cac2dc88a5159d6072860645675c15cd 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
@@ -461,6 +462,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)
       {