String processing routines to generate the mail index. More...
#include "config.h"
#include <locale.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "gui/lib.h"
#include "hdrline.h"
#include "ncrypt/lib.h"
#include "context.h"
#include "format_flags.h"
#include "hook.h"
#include "maillist.h"
#include "mutt_globals.h"
#include "mutt_menu.h"
#include "mutt_parse.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "sort.h"
#include "notmuch/lib.h"
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 $flag_chars 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 $crypt_chars variable ($crypt_chars) More... | |
enum | FieldType { DISP_TO, DISP_CC, DISP_BCC, DISP_FROM, DISP_PLAIN, DISP_MAX } |
Header types. More... | |
Functions | |
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 AddressList *al) |
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 Email *e) |
Does the email thread contain any new emails? More... | |
static bool | thread_is_old (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, intptr_t data, MuttFormatFlags flags) |
Format a string for the index list - Implements format_t. More... | |
void | mutt_make_string_flags (char *buf, size_t buflen, int cols, const char *s, struct Mailbox *m, int inpgr, 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 MbTable * | C_CryptChars |
Config: User-configurable crypto flags: signed, encrypted etc. More... | |
struct MbTable * | C_FlagChars |
Config: User-configurable index flags: tagged, new, etc. More... | |
struct MbTable * | C_FromChars |
Config: User-configurable index flags: to address, cc address, etc. More... | |
struct MbTable * | C_ToChars |
Config: Indicator characters for the 'To' field in the index. More... | |
String processing routines to generate the mail index.
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.
enum FlagChars |
Index into the $flag_chars
variable ($flag_chars)
Definition at line 72 of file hdrline.c.
enum CryptChars |
Index into the $crypt_chars
variable ($crypt_chars)
Definition at line 90 of file hdrline.c.
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 104 of file hdrline.c.
|
static |
Insert a color marker into a string.
buf | Buffer to store marker |
buflen | Buffer length |
flags | Flags, see MuttFormatFlags |
color | Color, e.g. MT_COLOR_MESSAGE |
num | Characters written |
The colors are stored as "magic" strings embedded in the text.
Definition at line 124 of file hdrline.c.
|
static |
Extract one char from a multi-byte table.
table | Multi-byte table |
index | Select this character |
ptr | String 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 161 of file hdrline.c.
|
static |
Create a prefix for an author field.
disp | Type of field |
ptr | Prefix 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 180 of file hdrline.c.
|
static |
Generate a From: field (with optional prefix)
env | Envelope of the email |
buf | Buffer to store the result |
buflen | Size of the buffer |
do_lists | Should we check for mailing lists? |
flags | Format 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 214 of file hdrline.c.
|
static |
Create a 'from' address for a reply email.
env | Envelope of current email |
buf | Buffer for the result |
buflen | Length of buffer |
do_lists | If true, check for mailing lists |
Definition at line 270 of file hdrline.c.
|
static |
Do any of the addresses refer to the user?
al | AddressList |
true | If any of the addresses match one of the user's addresses |
Definition at line 300 of file hdrline.c.
|
static |
Is the user a recipient of the message.
e | Email to test |
0 | User is not in list |
1 | User is unique recipient |
2 | User is in the TO list |
3 | User is in the CC list |
4 | User is originator |
5 | Sent to a subscribed mailinglist |
6 | User is in the Reply-To list |
Definition at line 320 of file hdrline.c.
|
static |
Apply regex modifications to the subject.
env | Envelope of email |
ptr | Modified subject |
NULL | No modification made |
Definition at line 361 of file hdrline.c.
|
static |
Does the email thread contain any new emails?
e |
true | If thread contains new mail |
Definition at line 384 of file hdrline.c.
|
static |
Does the email thread contain any unread emails?
e |
true | If thread contains unread mail |
Definition at line 394 of file hdrline.c.
|
static |
Format a string for the index list - Implements format_t.
Expando | Description |
---|---|
%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 email was sent, or else the folder name (b) |
%C | Current message number |
%c | Number of characters (bytes) in the body of the message |
%cr | Number of characters (bytes) in the message, including header |
%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 email 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) | Date/time when the message was received |
%[fmt] | Message date/time converted to the local time zone |
%{fmt} | Message date/time converted to sender's time zone |
Definition at line 455 of file hdrline.c.
void mutt_make_string_flags | ( | char * | buf, |
size_t | buflen, | ||
int | cols, | ||
const char * | s, | ||
struct Mailbox * | m, | ||
int | inpgr, | ||
struct Email * | e, | ||
MuttFormatFlags | flags | ||
) |
Create formatted strings using mailbox expandos.
buf | Buffer for the result |
buflen | Buffer length |
cols | Number of screen columns (OPTIONAL) |
s | printf-line format string |
m | Mailbox |
inpgr | Message shown in the pager |
e | |
flags | Flags, see MuttFormatFlags |
Definition at line 1415 of file hdrline.c.
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.
buf | Buffer for the result |
buflen | Buffer length |
cols | Number of screen columns |
s | printf-line format string |
hfi | Mailbox data to pass to the formatter |
flags | Flags, see MuttFormatFlags |
Definition at line 1438 of file hdrline.c.
struct MbTable* C_CryptChars |
struct MbTable* C_FlagChars |
struct MbTable* C_FromChars |