From: Vsevolod Volkov Date: Sun, 31 Jan 2016 17:17:10 +0000 (+0000) Subject: feature: initials X-Git-Tag: neomutt-20160307~1^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57dd4798c334bd5830d56862eb79b25a4186154c;p=neomutt feature: initials Expando for author's initials --- diff --git a/hdrline.c b/hdrline.c index 21adc282a..e14e5553c 100644 --- 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 : ""); 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) {