NeoMutt  2025-09-05-43-g177ed6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
expando_status.c File Reference

GUI display a user-configurable status line. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "expando_status.h"
#include "expando/lib.h"
#include "menu/lib.h"
#include "postpone/lib.h"
#include "globals.h"
#include "mutt_mailbox.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "mview.h"
#include "shared_data.h"
#include "version.h"
+ Include dependency graph for expando_status.c:

Go to the source code of this file.

Functions

static void index_mailbox_path (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: pathname of the mailbox - Implements get_string_t -.
 
static char * get_sort_str (char *buf, size_t buflen, enum EmailSortType method)
 Get the sort method as a string.
 
static void global_config_sort (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Sorting mode - Implements get_string_t -.
 
static void global_config_sort_aux (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Aux sorting method - Implements get_string_t -.
 
static void global_config_use_threads (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Current threading mode - Implements get_string_t -.
 
static void global_hostname (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Local hostname - Implements get_string_t -.
 
static void global_version (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Version string - Implements get_string_t -.
 
static long index_deleted_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of deleted messages - Implements get_number_t -.
 
static void index_description (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Description of the mailbox - Implements get_string_t -.
 
static long index_flagged_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of flagged messages - Implements get_number_t -.
 
static long index_limit_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of messages - Implements get_number_t -.
 
static void index_limit_pattern (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Active limit pattern - Implements get_string_t -.
 
static void index_limit_size (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Size of the messages - Implements get_string_t -.
 
static long index_limit_size_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Size of the messages - Implements get_number_t -.
 
static void index_mailbox_size (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Size of the current mailbox - Implements get_string_t -.
 
static long index_mailbox_size_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Size of the current mailbox - Implements get_number_t -.
 
static long index_message_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of messages in the mailbox - Implements get_number_t -.
 
static long index_new_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of new messages - Implements get_number_t -.
 
static long index_old_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of old messages - Implements get_number_t -.
 
static long index_postponed_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of postponed messages - Implements get_number_t -.
 
static void index_readonly (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Modified/read-only flag - Implements get_string_t -.
 
static long index_read_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of read messages - Implements get_number_t -.
 
static long index_tagged_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of tagged messages - Implements get_number_t -.
 
static long index_unread_count_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of unread messages - Implements get_number_t -.
 
static long index_unread_mailboxes_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Number of mailboxes with new mail - Implements get_number_t -.
 
static void menu_percentage (const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
 Status: Percentage through index - Implements get_string_t -.
 
static long menu_percentage_num (const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
 Status: Percentage through index - Implements get_number_t -.
 

Variables

const struct Mapping SortMethods []
 Sort methods for '$sort' for the index.
 
const struct ExpandoRenderCallback StatusRenderCallbacks []
 Callbacks for Status Expandos.
 

Detailed Description

GUI display a user-configurable status line.

Authors
  • Michael R. Elkins
  • Richard Russon
  • Austin Ray
  • Pietro Cerutti
  • Eric Blake
  • Dennis Schön
  • Tóth János

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 expando_status.c.

Function Documentation

◆ get_sort_str()

static char * get_sort_str ( char * buf,
size_t buflen,
enum EmailSortType method )
static

Get the sort method as a string.

Parameters
bufBuffer for the sort string
buflenLength of the buffer
methodSort method, see EmailSortType
Return values
ptrBuffer pointer

Definition at line 67 of file expando_status.c.

68{
69 snprintf(buf, buflen, "%s%s%s", (method & SORT_REVERSE) ? "reverse-" : "",
70 (method & SORT_LAST) ? "last-" : "",
72 return buf;
73}
#define SORT_MASK
Mask for the sort id.
Definition sort.h:38
#define SORT_LAST
Sort thread by last-X, e.g. received date.
Definition sort.h:40
#define SORT_REVERSE
Reverse the order of the sort.
Definition sort.h:39
const struct Mapping SortMethods[]
Sort methods for '$sort' for the index.
Definition mutt_config.c:87
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition mapping.c:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ global_hostname()

static void global_hostname ( const struct ExpandoNode * node,
void * data,
MuttFormatFlags flags,
struct Buffer * buf )
static

Status: Local hostname - Implements get_string_t -.

Definition at line 115 of file expando_status.c.

117{
118 const char *s = ShortHostname;
119 buf_strcpy(buf, s);
120}
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:395
char * ShortHostname
Short version of the hostname.
Definition globals.c:37
+ Here is the call graph for this function:

◆ global_version()

static void global_version ( const struct ExpandoNode * node,
void * data,
MuttFormatFlags flags,
struct Buffer * buf )
static

Status: Version string - Implements get_string_t -.

Definition at line 125 of file expando_status.c.

127{
128 const char *s = mutt_make_version();
129 buf_strcpy(buf, s);
130}
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition version.c:295
+ Here is the call graph for this function:

Variable Documentation

◆ SortMethods

const struct Mapping SortMethods[]
extern

Sort methods for '$sort' for the index.

Definition at line 87 of file mutt_config.c.

87 {
88 // clang-format off
89 { "date", EMAIL_SORT_DATE },
90 { "date-received", EMAIL_SORT_DATE_RECEIVED },
91 { "from", EMAIL_SORT_FROM },
92 { "label", EMAIL_SORT_LABEL },
93 { "score", EMAIL_SORT_SCORE },
94 { "size", EMAIL_SORT_SIZE },
95 { "spam", EMAIL_SORT_SPAM },
96 { "subject", EMAIL_SORT_SUBJECT },
97 { "threads", EMAIL_SORT_THREADS },
98 { "to", EMAIL_SORT_TO },
99 { "unsorted", EMAIL_SORT_UNSORTED },
100 // Compatibility
101 { "date-sent", EMAIL_SORT_DATE },
102 { "mailbox-order", EMAIL_SORT_UNSORTED },
103 { NULL, 0 },
104 // clang-format on
105};
@ EMAIL_SORT_LABEL
Sort by the emails label.
Definition sort.h:57
@ EMAIL_SORT_DATE_RECEIVED
Sort by when the message were delivered locally.
Definition sort.h:55
@ EMAIL_SORT_SPAM
Sort by the email's spam score.
Definition sort.h:60
@ EMAIL_SORT_SCORE
Sort by the email's score.
Definition sort.h:58
@ EMAIL_SORT_DATE
Sort by the date the email was sent.
Definition sort.h:54
@ EMAIL_SORT_THREADS
Sort by email threads.
Definition sort.h:62
@ EMAIL_SORT_SUBJECT
Sort by the email's subject.
Definition sort.h:61
@ EMAIL_SORT_FROM
Sort by the email's From field.
Definition sort.h:56
@ EMAIL_SORT_UNSORTED
Sort by the order the messages appear in the mailbox.
Definition sort.h:64
@ EMAIL_SORT_SIZE
Sort by the size of the email.
Definition sort.h:59
@ EMAIL_SORT_TO
Sort by the email's To field.
Definition sort.h:63

◆ StatusRenderCallbacks

const struct ExpandoRenderCallback StatusRenderCallbacks[]
Initial value:
= {
{ -1, -1, NULL, NULL },
}
@ ED_MENU
Menu ED_MEN_ ExpandoDataMenu.
Definition domain.h:48
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition domain.h:44
@ ED_INDEX
Index ED_IND_ ExpandoDataIndex.
Definition domain.h:46
static long index_deleted_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of deleted messages - Implements get_number_t -.
static long index_tagged_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of tagged messages - Implements get_number_t -.
static long index_limit_size_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Size of the messages - Implements get_number_t -.
static long index_old_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of old messages - Implements get_number_t -.
static long index_limit_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of messages - Implements get_number_t -.
static long index_new_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of new messages - Implements get_number_t -.
static long index_mailbox_size_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Size of the current mailbox - Implements get_number_t -.
static long index_postponed_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of postponed messages - Implements get_number_t -.
static long index_unread_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of unread messages - Implements get_number_t -.
static long index_unread_mailboxes_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of mailboxes with new mail - Implements get_number_t -.
static long index_flagged_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of flagged messages - Implements get_number_t -.
static long menu_percentage_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Percentage through index - Implements get_number_t -.
static long index_message_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of messages in the mailbox - Implements get_number_t -.
static long index_read_count_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Status: Number of read messages - Implements get_number_t -.
static void global_config_sort(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Sorting mode - Implements get_string_t -.
static void global_config_sort_aux(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Aux sorting method - Implements get_string_t -.
static void index_limit_size(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Size of the messages - Implements get_string_t -.
static void global_hostname(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Compose: Hostname - Implements get_string_t -.
Definition expando.c:81
static void index_mailbox_path(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: pathname of the mailbox - Implements get_string_t -.
static void menu_percentage(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Percentage through index - Implements get_string_t -.
static void global_version(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Compose: Version - Implements get_string_t -.
Definition expando.c:91
static void index_description(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Description of the mailbox - Implements get_string_t -.
static void index_readonly(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Modified/read-only flag - Implements get_string_t -.
static void index_mailbox_size(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Size of the current mailbox - Implements get_string_t -.
static void index_limit_pattern(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Active limit pattern - Implements get_string_t -.
static void global_config_use_threads(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Status: Current threading mode - Implements get_string_t -.
@ ED_IND_LIMIT_COUNT
Mailbox.vcount.
Definition shared_data.h:59
@ ED_IND_MAILBOX_PATH
Mailbox.pathbuf, Mailbox.name.
Definition shared_data.h:62
@ ED_IND_DELETED_COUNT
Mailbox.msg_deleted.
Definition shared_data.h:56
@ ED_IND_NEW_COUNT
Mailbox.msg_new.
Definition shared_data.h:65
@ ED_IND_MAILBOX_SIZE
Mailbox.size.
Definition shared_data.h:63
@ ED_IND_LIMIT_PATTERN
MailboxView.pattern.
Definition shared_data.h:60
@ ED_IND_READ_COUNT
Mailbox.msg_count, Mailbox.msg_unread.
Definition shared_data.h:69
@ ED_IND_POSTPONED_COUNT
mutt_num_postponed()
Definition shared_data.h:67
@ ED_IND_FLAGGED_COUNT
Mailbox.msg_flagged.
Definition shared_data.h:58
@ ED_IND_MESSAGE_COUNT
Mailbox.msg_count.
Definition shared_data.h:64
@ ED_IND_OLD_COUNT
Mailbox.msg_unread, Mailbox.msg_new.
Definition shared_data.h:66
@ ED_IND_READONLY
Mailbox.readonly, Mailbox.dontwrite.
Definition shared_data.h:68
@ ED_IND_UNREAD_COUNT
Mailbox.msg_unread.
Definition shared_data.h:71
@ ED_IND_TAGGED_COUNT
Mailbox.msg_tagged.
Definition shared_data.h:70
@ ED_IND_LIMIT_SIZE
MailboxView.vsize.
Definition shared_data.h:61
@ ED_IND_DESCRIPTION
Mailbox.name.
Definition shared_data.h:57
@ ED_IND_UNREAD_MAILBOXES
Mailbox, mutt_mailbox_check()
Definition shared_data.h:72
@ ED_MEN_PERCENTAGE
Menu.top, ...
Definition lib.h:68
@ ED_GLO_CONFIG_USE_THREADS
Value of $use_threads.
Definition uid.h:36
@ ED_GLO_CONFIG_SORT
Value of $sort.
Definition uid.h:34
@ ED_GLO_VERSION
NeoMutt version.
Definition uid.h:42
@ ED_GLO_CONFIG_SORT_AUX
Value of $sort_aux.
Definition uid.h:35
@ ED_GLO_HOSTNAME
Local hostname.
Definition uid.h:37

Callbacks for Status Expandos.

See also
StatusFormatDef, ExpandoDataGlobal, ExpandoDataIndex, ExpandoDataMenu

Definition at line 484 of file expando_status.c.

484 {
485 // clang-format off
509 { -1, -1, NULL, NULL },
510 // clang-format on
511};