String processing routines to generate the mail index. More...
#include "config.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 | 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. | |
static const char * | make_from_prefix (enum FieldType disp) |
Create a prefix for an author field. | |
static void | make_from (struct Envelope *env, char *buf, size_t buflen, bool do_lists, MuttFormatFlags flags) |
Generate a From: field (with optional prefix) | |
static void | make_from_addr (struct Envelope *env, char *buf, size_t buflen, bool do_lists) |
Create a 'from' address for a reply email. | |
static bool | user_in_addr (struct AddressList *al) |
Do any of the addresses refer to the user? | |
static enum ToChars | user_is_recipient (struct Email *e) |
Is the user a recipient of the message. | |
static bool | thread_is_new (struct Email *e) |
Does the email thread contain any new emails? | |
static bool | thread_is_old (struct Email *e) |
Does the email thread contain any unread emails? | |
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 -. | |
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. | |
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 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 98 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 133 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 169 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 225 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 255 of file hdrline.c.
Is the user a recipient of the message.
e | Email to test |
enum | Character index into the $to_chars config variable |
Definition at line 269 of file hdrline.c.
|
static |
Does the email thread contain any new emails?
e |
true | Thread contains new mail |
Definition at line 321 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 1426 of file hdrline.c.