NeoMutt  2018-07-16 +1783-b00bd9
Teaching an old dog new tricks
DOXYGEN
hdrline.c File Reference

String processing routines to generate the mail index. More...

#include "config.h"
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mutt/mutt.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "mutt.h"
#include "hdrline.h"
#include "alias.h"
#include "context.h"
#include "curs_lib.h"
#include "format_flags.h"
#include "globals.h"
#include "hook.h"
#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
#include "mutt_parse.h"
#include "mutt_thread.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "ncrypt/ncrypt.h"
#include "sort.h"
+ Include dependency graph for hdrline.c:

Go to the source code of this file.

Enumerations

enum  FlagChars {
  FLAG_CHAR_TAGGED, FLAG_CHAR_IMPORTANT, FLAG_CHAR_DELETED, FLAG_CHAR_DELETED_ATTACH,
  FLAG_CHAR_REPLIED, FLAG_CHAR_OLD, FLAG_CHAR_NEW, FLAG_CHAR_OLD_THREAD,
  FLAG_CHAR_NEW_THREAD, FLAG_CHAR_SEMPTY, FLAG_CHAR_ZEMPTY
}
 Index into the C_FlagChars variable ($flag_chars) More...
 
enum  CryptChars {
  FLAG_CHAR_CRYPT_GOOD_SIGN, FLAG_CHAR_CRYPT_ENCRYPTED, FLAG_CHAR_CRYPT_SIGNED, FLAG_CHAR_CRYPT_CONTAINS_KEY,
  FLAG_CHAR_CRYPT_NO_CRYPTO
}
 Index into the C_CryptChars variable ($crypt_chars) More...
 
enum  FieldType {
  DISP_TO, DISP_CC, DISP_BCC, DISP_FROM,
  DISP_PLAIN, DISP_MAX
}
 Header types. More...
 

Functions

bool mutt_is_mail_list (struct Address *addr)
 Is this the email address of a mailing list? More...
 
bool mutt_is_subscribed_list (struct Address *addr)
 Is this the email address of a user-subscribed mailing list? More...
 
static bool check_for_mailing_list (struct Address *addr, const char *pfx, char *buf, int buflen)
 Search list of addresses for a mailing list. More...
 
static bool check_for_mailing_list_addr (struct Address *addr, char *buf, int buflen)
 Check an address list for a mailing list. More...
 
static bool first_mailing_list (char *buf, size_t buflen, struct Address *a)
 Get the first mailing list in the list of addresses. More...
 
static size_t add_index_color (char *buf, size_t buflen, MuttFormatFlags flags, char color)
 Insert a color marker into a string. More...
 
static const char * get_nth_wchar (struct MbTable *table, int index)
 Extract one char from a multi-byte table. More...
 
static const char * make_from_prefix (enum FieldType disp)
 Create a prefix for an author field. More...
 
static void make_from (struct Envelope *env, char *buf, size_t buflen, bool do_lists, MuttFormatFlags flags)
 Generate a From: field (with optional prefix) More...
 
static void make_from_addr (struct Envelope *env, char *buf, size_t buflen, bool do_lists)
 Create a 'from' address for a reply email. More...
 
static bool user_in_addr (struct Address *a)
 Do any of the addresses refer to the user? More...
 
static int user_is_recipient (struct Email *e)
 Is the user a recipient of the message. More...
 
static char * apply_subject_mods (struct Envelope *env)
 Apply regex modifications to the subject. More...
 
static bool thread_is_new (struct Context *ctx, struct Email *e)
 Does the email thread contain any new emails? More...
 
static bool thread_is_old (struct Context *ctx, struct Email *e)
 Does the email thread contain any unread emails? More...
 
static const char * index_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, MuttFormatFlags flags)
 Format a string for the index list - Implements format_t. More...
 
void mutt_make_string_flags (char *buf, size_t buflen, const char *s, struct Context *ctx, struct Mailbox *m, struct Email *e, MuttFormatFlags flags)
 Create formatted strings using mailbox expandos. More...
 
void mutt_make_string_info (char *buf, size_t buflen, int cols, const char *s, struct HdrFormatInfo *hfi, MuttFormatFlags flags)
 Create pager status bar string. More...
 

Variables

struct MbTableC_CryptChars
 Config: User-configurable crypto flags: signed, encrypted etc. More...
 
struct MbTableC_FlagChars
 Config: User-configurable index flags: tagged, new, etc. More...
 
struct MbTableC_FromChars
 Config: User-configurable index flags: to address, cc address, etc. More...
 
struct MbTableC_ToChars
 Config: Indicator characters for the 'To' field in the index. More...
 

Detailed Description

String processing routines to generate the mail index.

Authors
  • Michael R. Elkins
  • Richard Russon
  • Ian Zimmerman

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file hdrline.c.

Enumeration Type Documentation

enum FlagChars

Index into the C_FlagChars variable ($flag_chars)

Enumerator
FLAG_CHAR_TAGGED 

Character denoting a tagged email.

FLAG_CHAR_IMPORTANT 

Character denoting a important (flagged) email.

FLAG_CHAR_DELETED 

Character denoting a deleted email.

FLAG_CHAR_DELETED_ATTACH 

Character denoting a deleted attachment.

FLAG_CHAR_REPLIED 

Character denoting an email that has been replied to.

FLAG_CHAR_OLD 

Character denoting an email that has been read.

FLAG_CHAR_NEW 

Character denoting an unread email.

FLAG_CHAR_OLD_THREAD 

Character denoting a thread of emails that has been read.

FLAG_CHAR_NEW_THREAD 

Character denoting a thread containing at least one new email.

FLAG_CHAR_SEMPTY 

Character denoting a read email, $index_format S expando.

FLAG_CHAR_ZEMPTY 

Character denoting a read email, $index_format Z expando.

Definition at line 69 of file hdrline.c.

70 {
82 };
Character denoting a tagged email.
Definition: hdrline.c:71
Character denoting a important (flagged) email.
Definition: hdrline.c:72
Character denoting a thread containing at least one new email.
Definition: hdrline.c:79
Character denoting a read email, $index_format S expando.
Definition: hdrline.c:80
Character denoting a deleted attachment.
Definition: hdrline.c:74
Character denoting an email that has been read.
Definition: hdrline.c:76
Character denoting a thread of emails that has been read.
Definition: hdrline.c:78
Character denoting an email that has been replied to.
Definition: hdrline.c:75
Character denoting a read email, $index_format Z expando.
Definition: hdrline.c:81
Character denoting a deleted email.
Definition: hdrline.c:73
Character denoting an unread email.
Definition: hdrline.c:77
enum CryptChars

Index into the C_CryptChars variable ($crypt_chars)

Enumerator
FLAG_CHAR_CRYPT_GOOD_SIGN 

Character denoting a message signed with a verified key.

FLAG_CHAR_CRYPT_ENCRYPTED 

Character denoting a message is PGP-encrypted.

FLAG_CHAR_CRYPT_SIGNED 

Character denoting a message is signed.

FLAG_CHAR_CRYPT_CONTAINS_KEY 

Character denoting a message contains a PGP key.

FLAG_CHAR_CRYPT_NO_CRYPTO 

Character denoting a message has no cryptography information.

Definition at line 87 of file hdrline.c.

88 {
94 };
Character denoting a message contains a PGP key.
Definition: hdrline.c:92
Character denoting a message signed with a verified key.
Definition: hdrline.c:89
Character denoting a message is PGP-encrypted.
Definition: hdrline.c:90
Character denoting a message has no cryptography information.
Definition: hdrline.c:93
Character denoting a message is signed.
Definition: hdrline.c:91
enum FieldType

Header types.

Strings for printing headers

Enumerator
DISP_TO 

To: string.

DISP_CC 

Cc: string.

DISP_BCC 

Bcc: string.

DISP_FROM 

From: string.

DISP_PLAIN 

Empty string.

DISP_MAX 

Definition at line 234 of file hdrline.c.

235 {
236  DISP_TO,
237  DISP_CC,
238  DISP_BCC,
239  DISP_FROM,
240  DISP_PLAIN,
241  DISP_MAX,
242 };
Bcc: string.
Definition: hdrline.c:238
Cc: string.
Definition: hdrline.c:237
Empty string.
Definition: hdrline.c:240
From: string.
Definition: hdrline.c:239
To: string.
Definition: hdrline.c:236

Function Documentation

bool mutt_is_mail_list ( struct Address addr)

Is this the email address of a mailing list?

Parameters
addrAddress to test
Return values
trueIf it's a mailing list

Definition at line 101 of file hdrline.c.

102 {
104  return mutt_regexlist_match(&MailLists, addr->mailbox);
105  return false;
106 }
char * mailbox
mailbox and host address
Definition: address.h:35
bool mutt_regexlist_match(struct RegexList *rl, const char *str)
Does a string match any Regex in the list?
Definition: regex.c:190
struct RegexList MailLists
List of regexes to match mailing lists.
Definition: email_globals.c:50
struct RegexList UnMailLists
List of regexes to blacklist false matches in MailLists.
Definition: email_globals.c:51

+ Here is the caller graph for this function:

bool mutt_is_subscribed_list ( struct Address addr)

Is this the email address of a user-subscribed mailing list?

Parameters
addrAddress to test
Return values
trueIf it's a subscribed mailing list

Definition at line 113 of file hdrline.c.

114 {
115  if (!mutt_regexlist_match(&UnMailLists, addr->mailbox) &&
117  {
119  }
120  return false;
121 }
char * mailbox
mailbox and host address
Definition: address.h:35
bool mutt_regexlist_match(struct RegexList *rl, const char *str)
Does a string match any Regex in the list?
Definition: regex.c:190
struct RegexList SubscribedLists
List of regexes to match subscribed mailing lists.
Definition: email_globals.c:52
struct RegexList UnMailLists
List of regexes to blacklist false matches in MailLists.
Definition: email_globals.c:51
struct RegexList UnSubscribedLists
List of regexes to blacklist false matches in SubscribedLists.
Definition: email_globals.c:49

+ Here is the caller graph for this function:

static bool check_for_mailing_list ( struct Address addr,
const char *  pfx,
char *  buf,
int  buflen 
)
static

Search list of addresses for a mailing list.

Parameters
addrList of addresses to search
pfxPrefix string
bufBuffer to store results
buflenBuffer length
Return values
1Mailing list found
0No list found

Search for a mailing list in the list of addresses pointed to by addr. If one is found, print pfx and the name of the list into buf.

Definition at line 135 of file hdrline.c.

136 {
137  for (; addr; addr = addr->next)
138  {
139  if (mutt_is_subscribed_list(addr))
140  {
141  if (pfx && buf && buflen)
142  snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(addr));
143  return true;
144  }
145  }
146  return false;
147 }
bool mutt_is_subscribed_list(struct Address *addr)
Is this the email address of a user-subscribed mailing list?
Definition: hdrline.c:113
const char * mutt_get_name(struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:154
struct Address * next
Definition: address.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool check_for_mailing_list_addr ( struct Address addr,
char *  buf,
int  buflen 
)
static

Check an address list for a mailing list.

Parameters
addrAddress list
bufBuffer for the result
buflenLength of buffer
Return values
trueMailing list found

If one is found, print the address of the list into buf.

Definition at line 158 of file hdrline.c.

159 {
160  for (; addr; addr = addr->next)
161  {
162  if (mutt_is_subscribed_list(addr))
163  {
164  if (buf && buflen)
165  snprintf(buf, buflen, "%s", addr->mailbox);
166  return true;
167  }
168  }
169  return false;
170 }
char * mailbox
mailbox and host address
Definition: address.h:35
bool mutt_is_subscribed_list(struct Address *addr)
Is this the email address of a user-subscribed mailing list?
Definition: hdrline.c:113
struct Address * next
Definition: address.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool first_mailing_list ( char *  buf,
size_t  buflen,
struct Address a 
)
static

Get the first mailing list in the list of addresses.

Parameters
bufBuffer for the result
buflenLength of buffer
aAddress list
Return values
trueIf a mailing list was found

Definition at line 179 of file hdrline.c.

180 {
181  for (; a; a = a->next)
182  {
184  {
185  mutt_save_path(buf, buflen, a);
186  return true;
187  }
188  }
189  return false;
190 }
bool mutt_is_subscribed_list(struct Address *addr)
Is this the email address of a user-subscribed mailing list?
Definition: hdrline.c:113
void mutt_save_path(char *buf, size_t buflen, struct Address *addr)
Turn an email address into a filename (for saving)
Definition: muttlib.c:792
struct Address * next
Definition: address.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static size_t add_index_color ( char *  buf,
size_t  buflen,
MuttFormatFlags  flags,
char  color 
)
static

Insert a color marker into a string.

Parameters
bufBuffer to store marker
buflenBuffer length
flagsFlags, see MuttFormatFlags
colorColor, e.g. MT_COLOR_MESSAGE
Return values
numCharacters written

The colors are stored as "magic" strings embedded in the text.

Definition at line 202 of file hdrline.c.

203 {
204  /* only add color markers if we are operating on main index entries. */
205  if (!(flags & MUTT_FORMAT_INDEX))
206  return 0;
207 
208  /* this item is going to be passed to an external filter */
209  if (flags & MUTT_FORMAT_NOFILTER)
210  return 0;
211 
212  if (color == MT_COLOR_INDEX)
213  { /* buf might be uninitialized other cases */
214  const size_t len = mutt_str_strlen(buf);
215  buf += len;
216  buflen -= len;
217  }
218 
219  if (buflen <= 2)
220  return 0;
221 
222  buf[0] = MUTT_SPECIAL_INDEX;
223  buf[1] = color;
224  buf[2] = '\0';
225 
226  return 2;
227 }
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:669
Index: default colour (takes a pattern)
Definition: mutt_curses.h:156
#define MUTT_FORMAT_INDEX
This is a main index entry.
Definition: format_flags.h:36
Colour indicator.
Definition: mutt_menu.h:76
#define MUTT_FORMAT_NOFILTER
Do not allow filtering on this pass.
Definition: format_flags.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static const char* get_nth_wchar ( struct MbTable table,
int  index 
)
static

Extract one char from a multi-byte table.

Parameters
tableMulti-byte table
indexSelect this character
Return values
ptrString pointer to the character

Extract one multi-byte character from a string table. If the index is invalid, then a space character will be returned. If the character selected is '
' (Ctrl-M), then "" will be returned.

Definition at line 254 of file hdrline.c.

255 {
256  if (!table || !table->chars || (index < 0) || (index >= table->len))
257  return " ";
258 
259  if (table->chars[index][0] == '\r')
260  return "";
261 
262  return table->chars[index];
263 }
char ** chars
The array of multibyte character strings.
Definition: mbtable.h:39
int index
the absolute (unsorted) message number
Definition: email.h:88
int len
Number of characters.
Definition: mbtable.h:38

+ Here is the caller graph for this function:

static const char* make_from_prefix ( enum FieldType  disp)
static

Create a prefix for an author field.

Parameters
dispType of field
Return values
ptrPrefix string (do not free it)

If $from_chars is set, pick an appropriate character from it. If not, use the default prefix: "To", "Cc", etc

Definition at line 273 of file hdrline.c.

274 {
275  /* need 2 bytes at the end, one for the space, another for NUL */
276  static char padded[8];
277  static const char *long_prefixes[DISP_MAX] = {
278  [DISP_TO] = "To ", [DISP_CC] = "Cc ", [DISP_BCC] = "Bcc ",
279  [DISP_FROM] = "", [DISP_PLAIN] = "",
280  };
281 
282  if (!C_FromChars || !C_FromChars->chars || (C_FromChars->len == 0))
283  return long_prefixes[disp];
284 
285  const char *pchar = get_nth_wchar(C_FromChars, disp);
286  if (mutt_str_strlen(pchar) == 0)
287  return "";
288 
289  snprintf(padded, sizeof(padded), "%s ", pchar);
290  return padded;
291 }
Bcc: string.
Definition: hdrline.c:238
char ** chars
The array of multibyte character strings.
Definition: mbtable.h:39
Cc: string.
Definition: hdrline.c:237
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:669
struct MbTable * C_FromChars
Config: User-configurable index flags: to address, cc address, etc.
Definition: hdrline.c:63
Empty string.
Definition: hdrline.c:240
From: string.
Definition: hdrline.c:239
static const char * get_nth_wchar(struct MbTable *table, int index)
Extract one char from a multi-byte table.
Definition: hdrline.c:254
To: string.
Definition: hdrline.c:236
int len
Number of characters.
Definition: mbtable.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void make_from ( struct Envelope env,
char *  buf,
size_t  buflen,
bool  do_lists,
MuttFormatFlags  flags 
)
static

Generate a From: field (with optional prefix)

Parameters
envEnvelope of the email
bufBuffer to store the result
buflenSize of the buffer
do_listsShould we check for mailing lists?
flagsFormat flags, see MuttFormatFlags

Generate the F or L field in $index_format. This is the author, or recipient of the email.

The field can optionally be prefixed by a character from $from_chars. If $from_chars is not set, the prefix will be, "To", "Cc", etc

Definition at line 307 of file hdrline.c.

309 {
310  if (!env || !buf)
311  return;
312 
313  bool me;
314  enum FieldType disp;
315  struct Address *name = NULL;
316 
317  me = mutt_addr_is_user(env->from);
318 
319  if (do_lists || me)
320  {
321  if (check_for_mailing_list(env->to, make_from_prefix(DISP_TO), buf, buflen))
322  return;
323  if (check_for_mailing_list(env->cc, make_from_prefix(DISP_CC), buf, buflen))
324  return;
325  }
326 
327  if (me && env->to)
328  {
329  disp = (flags & MUTT_FORMAT_PLAIN) ? DISP_PLAIN : DISP_TO;
330  name = env->to;
331  }
332  else if (me && env->cc)
333  {
334  disp = DISP_CC;
335  name = env->cc;
336  }
337  else if (me && env->bcc)
338  {
339  disp = DISP_BCC;
340  name = env->bcc;
341  }
342  else if (env->from)
343  {
344  disp = DISP_FROM;
345  name = env->from;
346  }
347  else
348  {
349  *buf = '\0';
350  return;
351  }
352 
353  snprintf(buf, buflen, "%s%s", make_from_prefix(disp), mutt_get_name(name));
354 }
Bcc: string.
Definition: hdrline.c:238
struct Address * to
Definition: envelope.h:42
Cc: string.
Definition: hdrline.c:237
An email address.
Definition: address.h:32
static bool check_for_mailing_list(struct Address *addr, const char *pfx, char *buf, int buflen)
Search list of addresses for a mailing list.
Definition: hdrline.c:135
const char * name
Definition: pgpmicalg.c:45
Empty string.
Definition: hdrline.c:240
struct Address * from
Definition: envelope.h:41
From: string.
Definition: hdrline.c:239
struct Address * bcc
Definition: envelope.h:44
static const char * make_from_prefix(enum FieldType disp)
Create a prefix for an author field.
Definition: hdrline.c:273
const char * mutt_get_name(struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:154
#define MUTT_FORMAT_PLAIN
Do not prepend DISP_TO, DISP_CC ...
Definition: format_flags.h:38
To: string.
Definition: hdrline.c:236
FieldType
Header types.
Definition: hdrline.c:234
struct Address * cc
Definition: envelope.h:43
bool mutt_addr_is_user(struct Address *addr)
Does the address belong to the user.
Definition: alias.c:677

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void make_from_addr ( struct Envelope env,
char *  buf,
size_t  buflen,
bool  do_lists 
)
static

Create a 'from' address for a reply email.

Parameters
envEnvelope of current email
bufBuffer for the result
buflenLength of buffer
do_listsIf true, check for mailing lists

Definition at line 363 of file hdrline.c.

364 {
365  if (!env || !buf)
366  return;
367 
368  bool me = mutt_addr_is_user(env->from);
369 
370  if (do_lists || me)
371  {
372  if (check_for_mailing_list_addr(env->to, buf, buflen))
373  return;
374  if (check_for_mailing_list_addr(env->cc, buf, buflen))
375  return;
376  }
377 
378  if (me && env->to)
379  snprintf(buf, buflen, "%s", env->to->mailbox);
380  else if (me && env->cc)
381  snprintf(buf, buflen, "%s", env->cc->mailbox);
382  else if (env->from)
383  mutt_str_strfcpy(buf, env->from->mailbox, buflen);
384  else
385  *buf = '\0';
386 }
struct Address * to
Definition: envelope.h:42
char * mailbox
mailbox and host address
Definition: address.h:35
struct Address * from
Definition: envelope.h:41
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
static bool check_for_mailing_list_addr(struct Address *addr, char *buf, int buflen)
Check an address list for a mailing list.
Definition: hdrline.c:158
struct Address * cc
Definition: envelope.h:43
bool mutt_addr_is_user(struct Address *addr)
Does the address belong to the user.
Definition: alias.c:677

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool user_in_addr ( struct Address a)
static

Do any of the addresses refer to the user?

Parameters
aAddress list
Return values
trueIf any of the addresses match one of the user's addresses

Definition at line 393 of file hdrline.c.

394 {
395  for (; a; a = a->next)
396  if (mutt_addr_is_user(a))
397  return true;
398  return false;
399 }
bool mutt_addr_is_user(struct Address *addr)
Does the address belong to the user.
Definition: alias.c:677
struct Address * next
Definition: address.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int user_is_recipient ( struct Email e)
static

Is the user a recipient of the message.

Parameters
eEmail to test
Return values
0User is not in list
1User is unique recipient
2User is in the TO list
3User is in the CC list
4User is originator
5Sent to a subscribed mailinglist
6User is in the Reply-To list

Definition at line 412 of file hdrline.c.

413 {
414  if (!e || !e->env)
415  return 0;
416 
417  struct Envelope *env = e->env;
418 
419  if (!e->recip_valid)
420  {
421  e->recip_valid = true;
422 
423  if (mutt_addr_is_user(env->from))
424  e->recipient = 4;
425  else if (user_in_addr(env->to))
426  {
427  if (env->to->next || env->cc)
428  e->recipient = 2; /* non-unique recipient */
429  else
430  e->recipient = 1; /* unique recipient */
431  }
432  else if (user_in_addr(env->cc))
433  e->recipient = 3;
434  else if (check_for_mailing_list(env->to, NULL, NULL, 0))
435  e->recipient = 5;
436  else if (check_for_mailing_list(env->cc, NULL, NULL, 0))
437  e->recipient = 5;
438  else if (user_in_addr(env->reply_to))
439  e->recipient = 6;
440  else
441  e->recipient = 0;
442  }
443 
444  return e->recipient;
445 }
struct Address * to
Definition: envelope.h:42
short recipient
user_is_recipient()&#39;s return value, cached
Definition: email.h:80
static bool check_for_mailing_list(struct Address *addr, const char *pfx, char *buf, int buflen)
Search list of addresses for a mailing list.
Definition: hdrline.c:135
struct Address * reply_to
Definition: envelope.h:46
struct Envelope * env
envelope information
Definition: email.h:92
struct Address * from
Definition: envelope.h:41
bool recip_valid
is_recipient is valid
Definition: email.h:58
struct Address * cc
Definition: envelope.h:43
The header of an email.
Definition: envelope.h:38
bool mutt_addr_is_user(struct Address *addr)
Does the address belong to the user.
Definition: alias.c:677
static bool user_in_addr(struct Address *a)
Do any of the addresses refer to the user?
Definition: hdrline.c:393
struct Address * next
Definition: address.h:39

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* apply_subject_mods ( struct Envelope env)
static

Apply regex modifications to the subject.

Parameters
envEnvelope of email
Return values
ptrModified subject
NULLNo modification made

Definition at line 453 of file hdrline.c.

454 {
455  if (!env)
456  return NULL;
457 
459  return env->subject;
460 
461  if (!env->subject || (*env->subject == '\0'))
462  {
463  env->disp_subj = NULL;
464  return NULL;
465  }
466 
468  return env->disp_subj;
469 }
char * disp_subj
display subject (modified copy of subject)
Definition: envelope.h:52
char * mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, const char *str)
Apply replacements to a buffer.
Definition: regex.c:351
char * subject
Definition: envelope.h:50
#define STAILQ_EMPTY(head)
Definition: queue.h:346
struct ReplaceList SubjectRegexList
List of regexes to tidy the view of the email&#39;s subject.
Definition: email_globals.c:53

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool thread_is_new ( struct Context ctx,
struct Email e 
)
static

Does the email thread contain any new emails?

Parameters
ctxMailbox
eEmail
Return values
trueIf thread contains new mail

Definition at line 477 of file hdrline.c.

478 {
479  return e->collapsed && (e->num_hidden > 1) &&
480  (mutt_thread_contains_unread(ctx, e) == 1);
481 }
#define mutt_thread_contains_unread(ctx, cur)
Definition: mutt_thread.h:59
size_t num_hidden
number of hidden messages in this view
Definition: email.h:78
bool collapsed
is this message part of a collapsed thread?
Definition: email.h:76

+ Here is the caller graph for this function:

static bool thread_is_old ( struct Context ctx,
struct Email e 
)
static

Does the email thread contain any unread emails?

Parameters
ctxMailbox
eEmail
Return values
trueIf thread contains unread mail

Definition at line 489 of file hdrline.c.

490 {
491  return e->collapsed && (e->num_hidden > 1) &&
492  (mutt_thread_contains_unread(ctx, e) == 2);
493 }
#define mutt_thread_contains_unread(ctx, cur)
Definition: mutt_thread.h:59
size_t num_hidden
number of hidden messages in this view
Definition: email.h:78
bool collapsed
is this message part of a collapsed thread?
Definition: email.h:76

+ Here is the caller graph for this function:

static const char* index_format_str ( char *  buf,
size_t  buflen,
size_t  col,
int  cols,
char  op,
const char *  src,
const char *  prec,
const char *  if_str,
const char *  else_str,
unsigned long  data,
MuttFormatFlags  flags 
)
static

Format a string for the index list - Implements format_t.

Expando Description
%(fmt) Date/time when the message was received
%a Address of the author
%A Reply-to address (if present; otherwise: address of author)
%b Filename of the original message folder (think mailbox)
%B The list to which the letter was sent, or else the folder name (b)
%C Current message number
%c Number of characters (bytes) in the message
%D Date and time of message using $date_format and local timezone
%d Date and time of message using $date_format and sender's timezone
%e Current message number in thread
%E Number of messages in current thread
%Fp Like F, but plain. No contextual formatting is applied to recipient name
%F Author name, or recipient name if the message is from you
%f Sender (address + real name), either From: or Return-Path:
%Gx Individual message tag (e.g. notmuch tags/imap flags)
%g Message tags (e.g. notmuch tags/imap flags)
%H Spam attribute(s) of this message
%I Initials of author
%i Message-id of the current message
%J Message tags (if present, tree unfolded, and != parent's tags)
%K The list to which the letter was sent (if any; otherwise: empty)
%L Like F, except 'lists' are displayed first
%l Number of lines in the message
%M Number of hidden messages if the thread is collapsed
%m Total number of message in the mailbox
%n Author's real name (or address if missing)
%N Message score
%O Like L, except using address instead of name
%P Progress indicator for the built-in pager (how much of the file has been displayed)
%q Newsgroup name (if compiled with NNTP support)
%R Comma separated list of Cc: recipients
%r Comma separated list of To: recipients
%S Single character status of the message (N/O/D/d/!/r/-)
%s Subject of the message
%t 'To:' field (recipients)
%T The appropriate character from the $to_chars string
%u User (login) name of the author
%v First name of the author, or the recipient if the message is from you
%W Name of organization of author ('Organization:' field)
%x 'X-Comment-To:' field (if present and compiled with NNTP support)
%X Number of MIME attachments
%y 'X-Label:' field (if present)
%Y 'X-Label:' field (if present, tree unfolded, and != parent's x-label)
%zc Message crypto flags
%zs Message status flags
%zt Message tag flags
%Z Combined message flags
%[fmt] Message date/time converted to the local time zone
%{fmt} Message date/time converted to sender's time zone

Definition at line 550 of file hdrline.c.

554 {
555  struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data;
556  char fmt[128], tmp[1024], *p = NULL, *tags = NULL;
557  int optional = (flags & MUTT_FORMAT_OPTIONAL);
558  int threads = ((C_Sort & SORT_MASK) == SORT_THREADS);
559  int is_index = (flags & MUTT_FORMAT_INDEX);
560  size_t colorlen;
561 
562  struct Email *e = hfi->email;
563  struct Context *ctx = hfi->ctx;
564  struct Mailbox *m = hfi->mailbox;
565 
566  if (!e || !e->env)
567  return src;
568  buf[0] = '\0';
569  switch (op)
570  {
571  case 'A':
572  case 'I':
573  if (op == 'A')
574  {
575  if (e->env->reply_to && e->env->reply_to->mailbox)
576  {
577  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_AUTHOR);
578  mutt_format_s(buf + colorlen, buflen - colorlen, prec,
580  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
581  break;
582  }
583  }
584  else
585  {
586  if (mutt_mb_get_initials(mutt_get_name(e->env->from), tmp, sizeof(tmp)))
587  {
588  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_AUTHOR);
589  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
590  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
591  break;
592  }
593  }
594  /* fallthrough */
595 
596  case 'a':
597  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_AUTHOR);
598  if (e->env->from && e->env->from->mailbox)
599  {
600  mutt_format_s(buf + colorlen, buflen - colorlen, prec,
602  }
603  else
604  mutt_format_s(buf + colorlen, buflen - colorlen, prec, "");
605  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
606  break;
607 
608  case 'B':
609  case 'K':
610  if (!first_mailing_list(buf, buflen, e->env->to) &&
611  !first_mailing_list(buf, buflen, e->env->cc))
612  {
613  buf[0] = '\0';
614  }
615  if (buf[0] != '\0')
616  {
617  mutt_str_strfcpy(tmp, buf, sizeof(tmp));
618  mutt_format_s(buf, buflen, prec, tmp);
619  break;
620  }
621  if (op == 'K')
622  {
623  if (optional)
624  optional = 0;
625  /* break if 'K' returns nothing */
626  break;
627  }
628  /* if 'B' returns nothing */
629  /* fallthrough */
630 
631  case 'b':
632  if (m)
633  {
634  p = strrchr(mutt_b2s(m->pathbuf), '/');
635  if (p)
636  mutt_str_strfcpy(buf, p + 1, buflen);
637  else
638  mutt_str_strfcpy(buf, mutt_b2s(m->pathbuf), buflen);
639  }
640  else
641  mutt_str_strfcpy(buf, "(null)", buflen);
642  mutt_str_strfcpy(tmp, buf, sizeof(tmp));
643  mutt_format_s(buf, buflen, prec, tmp);
644  break;
645 
646  case 'c':
647  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_SIZE);
648  mutt_str_pretty_size(tmp, sizeof(tmp), mutt_email_size(e));
649  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
650  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
651  break;
652 
653  case 'C':
654  colorlen = add_index_color(fmt, sizeof(fmt), flags, MT_COLOR_INDEX_NUMBER);
655  snprintf(fmt + colorlen, sizeof(fmt) - colorlen, "%%%sd", prec);
656  add_index_color(fmt + colorlen, sizeof(fmt) - colorlen, flags, MT_COLOR_INDEX);
657  snprintf(buf, buflen, fmt, e->msgno + 1);
658  break;
659 
660  case 'd':
661  case 'D':
662  case '{':
663  case '[':
664  case '(':
665  case '<':
666  /* preprocess $date_format to handle %Z */
667  {
668  const char *cp = NULL;
669  struct tm tm = { 0 };
670  time_t now;
671  int j = 0;
672 
673  if (optional && ((op == '[') || (op == '(')))
674  {
675  char *is = NULL;
676  now = time(NULL);
677  tm = mutt_date_localtime(now);
678  now -= (op == '(') ? e->received : e->date_sent;
679 
680  is = (char *) prec;
681  bool invert = false;
682  if (*is == '>')
683  {
684  invert = true;
685  is++;
686  }
687 
688  while (*is && (*is != '?'))
689  {
690  int t = strtol(is, &is, 10);
691  /* semi-broken (assuming 30 days in all months) */
692  switch (*(is++))
693  {
694  case 'y':
695  if (t > 1)
696  {
697  t--;
698  t *= (60 * 60 * 24 * 365);
699  }
700  t += ((tm.tm_mon * 60 * 60 * 24 * 30) + (tm.tm_mday * 60 * 60 * 24) +
701  (tm.tm_hour * 60 * 60) + (tm.tm_min * 60) + tm.tm_sec);
702  break;
703 
704  case 'm':
705  if (t > 1)
706  {
707  t--;
708  t *= (60 * 60 * 24 * 30);
709  }
710  t += ((tm.tm_mday * 60 * 60 * 24) + (tm.tm_hour * 60 * 60) +
711  (tm.tm_min * 60) + tm.tm_sec);
712  break;
713 
714  case 'w':
715  if (t > 1)
716  {
717  t--;
718  t *= (60 * 60 * 24 * 7);
719  }
720  t += ((tm.tm_wday * 60 * 60 * 24) + (tm.tm_hour * 60 * 60) +
721  (tm.tm_min * 60) + tm.tm_sec);
722  break;
723 
724  case 'd':
725  if (t > 1)
726  {
727  t--;
728  t *= (60 * 60 * 24);
729  }
730  t += ((tm.tm_hour * 60 * 60) + (tm.tm_min * 60) + tm.tm_sec);
731  break;
732 
733  case 'H':
734  if (t > 1)
735  {
736  t--;
737  t *= (60 * 60);
738  }
739  t += ((tm.tm_min * 60) + tm.tm_sec);
740  break;
741 
742  case 'M':
743  if (t > 1)
744  {
745  t--;
746  t *= (60);
747  }
748  t += (tm.tm_sec);
749  break;
750 
751  default:
752  break;
753  }
754  j += t;
755  }
756 
757  if (j < 0)
758  j *= -1;
759 
760  if (((now > j) || (now < (-1 * j))) ^ invert)
761  optional = 0;
762  break;
763  }
764 
765  p = buf;
766 
767  cp = ((op == 'd') || (op == 'D')) ? (NONULL(C_DateFormat)) : src;
768  bool do_locales;
769  if (*cp == '!')
770  {
771  do_locales = false;
772  cp++;
773  }
774  else
775  do_locales = true;
776 
777  size_t len = buflen - 1;
778  while ((len > 0) &&
779  ((((op == 'd') || (op == 'D')) && *cp) ||
780  ((op == '{') && (*cp != '}')) || ((op == '[') && (*cp != ']')) ||
781  ((op == '(') && (*cp != ')')) || ((op == '<') && (*cp != '>'))))
782  {
783  if (*cp == '%')
784  {
785  cp++;
786  if (((*cp == 'Z') || (*cp == 'z')) && ((op == 'd') || (op == '{')))
787  {
788  if (len >= 5)
789  {
790  sprintf(p, "%c%02u%02u", e->zoccident ? '-' : '+', e->zhours, e->zminutes);
791  p += 5;
792  len -= 5;
793  }
794  else
795  break; /* not enough space left */
796  }
797  else
798  {
799  if (len >= 2)
800  {
801  *p++ = '%';
802  *p++ = *cp;
803  len -= 2;
804  }
805  else
806  break; /* not enough space */
807  }
808  cp++;
809  }
810  else
811  {
812  *p++ = *cp++;
813  len--;
814  }
815  }
816  *p = '\0';
817 
818  if ((op == '[') || (op == 'D'))
820  else if (op == '(')
821  tm = mutt_date_localtime(e->received);
822  else if (op == '<')
823  {
825  }
826  else
827  {
828  /* restore sender's time zone */
829  now = e->date_sent;
830  if (e->zoccident)
831  now -= (e->zhours * 3600 + e->zminutes * 60);
832  else
833  now += (e->zhours * 3600 + e->zminutes * 60);
834  tm = mutt_date_gmtime(now);
835  }
836 
837  if (!do_locales)
838  setlocale(LC_TIME, "C");
839  strftime(tmp, sizeof(tmp), buf, &tm);
840  if (!do_locales)
841  setlocale(LC_TIME, "");
842 
843  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_DATE);
844  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
845  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
846 
847  if ((len > 0) && (op != 'd') && (op != 'D')) /* Skip ending op */
848  src = cp + 1;
849  break;
850  }
851 
852  case 'e':
853  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
854  snprintf(buf, buflen, fmt, mutt_messages_in_thread(m, e, 1));
855  break;
856 
857  case 'E':
858  if (!optional)
859  {
860  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
861  snprintf(buf, buflen, fmt, mutt_messages_in_thread(m, e, 0));
862  }
863  else if (mutt_messages_in_thread(m, e, 0) <= 1)
864  optional = 0;
865  break;
866 
867  case 'f':
868  tmp[0] = '\0';
869  mutt_addr_write(tmp, sizeof(tmp), e->env->from, true);
870  mutt_format_s(buf, buflen, prec, tmp);
871  break;
872 
873  case 'F':
874  if (!optional)
875  {
876  const bool is_plain = (src[0] == 'p');
877  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_AUTHOR);
878  make_from(e->env, tmp, sizeof(tmp), false,
879  (is_plain ? MUTT_FORMAT_PLAIN : MUTT_FORMAT_NO_FLAGS));
880  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
881  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
882 
883  if (is_plain)
884  src++;
885  }
886  else if (mutt_addr_is_user(e->env->from))
887  {
888  optional = 0;
889  }
890  break;
891 
892  case 'g':
893  tags = driver_tags_get_transformed(&e->tags);
894  if (!optional)
895  {
896  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_TAGS);
897  mutt_format_s(buf + colorlen, buflen - colorlen, prec, NONULL(tags));
898  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
899  }
900  else if (!tags)
901  optional = 0;
902  FREE(&tags);
903  break;
904 
905  case 'G':
906  {
907  char format[3];
908  char *tag = NULL;
909 
910  if (!optional)
911  {
912  format[0] = op;
913  format[1] = *src;
914  format[2] = '\0';
915 
916  tag = mutt_hash_find(TagFormats, format);
917  if (tag)
918  {
919  tags = driver_tags_get_transformed_for(tag, &e->tags);
920  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_TAG);
921  mutt_format_s(buf + colorlen, buflen - colorlen, prec, NONULL(tags));
922  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
923  FREE(&tags);
924  }
925  src++;
926  }
927  else
928  {
929  format[0] = op;
930  format[1] = *prec;
931  format[2] = '\0';
932 
933  tag = mutt_hash_find(TagFormats, format);
934  if (tag)
935  {
936  tags = driver_tags_get_transformed_for(tag, &e->tags);
937  if (!tags)
938  optional = 0;
939  FREE(&tags);
940  }
941  }
942  break;
943  }
944 
945  case 'H':
946  /* (Hormel) spam score */
947  if (optional)
948  optional = e->env->spam ? 1 : 0;
949 
950  if (e->env->spam)
951  mutt_format_s(buf, buflen, prec, NONULL(e->env->spam->data));
952  else
953  mutt_format_s(buf, buflen, prec, "");
954  break;
955 
956  case 'i':
957  mutt_format_s(buf, buflen, prec, e->env->message_id ? e->env->message_id : "<no.id>");
958  break;
959 
960  case 'J':
961  {
962  bool have_tags = true;
963  tags = driver_tags_get_transformed(&e->tags);
964  if (tags)
965  {
966  if (flags & MUTT_FORMAT_TREE)
967  {
968  char *parent_tags = NULL;
969  if (e->thread->prev && e->thread->prev->message)
970  {
971  parent_tags = driver_tags_get_transformed(&e->thread->prev->message->tags);
972  }
973  if (!parent_tags && e->thread->parent && e->thread->parent->message)
974  {
975  parent_tags =
977  }
978  if (parent_tags && (mutt_str_strcasecmp(tags, parent_tags) == 0))
979  have_tags = false;
980  FREE(&parent_tags);
981  }
982  }
983  else
984  have_tags = false;
985 
986  if (optional)
987  optional = have_tags;
988 
989  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_TAGS);
990  if (have_tags)
991  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tags);
992  else
993  mutt_format_s(buf + colorlen, buflen - colorlen, prec, "");
994  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
995  FREE(&tags);
996  break;
997  }
998 
999  case 'l':
1000  if (!optional)
1001  {
1002  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1003  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_SIZE);
1004  snprintf(buf + colorlen, buflen - colorlen, fmt, (int) e->lines);
1005  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1006  }
1007  else if (e->lines <= 0)
1008  optional = 0;
1009  break;
1010 
1011  case 'L':
1012  if (!optional)
1013  {
1014  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_AUTHOR);
1015  make_from(e->env, tmp, sizeof(tmp), true, flags);
1016  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
1017  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1018  }
1019  else if (!check_for_mailing_list(e->env->to, NULL, NULL, 0) &&
1020  !check_for_mailing_list(e->env->cc, NULL, NULL, 0))
1021  {
1022  optional = 0;
1023  }
1024  break;
1025 
1026  case 'm':
1027  if (m)
1028  {
1029  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1030  snprintf(buf, buflen, fmt, m->msg_count);
1031  }
1032  else
1033  mutt_str_strfcpy(buf, "(null)", buflen);
1034  break;
1035 
1036  case 'n':
1037  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_AUTHOR);
1038  mutt_format_s(buf + colorlen, buflen - colorlen, prec,
1039  mutt_get_name(e->env->from));
1040  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1041  break;
1042 
1043  case 'M':
1044  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1045  if (!optional)
1046  {
1047  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_COLLAPSED);
1048  if (threads && is_index && e->collapsed && (e->num_hidden > 1))
1049  {
1050  snprintf(buf + colorlen, buflen - colorlen, fmt, e->num_hidden);
1051  add_index_color(buf, buflen - colorlen, flags, MT_COLOR_INDEX);
1052  }
1053  else if (is_index && threads)
1054  {
1055  mutt_format_s(buf + colorlen, buflen - colorlen, prec, " ");
1056  add_index_color(buf, buflen - colorlen, flags, MT_COLOR_INDEX);
1057  }
1058  else
1059  *buf = '\0';
1060  }
1061  else
1062  {
1063  if (!(threads && is_index && e->collapsed && (e->num_hidden > 1)))
1064  optional = 0;
1065  }
1066  break;
1067 
1068  case 'N':
1069  if (!optional)
1070  {
1071  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1072  snprintf(buf, buflen, fmt, e->score);
1073  }
1074  else
1075  {
1076  if (e->score == 0)
1077  optional = 0;
1078  }
1079  break;
1080 
1081  case 'O':
1082  if (!optional)
1083  {
1084  make_from_addr(e->env, tmp, sizeof(tmp), true);
1085  if (!C_SaveAddress && (p = strpbrk(tmp, "%@")))
1086  *p = '\0';
1087  mutt_format_s(buf, buflen, prec, tmp);
1088  }
1089  else if (!check_for_mailing_list_addr(e->env->to, NULL, 0) &&
1090  !check_for_mailing_list_addr(e->env->cc, NULL, 0))
1091  {
1092  optional = 0;
1093  }
1094  break;
1095 
1096  case 'P':
1097  mutt_str_strfcpy(buf, hfi->pager_progress, buflen);
1098  break;
1099 
1100 #ifdef USE_NNTP
1101  case 'q':
1102  mutt_format_s(buf, buflen, prec, e->env->newsgroups ? e->env->newsgroups : "");
1103  break;
1104 #endif
1105 
1106  case 'r':
1107  tmp[0] = '\0';
1108  mutt_addr_write(tmp, sizeof(tmp), e->env->to, true);
1109  if (optional && (tmp[0] == '\0'))
1110  optional = 0;
1111  mutt_format_s(buf, buflen, prec, tmp);
1112  break;
1113 
1114  case 'R':
1115  tmp[0] = '\0';
1116  mutt_addr_write(tmp, sizeof(tmp), e->env->cc, true);
1117  if (optional && (tmp[0] == '\0'))
1118  optional = 0;
1119  mutt_format_s(buf, buflen, prec, tmp);
1120  break;
1121 
1122  case 's':
1123  {
1124  char *subj = NULL;
1125  if (e->env->disp_subj)
1126  subj = e->env->disp_subj;
1127  else if (!STAILQ_EMPTY(&SubjectRegexList))
1128  subj = apply_subject_mods(e->env);
1129  else
1130  subj = e->env->subject;
1131  if (flags & MUTT_FORMAT_TREE && !e->collapsed)
1132  {
1133  if (flags & MUTT_FORMAT_FORCESUBJ)
1134  {
1135  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_SUBJECT);
1136  mutt_format_s(buf + colorlen, buflen - colorlen, "", NONULL(subj));
1137  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1138  snprintf(tmp, sizeof(tmp), "%s%s", e->tree, buf);
1139  mutt_format_s_tree(buf, buflen, prec, tmp);
1140  }
1141  else
1142  mutt_format_s_tree(buf, buflen, prec, e->tree);
1143  }
1144  else
1145  {
1146  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_SUBJECT);
1147  mutt_format_s(buf + colorlen, buflen - colorlen, prec, NONULL(subj));
1148  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1149  }
1150  break;
1151  }
1152 
1153  case 'S':
1154  {
1155  const char *wch = NULL;
1156  if (e->deleted)
1158  else if (e->attach_del)
1160  else if (e->tagged)
1162  else if (e->flagged)
1164  else if (e->replied)
1166  else if (e->read && (ctx && (ctx->msgnotreadyet != e->msgno)))
1168  else if (e->old)
1170  else
1172 
1173  snprintf(tmp, sizeof(tmp), "%s", wch);
1174  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_FLAGS);
1175  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
1176  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1177  break;
1178  }
1179 
1180  case 't':
1181  tmp[0] = '\0';
1182  if (!check_for_mailing_list(e->env->to, "To ", tmp, sizeof(tmp)) &&
1183  !check_for_mailing_list(e->env->cc, "Cc ", tmp, sizeof(tmp)))
1184  {
1185  if (e->env->to)
1186  snprintf(tmp, sizeof(tmp), "To %s", mutt_get_name(e->env->to));
1187  else if (e->env->cc)
1188  snprintf(tmp, sizeof(tmp), "Cc %s", mutt_get_name(e->env->cc));
1189  }
1190  mutt_format_s(buf, buflen, prec, tmp);
1191  break;
1192 
1193  case 'T':
1194  {
1195  int i;
1196  snprintf(fmt, sizeof(fmt), "%%%ss", prec);
1197  snprintf(buf, buflen, fmt,
1198  (C_ToChars && ((i = user_is_recipient(e))) < C_ToChars->len) ?
1199  C_ToChars->chars[i] :
1200  " ");
1201  break;
1202  }
1203 
1204  case 'u':
1205  if (e->env->from && e->env->from->mailbox)
1206  {
1207  mutt_str_strfcpy(tmp, mutt_addr_for_display(e->env->from), sizeof(tmp));
1208  p = strpbrk(tmp, "%@");
1209  if (p)
1210  *p = '\0';
1211  }
1212  else
1213  tmp[0] = '\0';
1214  mutt_format_s(buf, buflen, prec, tmp);
1215  break;
1216 
1217  case 'v':
1218  if (mutt_addr_is_user(e->env->from))
1219  {
1220  if (e->env->to)
1221  mutt_format_s(tmp, sizeof(tmp), prec, mutt_get_name(e->env->to));
1222  else if (e->env->cc)
1223  mutt_format_s(tmp, sizeof(tmp), prec, mutt_get_name(e->env->cc));
1224  else
1225  *tmp = '\0';
1226  }
1227  else
1228  mutt_format_s(tmp, sizeof(tmp), prec, mutt_get_name(e->env->from));
1229  p = strpbrk(tmp, " %@");
1230  if (p)
1231  *p = '\0';
1232  mutt_format_s(buf, buflen, prec, tmp);
1233  break;
1234 
1235  case 'W':
1236  if (!optional)
1237  {
1238  mutt_format_s(buf, buflen, prec, e->env->organization ? e->env->organization : "");
1239  }
1240  else if (!e->env->organization)
1241  optional = 0;
1242  break;
1243 
1244 #ifdef USE_NNTP
1245  case 'x':
1246  if (!optional)
1247  {
1248  mutt_format_s(buf, buflen, prec, e->env->x_comment_to ? e->env->x_comment_to : "");
1249  }
1250  else if (!e->env->x_comment_to)
1251  optional = 0;
1252  break;
1253 #endif
1254 
1255  case 'X':
1256  {
1257  int count = mutt_count_body_parts(m, e);
1258 
1259  /* The recursion allows messages without depth to return 0. */
1260  if (optional)
1261  optional = count != 0;
1262 
1263  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1264  snprintf(buf, buflen, fmt, count);
1265  break;
1266  }
1267 
1268  case 'y':
1269  if (optional)
1270  optional = e->env->x_label ? 1 : 0;
1271 
1272  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_LABEL);
1273  mutt_format_s(buf + colorlen, buflen - colorlen, prec, NONULL(e->env->x_label));
1274  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1275  break;
1276 
1277  case 'Y':
1278  {
1279  bool label = true;
1280  if (e->env->x_label)
1281  {
1282  struct Email *etmp = NULL;
1283  if (flags & MUTT_FORMAT_TREE && (e->thread->prev && e->thread->prev->message &&
1284  e->thread->prev->message->env->x_label))
1285  {
1286  etmp = e->thread->prev->message;
1287  }
1288  else if (flags & MUTT_FORMAT_TREE &&
1289  (e->thread->parent && e->thread->parent->message &&
1290  e->thread->parent->message->env->x_label))
1291  {
1292  etmp = e->thread->parent->message;
1293  }
1294  if (etmp && (mutt_str_strcasecmp(e->env->x_label, etmp->env->x_label) == 0))
1295  label = false;
1296  }
1297  else
1298  label = false;
1299 
1300  if (optional)
1301  optional = label;
1302 
1303  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_LABEL);
1304  if (label)
1305  mutt_format_s(buf + colorlen, buflen - colorlen, prec, NONULL(e->env->x_label));
1306  else
1307  mutt_format_s(buf + colorlen, buflen - colorlen, prec, "");
1308  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1309  break;
1310  }
1311 
1312  case 'z':
1313  if (src[0] == 's') /* status: deleted/new/old/replied */
1314  {
1315  const char *ch = NULL;
1316  if (e->deleted)
1318  else if (e->attach_del)
1320  else if (threads && thread_is_new(ctx, e))
1322  else if (threads && thread_is_old(ctx, e))
1324  else if (e->read && (ctx && (ctx->msgnotreadyet != e->msgno)))
1325  {
1326  if (e->replied)
1328  else
1330  }
1331  else
1332  {
1333  if (e->old)
1335  else
1337  }
1338 
1339  snprintf(tmp, sizeof(tmp), "%s", ch);
1340  src++;
1341  }
1342  else if (src[0] == 'c') /* crypto */
1343  {
1344  const char *ch = NULL;
1345  if ((WithCrypto != 0) && (e->security & SEC_GOODSIGN))
1347  else if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1349  else if ((WithCrypto != 0) && (e->security & SEC_SIGN))
1351  else if (((WithCrypto & APPLICATION_PGP) != 0) && ((e->security & PGP_KEY) == PGP_KEY))
1352  {
1354  }
1355  else
1357 
1358  snprintf(tmp, sizeof(tmp), "%s", ch);
1359  src++;
1360  }
1361  else if (src[0] == 't') /* tagged, flagged, recipient */
1362  {
1363  const char *ch = NULL;
1364  if (e->tagged)
1366  else if (e->flagged)
1368  else
1370 
1371  snprintf(tmp, sizeof(tmp), "%s", ch);
1372  src++;
1373  }
1374  else /* fallthrough */
1375  break;
1376 
1377  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_FLAGS);
1378  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
1379  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1380  break;
1381 
1382  case 'Z':
1383  {
1384  /* New/Old for threads; replied; New/Old for messages */
1385  const char *first = NULL;
1386  if (threads && thread_is_new(ctx, e))
1388  else if (threads && thread_is_old(ctx, e))
1390  else if (e->read && (ctx && (ctx->msgnotreadyet != e->msgno)))
1391  {
1392  if (e->replied)
1394  else
1396  }
1397  else
1398  {
1399  if (e->old)
1401  else
1403  }
1404 
1405  /* Marked for deletion; deleted attachments; crypto */
1406  const char *second = NULL;
1407  if (e->deleted)
1409  else if (e->attach_del)
1411  else if ((WithCrypto != 0) && (e->security & SEC_GOODSIGN))
1413  else if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1415  else if ((WithCrypto != 0) && (e->security & SEC_SIGN))
1417  else if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & PGP_KEY))
1419  else
1421 
1422  /* Tagged, flagged and recipient flag */
1423  const char *third = NULL;
1424  if (e->tagged)
1426  else if (e->flagged)
1428  else
1430 
1431  snprintf(tmp, sizeof(tmp), "%s%s%s", first, second, third);
1432  }
1433 
1434  colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_FLAGS);
1435  mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp);
1436  add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX);
1437  break;
1438 
1439  case '@':
1440  {
1441  const char *end = src;
1442  static unsigned char recurse = 0;
1443 
1444  while ((*end != '\0') && (*end != '@'))
1445  end++;
1446  if ((*end == '@') && (recurse < 20))
1447  {
1448  recurse++;
1449  mutt_str_substr_cpy(tmp, src, end, sizeof(tmp));
1450  mutt_expando_format(tmp, sizeof(tmp), col, cols,
1451  NONULL(mutt_idxfmt_hook(tmp, m, e)),
1452  index_format_str, data, flags);
1453  mutt_format_s_x(buf, buflen, prec, tmp, true);
1454  recurse--;
1455 
1456  src = end + 1;
1457  break;
1458  }
1459  }
1460  /* fallthrough */
1461 
1462  default:
1463  snprintf(buf, buflen, "%%%s%c", prec, op);
1464  break;
1465  }
1466 
1467  if (optional)
1468  {
1469  mutt_expando_format(buf, buflen, col, cols, if_str, index_format_str,
1470  (unsigned long) hfi, flags);
1471  }
1472  else if (flags & MUTT_FORMAT_OPTIONAL)
1473  {
1474  mutt_expando_format(buf, buflen, col, cols, else_str, index_format_str,
1475  (unsigned long) hfi, flags);
1476  }
1477 
1478  return src;
1479 }
Index: subject field (takes a pattern)
Definition: mutt_curses.h:160
struct Context * ctx
Definition: hdrline.h:45
The "current" mailbox.
Definition: context.h:38
Character denoting a tagged email.
Definition: hdrline.c:71
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:836
Character denoting a important (flagged) email.
Definition: hdrline.c:72
int lines
how many lines in the body of this message?
Definition: email.h:87
#define NONULL(x)
Definition: string2.h:36
int msg_count
total number of messages
Definition: mailbox.h:92
The envelope/body of an email.
Definition: email.h:37
char ** chars
The array of multibyte character strings.
Definition: mbtable.h:39
Index: tags field (g, J)
Definition: mutt_curses.h:167
struct tm mutt_date_localtime(time_t t)
Converts calendar time to a broken-down time structure expressed in user timezone.
Definition: date.c:725
#define MUTT_FORMAT_FORCESUBJ
Print the subject even if unchanged.
Definition: format_flags.h:31
struct Address * to
Definition: envelope.h:42
struct MuttThread * thread
Definition: email.h:97
static bool thread_is_new(struct Context *ctx, struct Email *e)
Does the email thread contain any new emails?
Definition: hdrline.c:477
char * disp_subj
display subject (modified copy of subject)
Definition: envelope.h:52
Character denoting a thread containing at least one new email.
Definition: hdrline.c:79
bool attach_del
has an attachment marked for deletion
Definition: email.h:49
int msgnotreadyet
which msg "new" in pager, -1 if none
Definition: context.h:46
void * mutt_hash_find(const struct Hash *table, const char *strkey)
Find the HashElem data in a Hash table element using a key.
Definition: hash.c:379
WHERE struct Hash * TagFormats
Hash table of tag-formats (tag -> format string)
Definition: globals.h:59
Character denoting a message contains a PGP key.
Definition: hdrline.c:92
#define MUTT_DATE_NOW
Constant representing the &#39;current time&#39;, see: mutt_date_gmtime(), mutt_date_localtime() ...
Definition: date.h:29
struct MuttThread * parent
Definition: thread.h:44
char * mailbox
mailbox and host address
Definition: address.h:35
Character denoting a read email, $index_format S expando.
Definition: hdrline.c:80
struct TagHead tags
for drivers that support server tagging
Definition: email.h:110
char * mutt_str_substr_cpy(char *dest, const char *begin, const char *end, size_t destlen)
Copy a sub-string into a buffer.
Definition: string.c:559
struct tm mutt_date_gmtime(time_t t)
Converts calendar time to a broken-down time structure expressed in UTC timezone. ...
Definition: date.c:743
char * driver_tags_get_transformed(struct TagHead *head)
Get transformed tags.
Definition: tags.c:138
#define SEC_ENCRYPT
Email is encrypted.
Definition: ncrypt.h:120
bool zoccident
Definition: email.h:66
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
struct MbTable * C_ToChars
Config: Indicator characters for the &#39;To&#39; field in the index.
Definition: hdrline.c:64
static char * apply_subject_mods(struct Envelope *env)
Apply regex modifications to the subject.
Definition: hdrline.c:453
static bool check_for_mailing_list(struct Address *addr, const char *pfx, char *buf, int buflen)
Search list of addresses for a mailing list.
Definition: hdrline.c:135
struct Address * reply_to
Definition: envelope.h:46
static void make_from(struct Envelope *env, char *buf, size_t buflen, bool do_lists, MuttFormatFlags flags)
Generate a From: field (with optional prefix)
Definition: hdrline.c:307
bool tagged
Definition: email.h:44
bool read
Definition: email.h:51
char * message_id
Definition: envelope.h:53
struct MuttThread * prev
Definition: thread.h:47
#define MUTT_FORMAT_TREE
Draw the thread tree.
Definition: format_flags.h:32
bool old
Definition: email.h:50
Data passed to index_format_str()
Definition: hdrline.h:43
size_t mutt_email_size(const struct Email *e)
compute the size of an email
Definition: email.c:109
#define SEC_GOODSIGN
Email has a valid signature.
Definition: ncrypt.h:122
Index: default colour (takes a pattern)
Definition: mutt_curses.h:156
struct Envelope * env
envelope information
Definition: email.h:92
Character denoting a deleted attachment.
Definition: hdrline.c:74
struct Mailbox * mailbox
Definition: hdrline.h:46
Index: index number.
Definition: mutt_curses.h:165
const char * mutt_addr_for_display(struct Address *a)
Convert an Address for display purposes.
Definition: address.c:1024
Character denoting an email that has been read.
Definition: hdrline.c:76
static int user_is_recipient(struct Email *e)
Is the user a recipient of the message.
Definition: hdrline.c:412
Character denoting a thread of emails that has been read.
Definition: hdrline.c:78
static bool first_mailing_list(char *buf, size_t buflen, struct Address *a)
Get the first mailing list in the list of addresses.
Definition: hdrline.c:179
WHERE short C_Sort
Config: Sort method for the index.
Definition: sort.h:58
struct Address * from
Definition: envelope.h:41
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
Write an Address to a buffer.
Definition: address.c:1184
int flags
e.g.
Definition: mailbox.h:134
int score
Definition: email.h:91
time_t date_sent
time when the message was sent (UTC)
Definition: email.h:84
#define mutt_b2s(buf)
Definition: buffer.h:42
char * x_comment_to
Definition: envelope.h:62
const char * mutt_idxfmt_hook(const char *name, struct Mailbox *m, struct Email *e)
Get index-format-hook format string.
Definition: hook.c:873
Index: tag field (g, takes a pattern)
Definition: mutt_curses.h:159
#define SEC_SIGN
Email is signed.
Definition: ncrypt.h:121
Index: flags field (takes a pattern)
Definition: mutt_curses.h:158
Character denoting an email that has been replied to.
Definition: hdrline.c:75
Index: date field.
Definition: mutt_curses.h:163
A mailbox.
Definition: mailbox.h:83
void mutt_format_s_x(char *buf, size_t buflen, const char *prec, const char *s, bool arboreal)
Format a string like snprintf()
Definition: curs_lib.c:1087
static void make_from_addr(struct Envelope *env, char *buf, size_t buflen, bool do_lists)
Create a &#39;from&#39; address for a reply email.
Definition: hdrline.c:363
size_t num_hidden
number of hidden messages in this view
Definition: email.h:78
#define PGP_KEY
Definition: ncrypt.h:138
static bool thread_is_old(struct Context *ctx, struct Email *e)
Does the email thread contain any unread emails?
Definition: hdrline.c:489
Index: author field (takes a pattern)
Definition: mutt_curses.h:157
Character denoting a message signed with a verified key.
Definition: hdrline.c:89
char * data
pointer to data
Definition: buffer.h:35
bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen)
Turn a name into initials.
Definition: mbyte.c:84
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
static size_t add_index_color(char *buf, size_t buflen, MuttFormatFlags flags, char color)
Insert a color marker into a string.
Definition: hdrline.c:202
bool collapsed
is this message part of a collapsed thread?
Definition: email.h:76
char * driver_tags_get_transformed_for(const char *name, struct TagHead *head)
Get transformed tag for a tag name from a header.
Definition: tags.c:177
Character denoting a message is PGP-encrypted.
Definition: hdrline.c:90
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, int flag)
Count the messages in a thread.
Definition: mutt_thread.c:1391
unsigned int zhours
Definition: email.h:64
char * tree
character string to print thread tree
Definition: email.h:96
SecurityFlags security
bit 0-8: flags, bit 9,10: application.
Definition: email.h:39
struct Email * message
Definition: thread.h:48
static const char * get_nth_wchar(struct MbTable *table, int index)
Extract one char from a multi-byte table.
Definition: hdrline.c:254
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: ncrypt.h:129
struct Buffer * pathbuf
Definition: mailbox.h:85
Character denoting a read email, $index_format Z expando.
Definition: hdrline.c:81
#define MUTT_FORMAT_INDEX
This is a main index entry.
Definition: format_flags.h:36
const char * mutt_get_name(struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:154
struct Buffer * spam
Definition: envelope.h:64
char * subject
Definition: envelope.h:50
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string.
Definition: curs_lib.c:1124
#define MUTT_FORMAT_PLAIN
Do not prepend DISP_TO, DISP_CC ...
Definition: format_flags.h:38
bool flagged
marked important?
Definition: email.h:43
char * newsgroups
Definition: envelope.h:59
Character denoting a deleted email.
Definition: hdrline.c:73
struct MbTable * C_FlagChars
Config: User-configurable index flags: tagged, new, etc.
Definition: hdrline.c:62
bool deleted
Definition: email.h:45
Index: size field.
Definition: mutt_curses.h:166
bool replied
Definition: email.h:54
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
WHERE char * C_DateFormat
Config: strftime format string for the d expando.
Definition: globals.h:101
Character denoting an unread email.
Definition: hdrline.c:77
Character denoting a message has no cryptography information.
Definition: hdrline.c:93
#define FREE(x)
Definition: memory.h:40
const char * pager_progress
Definition: hdrline.h:48
char * organization
Definition: envelope.h:57
Character denoting a message is signed.
Definition: hdrline.c:91
#define STAILQ_EMPTY(head)
Definition: queue.h:346
#define MUTT_FORMAT_OPTIONAL
Allow optional field processing.
Definition: format_flags.h:33
Index: number of messages in collapsed thread.
Definition: mutt_curses.h:162
Index: label field.
Definition: mutt_curses.h:164
int mutt_count_body_parts(struct Mailbox *m, struct Email *e)
Count the MIME Body parts.
Definition: mutt_parse.c:216
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: string.c:1049
static bool check_for_mailing_list_addr(struct Address *addr, char *buf, int buflen)
Check an address list for a mailing list.
Definition: hdrline.c:158
struct MbTable * C_CryptChars
Config: User-configurable crypto flags: signed, encrypted etc.
Definition: hdrline.c:61
struct Email * email
Definition: hdrline.h:47
Sort by email threads.
Definition: sort.h:56
char * x_label
Definition: envelope.h:56
#define WithCrypto
Definition: ncrypt.h:155
#define SORT_MASK
Mask for the sort id.
Definition: sort.h:85
unsigned int zminutes
Definition: email.h:65
time_t received
time when the message was placed in the mailbox
Definition: email.h:85
struct Address * cc
Definition: envelope.h:43
WHERE bool C_SaveAddress
Config: Use sender&#39;s full address as a default save folder.
Definition: globals.h:246
bool mutt_addr_is_user(struct Address *addr)
Does the address belong to the user.
Definition: alias.c:677
int len
Number of characters.
Definition: mbtable.h:38
void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string with tree characters.
Definition: curs_lib.c:1136
int msgno
number displayed to the user
Definition: email.h:89
static const char * index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, MuttFormatFlags flags)
Format a string for the index list - Implements format_t.
Definition: hdrline.c:550
struct ReplaceList SubjectRegexList
List of regexes to tidy the view of the email&#39;s subject.
Definition: email_globals.c:53

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_make_string_flags ( char *  buf,
size_t  buflen,
const char *  s,
struct Context ctx,
struct Mailbox m,
struct Email e,
MuttFormatFlags  flags 
)

Create formatted strings using mailbox expandos.

Parameters
bufBuffer for the result
buflenBuffer length
sprintf-line format string
ctxMailbox Context
mMailbox
eEmail
flagsFlags, see MuttFormatFlags

Definition at line 1491 of file hdrline.c.

1493 {
1494  struct HdrFormatInfo hfi;
1495 
1496  hfi.email = e;
1497  hfi.ctx = ctx;
1498  hfi.mailbox = m;
1499  hfi.pager_progress = 0;
1500 
1501  mutt_expando_format(buf, buflen, 0, MuttIndexWindow->cols, s,
1502  index_format_str, (unsigned long) &hfi, flags);
1503 }
struct Context * ctx
Definition: hdrline.h:45
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:836
struct Mailbox * mailbox
Definition: context.h:52
Data passed to index_format_str()
Definition: hdrline.h:43
struct MuttWindow * MuttIndexWindow
Index Window.
Definition: mutt_window.c:39
struct Email * email
Definition: hdrline.h:47
static const char * index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, MuttFormatFlags flags)
Format a string for the index list - Implements format_t.
Definition: hdrline.c:550

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_make_string_info ( char *  buf,
size_t  buflen,
int  cols,
const char *  s,
struct HdrFormatInfo hfi,
MuttFormatFlags  flags 
)

Create pager status bar string.

Parameters
bufBuffer for the result
buflenBuffer length
colsNumber of screen columns
sprintf-line format string
hfiMailbox data to pass to the formatter
flagsFlags, see MuttFormatFlags

Definition at line 1514 of file hdrline.c.

1516 {
1517  mutt_expando_format(buf, buflen, 0, cols, s, index_format_str, (unsigned long) hfi, flags);
1518 }
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:836
static const char * index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, MuttFormatFlags flags)
Format a string for the index list - Implements format_t.
Definition: hdrline.c:550

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct MbTable* C_CryptChars

Config: User-configurable crypto flags: signed, encrypted etc.

Definition at line 61 of file hdrline.c.

struct MbTable* C_FlagChars

Config: User-configurable index flags: tagged, new, etc.

Definition at line 62 of file hdrline.c.

struct MbTable* C_FromChars

Config: User-configurable index flags: to address, cc address, etc.

Definition at line 63 of file hdrline.c.

struct MbTable* C_ToChars

Config: Indicator characters for the 'To' field in the index.

Definition at line 64 of file hdrline.c.