NeoMutt  2025-01-09-104-g5de5ef
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Global Function API

Prototype for a Global Function. More...

+ Collaboration diagram for Global Function API:

Functions

static int op_check_stats (int op)
 Calculate message statistics for all mailboxes - Implements global_function_t -.
 
static int op_enter_command (int op)
 Enter a neomuttrc command - Implements global_function_t -.
 
static int op_redraw (int op)
 Clear and redraw the screen - Implements global_function_t -.
 
static int op_shell_escape (int op)
 Invoke a command in a subshell - Implements global_function_t -.
 
static int op_show_log_messages (int op)
 Show log (and debug) messages - Implements global_function_t -.
 
static int op_version (int op)
 Show the NeoMutt version number - Implements global_function_t -.
 
static int op_what_key (int op)
 display the keycode for a key press - Implements global_function_t -
 

Detailed Description

Prototype for a Global Function.

Parameters
opOperation to perform, e.g. OP_VERSION
Return values
enumFunctionRetval

Function Documentation

◆ op_check_stats()

static int op_check_stats ( int  op)
static

Calculate message statistics for all mailboxes - Implements global_function_t -.

Definition at line 51 of file global.c.

52{
55 return FR_SUCCESS;
56}
@ FR_SUCCESS
Valid function - successfully performed.
Definition: dispatcher.h:39
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:721
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:169
#define MUTT_MAILBOX_CHECK_STATS
Ignore mail_check_stats and calculate statistics (used by <check-stats>)
Definition: mxapi.h:52
#define MUTT_MAILBOX_CHECK_POSTPONED
Make sure the number of postponed messages is updated.
Definition: mxapi.h:51
+ Here is the call graph for this function:

◆ op_enter_command()

static int op_enter_command ( int  op)
static

Enter a neomuttrc command - Implements global_function_t -.

Definition at line 61 of file global.c.

62{
64 window_redraw(NULL);
65 return FR_SUCCESS;
66}
void mutt_enter_command(void)
Enter a neomutt command.
Definition: external.c:621
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:599
+ Here is the call graph for this function:

◆ op_redraw()

static int op_redraw ( int  op)
static

Clear and redraw the screen - Implements global_function_t -.

Definition at line 71 of file global.c.

72{
73 clearok(stdscr, true);
76 window_redraw(NULL);
77 return FR_SUCCESS;
78}
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition: resize.c:76
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:732
+ Here is the call graph for this function:

◆ op_shell_escape()

static int op_shell_escape ( int  op)
static

Invoke a command in a subshell - Implements global_function_t -.

Definition at line 83 of file global.c.

84{
86 {
87 struct Mailbox *m_cur = get_current_mailbox();
88 if (m_cur)
89 {
90 m_cur->last_checked = 0; // force a check on the next mx_mbox_check() call
92 }
93 }
94 return FR_SUCCESS;
95}
bool mutt_shell_escape(void)
Invoke a command in a subshell.
Definition: external.c:579
A mailbox.
Definition: mailbox.h:79
time_t last_checked
Last time we checked this mailbox for new mail.
Definition: mailbox.h:105
+ Here is the call graph for this function:

◆ op_show_log_messages()

static int op_show_log_messages ( int  op)
static

Show log (and debug) messages - Implements global_function_t -.

Definition at line 100 of file global.c.

101{
102 const struct LogLineList lll = log_queue_get();
103 if (STAILQ_EMPTY(&lll))
104 return FR_NO_ACTION;
105
106 struct Buffer *tempfile = buf_pool_get();
107 buf_mktemp(tempfile);
108
109 FILE *fp = mutt_file_fopen(buf_string(tempfile), "a+");
110 if (!fp)
111 {
112 mutt_perror("fopen");
113 buf_pool_release(&tempfile);
114 return FR_ERROR;
115 }
116
117 char buf[32] = { 0 };
118 struct LogLine *ll = NULL;
119 STAILQ_FOREACH(ll, &lll, entries)
120 {
121 mutt_date_localtime_format(buf, sizeof(buf), "%H:%M:%S", ll->time);
122 fprintf(fp, "[%s]<%c> %s", buf, LogLevelAbbr[ll->level + 3], ll->message);
123 if (ll->level <= LL_MESSAGE)
124 fputs("\n", fp);
125 }
126
127 mutt_file_fclose(&fp);
128
129 struct PagerData pdata = { 0 };
130 struct PagerView pview = { &pdata };
131
132 pdata.fname = buf_string(tempfile);
133
134 pview.banner = "messages";
136 pview.mode = PAGER_MODE_OTHER;
137
138 mutt_do_pager(&pview, NULL);
139 buf_pool_release(&tempfile);
140
141 return FR_SUCCESS;
142}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
@ FR_ERROR
Valid function - error occurred.
Definition: dispatcher.h:38
@ FR_NO_ACTION
Valid function - no action performed.
Definition: dispatcher.h:37
int mutt_do_pager(struct PagerView *pview, struct Email *e)
Display some page-able text to the user (help or attachment)
Definition: do_pager.c:122
#define mutt_file_fclose(FP)
Definition: file.h:139
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:138
#define mutt_perror(...)
Definition: logging2.h:94
@ LL_MESSAGE
Log informational message.
Definition: logging2.h:43
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:951
const struct LogLineList log_queue_get(void)
Get the Log Queue.
Definition: logging.c:362
const char * LogLevelAbbr
Abbreviations of logging level names.
Definition: logging.c:46
#define MUTT_PAGER_LOGS
Logview mode.
Definition: lib.h:72
#define MUTT_PAGER_BOTTOM
Start at the bottom.
Definition: lib.h:73
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:140
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:82
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:96
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:390
#define STAILQ_EMPTY(head)
Definition: queue.h:382
String manipulation buffer.
Definition: buffer.h:36
A Log line.
Definition: logging2.h:79
char * message
Message to be logged.
Definition: logging2.h:85
enum LogLevel level
Log level, e.g. LL_DEBUG1.
Definition: logging2.h:84
time_t time
Timestamp of the message.
Definition: logging2.h:80
Data to be displayed by PagerView.
Definition: lib.h:159
const char * fname
Name of the file to read.
Definition: lib.h:163
Paged view into some data.
Definition: lib.h:170
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:171
enum PagerMode mode
Pager mode.
Definition: lib.h:172
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:173
const char * banner
Title to display in status bar.
Definition: lib.h:174
#define buf_mktemp(buf)
Definition: tmp.h:33
+ Here is the call graph for this function:

◆ op_version()

static int op_version ( int  op)
static

Show the NeoMutt version number - Implements global_function_t -.

Definition at line 147 of file global.c.

148{
150 return FR_SUCCESS;
151}
#define mutt_message(...)
Definition: logging2.h:92
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:857
+ Here is the call graph for this function:

◆ op_what_key()

static int op_what_key ( int  op)
static

display the keycode for a key press - Implements global_function_t -

Definition at line 156 of file global.c.

157{
158 mw_what_key();
159 return FR_SUCCESS;
160}
void mw_what_key(void)
Display the value of a key -.
Definition: curs_lib.c:501
+ Here is the call graph for this function: