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 "attach/lib.h"
#include "color/lib.h"
#include "ncrypt/lib.h"
#include "format_flags.h"
#include "hook.h"
#include "maillist.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "mx.h"
#include "sort.h"
#include "subjectrx.h"
#include "notmuch/lib.h"
Go to the source code of this file.
Data Structures | |
struct | HdrFormatInfo |
Data passed to index_format_str() More... | |
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, enum ColorId color) |
Insert a color marker into a string. More... | |
static const char * | get_nth_wchar (const 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 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 (char *buf, size_t buflen, int cols, const char *s, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress) |
Create formatted strings using mailbox expandos. 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 77 of file hdrline.c.
enum CryptChars |
Index into the $crypt_chars
variable ($crypt_chars)
Definition at line 95 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 |
|
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 129 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 166 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 185 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 221 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 277 of file hdrline.c.
|
static |
Do any of the addresses refer to the user?
al | AddressList |
true | Any of the addresses match one of the user's addresses |
Definition at line 307 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 327 of file hdrline.c.
|
static |
Does the email thread contain any new emails?
e |
true | Thread contains new mail |
Definition at line 379 of file hdrline.c.
|
static |
void mutt_make_string | ( | char * | buf, |
size_t | buflen, | ||
int | cols, | ||
const char * | s, | ||
struct Mailbox * | m, | ||
int | inpgr, | ||
struct Email * | e, | ||
MuttFormatFlags | flags, | ||
const char * | progress | ||
) |
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 |
progress | Pager progress string |
Definition at line 1489 of file hdrline.c.