NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
command_parse.c File Reference
#include "config.h"
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.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 "mutt.h"
#include "command_parse.h"
#include "imap/lib.h"
#include "context.h"
#include "init.h"
#include "keymap.h"
#include "monitor.h"
#include "mutt_commands.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt_parse.h"
#include "muttlib.h"
#include "mx.h"
#include "myvar.h"
#include "options.h"
#include "version.h"
#include <libintl.h>
+ Include dependency graph for command_parse.c:

Go to the source code of this file.

Macros

#define MAX_ERRS   128
 

Enumerations

enum  GroupState { GS_NONE, GS_RX, GS_ADDR }
 Type of email address group. More...
 

Functions

static enum CommandResult parse_unreplace_list (struct Buffer *buf, struct Buffer *s, struct ReplaceList *list, struct Buffer *err)
 Remove a string replacement rule - Implements Command::parse() More...
 
static void attachments_clean (void)
 always wise to do what someone else did before More...
 
static enum CommandResult parse_unattach_list (struct Buffer *buf, struct Buffer *s, struct ListHead *head, struct Buffer *err)
 Parse the "unattachments" command. More...
 
static void clear_subject_mods (void)
 Clear out all modified email subjects. More...
 
static enum CommandResult parse_replace_list (struct Buffer *buf, struct Buffer *s, struct ReplaceList *list, struct Buffer *err)
 Parse a string replacement rule - Implements Command::parse() More...
 
static bool is_function (const char *name)
 Is the argument a neomutt function? More...
 
static struct AttachMatchmutt_attachmatch_new (void)
 Create a new AttachMatch. More...
 
static enum CommandResult parse_attach_list (struct Buffer *buf, struct Buffer *s, struct ListHead *head, struct Buffer *err)
 Parse the "attachments" command. More...
 
static int print_attach_list (struct ListHead *h, const char op, const char *name)
 Print a list of attachments. More...
 
static void alternates_clean (void)
 Clear the recipient valid flag of all emails. More...
 
int parse_grouplist (struct GroupList *gl, struct Buffer *buf, struct Buffer *s, struct Buffer *err)
 Parse a group context. More...
 
int source_rc (const char *rcfile_path, struct Buffer *err)
 Read an initialization file. More...
 
enum CommandResult parse_alternates (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'alternates' command - Implements Command::parse() More...
 
enum CommandResult parse_attachments (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'attachments' command - Implements Command::parse() More...
 
enum CommandResult parse_cd (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'cd' command - Implements Command::parse() More...
 
enum CommandResult parse_echo (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'echo' command - Implements Command::parse() More...
 
enum CommandResult parse_finish (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'finish' command - Implements Command::parse() More...
 
enum CommandResult parse_group (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'group' and 'ungroup' commands - Implements Command::parse() More...
 
enum CommandResult parse_ifdef (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'ifdef' and 'ifndef' commands - Implements Command::parse() More...
 
enum CommandResult parse_ignore (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'ignore' command - Implements Command::parse() More...
 
enum CommandResult parse_lists (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'lists' command - Implements Command::parse() More...
 
enum CommandResult parse_mailboxes (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'mailboxes' command - Implements Command::parse() More...
 
enum CommandResult parse_my_hdr (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'my_hdr' command - Implements Command::parse() More...
 
enum CommandResult parse_set (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'set' family of commands - Implements Command::parse() More...
 
enum CommandResult parse_setenv (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'setenv' and 'unsetenv' commands - Implements Command::parse() More...
 
enum CommandResult parse_source (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'source' command - Implements Command::parse() More...
 
enum CommandResult parse_spam_list (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'spam' and 'nospam' commands - Implements Command::parse() More...
 
enum CommandResult parse_stailq (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse a list command - Implements Command::parse() More...
 
enum CommandResult parse_subjectrx_list (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'subjectrx' command - Implements Command::parse() More...
 
enum CommandResult parse_subscribe (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'subscribe' command - Implements Command::parse() More...
 
enum CommandResult parse_subscribe_to (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'subscribe-to' command - Implements Command::parse() More...
 
enum CommandResult parse_tag_formats (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'tag-formats' command - Implements Command::parse() More...
 
enum CommandResult parse_tag_transforms (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'tag-transforms' command - Implements Command::parse() More...
 
enum CommandResult parse_unalternates (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unalternates' command - Implements Command::parse() More...
 
enum CommandResult parse_unattachments (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unattachments' command - Implements Command::parse() More...
 
enum CommandResult parse_unignore (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unignore' command - Implements Command::parse() More...
 
enum CommandResult parse_unlists (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unlists' command - Implements Command::parse() More...
 
static void do_unmailboxes (struct Mailbox *m)
 Remove a Mailbox from the Sidebar/notifications. More...
 
static void do_unmailboxes_star (void)
 Remove all Mailboxes from the Sidebar/notifications. More...
 
enum CommandResult parse_unmailboxes (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unmailboxes' command - Implements Command::parse() More...
 
enum CommandResult parse_unmy_hdr (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unmy_hdr' command - Implements Command::parse() More...
 
enum CommandResult parse_unstailq (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse an unlist command - Implements Command::parse() More...
 
enum CommandResult parse_unsubjectrx_list (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unsubjectrx' command - Implements Command::parse() More...
 
enum CommandResult parse_unsubscribe (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unsubscribe' command - Implements Command::parse() More...
 
enum CommandResult parse_unsubscribe_from (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'unsubscribe-from' command - Implements Command::parse() More...
 
void clear_source_stack (void)
 Free memory from the stack used for the souce command. More...
 

Variables

static struct ListHead MuttrcStack = STAILQ_HEAD_INITIALIZER(MuttrcStack)
 

Detailed Description

Functions to parse commands in a config file

Authors
  • Michael R. Elkins
  • g10 Code GmbH
  • R Primus

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

Macro Definition Documentation

◆ MAX_ERRS

#define MAX_ERRS   128

Definition at line 70 of file command_parse.c.

Enumeration Type Documentation

◆ GroupState

enum GroupState

Type of email address group.

Enumerator
GS_NONE 

Group is missing an argument.

GS_RX 

Entry is a regular expression.

GS_ADDR 

Entry is an address.

Definition at line 75 of file command_parse.c.

76 {
77  GS_NONE,
78  GS_RX,
79  GS_ADDR,
80 };

Function Documentation

◆ parse_unreplace_list()

static enum CommandResult parse_unreplace_list ( struct Buffer buf,
struct Buffer s,
struct ReplaceList *  list,
struct Buffer err 
)
static

Remove a string replacement rule - Implements Command::parse()

Definition at line 85 of file command_parse.c.

87 {
88  /* First token is a regex. */
89  if (!MoreArgs(s))
90  {
91  mutt_buffer_printf(err, _("%s: too few arguments"), "unsubjectrx");
92  return MUTT_CMD_WARNING;
93  }
94 
96 
97  /* "*" is a special case. */
98  if (mutt_str_equal(buf->data, "*"))
99  {
100  mutt_replacelist_free(list);
101  return MUTT_CMD_SUCCESS;
102  }
103 
104  mutt_replacelist_remove(list, buf->data);
105  return MUTT_CMD_SUCCESS;
106 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attachments_clean()

static void attachments_clean ( void  )
static

always wise to do what someone else did before

Definition at line 111 of file command_parse.c.

112 {
113  struct Mailbox *m = ctx_mailbox(Context);
114  if (!m)
115  return;
116 
117  for (int i = 0; i < m->msg_count; i++)
118  {
119  struct Email *e = m->emails[i];
120  if (!e)
121  break;
122  e->attach_valid = false;
123  }
124 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_unattach_list()

static enum CommandResult parse_unattach_list ( struct Buffer buf,
struct Buffer s,
struct ListHead *  head,
struct Buffer err 
)
static

Parse the "unattachments" command.

Parameters
bufBuffer for temporary storage
sBuffer containing the unattachments command
headList of AttachMatch to remove from
errBuffer for error messages
Return values
MUTT_CMD_SUCCESSAlways

Definition at line 134 of file command_parse.c.

136 {
137  struct AttachMatch *a = NULL;
138  char *tmp = NULL;
139  char *minor = NULL;
140 
141  do
142  {
144  FREE(&tmp);
145 
146  if (mutt_istr_equal(buf->data, "any"))
147  tmp = mutt_str_dup("*/.*");
148  else if (mutt_istr_equal(buf->data, "none"))
149  tmp = mutt_str_dup("cheap_hack/this_should_never_match");
150  else
151  tmp = mutt_str_dup(buf->data);
152 
153  minor = strchr(tmp, '/');
154  if (minor)
155  {
156  *minor = '\0';
157  minor++;
158  }
159  else
160  {
161  minor = "unknown";
162  }
163  const enum ContentType major = mutt_check_mime_type(tmp);
164 
165  struct ListNode *np = NULL, *tmp2 = NULL;
166  STAILQ_FOREACH_SAFE(np, head, entries, tmp2)
167  {
168  a = (struct AttachMatch *) np->data;
169  mutt_debug(LL_DEBUG3, "check %s/%s [%d] : %s/%s [%d]\n", a->major,
170  a->minor, a->major_int, tmp, minor, major);
171  if ((a->major_int == major) && mutt_istr_equal(minor, a->minor))
172  {
173  mutt_debug(LL_DEBUG3, "removed %s/%s [%d]\n", a->major, a->minor, a->major_int);
174  regfree(&a->minor_regex);
175  FREE(&a->major);
176  STAILQ_REMOVE(head, np, ListNode, entries);
177  FREE(&np->data);
178  FREE(&np);
179  }
180  }
181 
182  } while (MoreArgs(s));
183 
184  FREE(&tmp);
186  return MUTT_CMD_SUCCESS;
187 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clear_subject_mods()

static void clear_subject_mods ( void  )
static

Clear out all modified email subjects.

Definition at line 192 of file command_parse.c.

193 {
194  struct Mailbox *m = ctx_mailbox(Context);
195  if (!m)
196  return;
197 
198  for (int i = 0; i < m->msg_count; i++)
199  {
200  struct Email *e = m->emails[i];
201  if (!e || !e->env)
202  continue;
203  FREE(&e->env->disp_subj);
204  }
205 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_replace_list()

static enum CommandResult parse_replace_list ( struct Buffer buf,
struct Buffer s,
struct ReplaceList *  list,
struct Buffer err 
)
static

Parse a string replacement rule - Implements Command::parse()

Definition at line 210 of file command_parse.c.

212 {
213  struct Buffer templ = mutt_buffer_make(0);
214 
215  /* First token is a regex. */
216  if (!MoreArgs(s))
217  {
218  mutt_buffer_printf(err, _("%s: too few arguments"), "subjectrx");
219  return MUTT_CMD_WARNING;
220  }
222 
223  /* Second token is a replacement template */
224  if (!MoreArgs(s))
225  {
226  mutt_buffer_printf(err, _("%s: too few arguments"), "subjectrx");
227  return MUTT_CMD_WARNING;
228  }
230 
231  if (mutt_replacelist_add(list, buf->data, templ.data, err) != 0)
232  {
233  FREE(&templ.data);
234  return MUTT_CMD_ERROR;
235  }
236  FREE(&templ.data);
237 
238  return MUTT_CMD_SUCCESS;
239 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_function()

static bool is_function ( const char *  name)
static

Is the argument a neomutt function?

Parameters
nameCommand name to be searched for
Return values
trueFunction found
falseFunction not found

Definition at line 247 of file command_parse.c.

248 {
249  for (enum MenuType i = 0; i < MENU_MAX; i++)
250  {
251  const struct Binding *b = km_get_table(Menus[i].value);
252  if (!b)
253  continue;
254 
255  for (int j = 0; b[j].name; j++)
256  if (mutt_str_equal(name, b[j].name))
257  return true;
258  }
259  return false;
260 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_attachmatch_new()

static struct AttachMatch* mutt_attachmatch_new ( void  )
static

Create a new AttachMatch.

Return values
ptrNew AttachMatch

Definition at line 266 of file command_parse.c.

267 {
268  return mutt_mem_calloc(1, sizeof(struct AttachMatch));
269 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_attach_list()

static enum CommandResult parse_attach_list ( struct Buffer buf,
struct Buffer s,
struct ListHead *  head,
struct Buffer err 
)
static

Parse the "attachments" command.

Parameters
bufBuffer for temporary storage
sBuffer containing the attachments command
headList of AttachMatch to add to
errBuffer for error messages
Return values
CommandResultResult e.g. MUTT_CMD_SUCCESS

Definition at line 279 of file command_parse.c.

281 {
282  struct AttachMatch *a = NULL;
283  char *p = NULL;
284  char *tmpminor = NULL;
285  size_t len;
286  int ret;
287 
288  do
289  {
291 
292  if (!buf->data || (*buf->data == '\0'))
293  continue;
294 
295  a = mutt_attachmatch_new();
296 
297  /* some cheap hacks that I expect to remove */
298  if (mutt_istr_equal(buf->data, "any"))
299  a->major = mutt_str_dup("*/.*");
300  else if (mutt_istr_equal(buf->data, "none"))
301  a->major = mutt_str_dup("cheap_hack/this_should_never_match");
302  else
303  a->major = mutt_str_dup(buf->data);
304 
305  p = strchr(a->major, '/');
306  if (p)
307  {
308  *p = '\0';
309  p++;
310  a->minor = p;
311  }
312  else
313  {
314  a->minor = "unknown";
315  }
316 
317  len = strlen(a->minor);
318  tmpminor = mutt_mem_malloc(len + 3);
319  strcpy(&tmpminor[1], a->minor);
320  tmpminor[0] = '^';
321  tmpminor[len + 1] = '$';
322  tmpminor[len + 2] = '\0';
323 
325  ret = REG_COMP(&a->minor_regex, tmpminor, REG_ICASE);
326 
327  FREE(&tmpminor);
328 
329  if (ret != 0)
330  {
331  regerror(ret, &a->minor_regex, err->data, err->dsize);
332  FREE(&a->major);
333  FREE(&a);
334  return MUTT_CMD_ERROR;
335  }
336 
337  mutt_debug(LL_DEBUG3, "added %s/%s [%d]\n", a->major, a->minor, a->major_int);
338 
339  mutt_list_insert_tail(head, (char *) a);
340  } while (MoreArgs(s));
341 
343  return MUTT_CMD_SUCCESS;
344 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_attach_list()

static int print_attach_list ( struct ListHead *  h,
const char  op,
const char *  name 
)
static

Print a list of attachments.

Parameters
hList of attachments
opOperation, e.g. '+', '-'
nameAttached/Inline, 'A', 'I'
Return values
0Always

Definition at line 353 of file command_parse.c.

354 {
355  struct ListNode *np = NULL;
356  STAILQ_FOREACH(np, h, entries)
357  {
358  printf("attachments %c%s %s/%s\n", op, name,
359  ((struct AttachMatch *) np->data)->major,
360  ((struct AttachMatch *) np->data)->minor);
361  }
362 
363  return 0;
364 }
+ Here is the caller graph for this function:

◆ alternates_clean()

static void alternates_clean ( void  )
static

Clear the recipient valid flag of all emails.

Definition at line 369 of file command_parse.c.

370 {
371  struct Mailbox *m = ctx_mailbox(Context);
372  if (!m)
373  return;
374 
375  for (int i = 0; i < m->msg_count; i++)
376  {
377  struct Email *e = m->emails[i];
378  if (!e)
379  break;
380  e->recip_valid = false;
381  }
382 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_grouplist()

int parse_grouplist ( struct GroupList *  gl,
struct Buffer buf,
struct Buffer s,
struct Buffer err 
)

Parse a group context.

Parameters
glGroupList to add to
bufTemporary Buffer space
sBuffer containing string to be parsed
errBuffer for error messages
Return values
0Success
-1Error

Definition at line 393 of file command_parse.c.

395 {
396  while (mutt_istr_equal(buf->data, "-group"))
397  {
398  if (!MoreArgs(s))
399  {
400  mutt_buffer_strcpy(err, _("-group: no group name"));
401  return -1;
402  }
403 
405 
407 
408  if (!MoreArgs(s))
409  {
410  mutt_buffer_strcpy(err, _("out of arguments"));
411  return -1;
412  }
413 
415  }
416 
417  return 0;
418 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ source_rc()

int source_rc ( const char *  rcfile_path,
struct Buffer err 
)

Read an initialization file.

Parameters
rcfile_pathPath to initialization file
errBuffer for error messages
Return values
<0if neomutt should pause to let the user know

Definition at line 426 of file command_parse.c.

427 {
428  int lineno = 0, rc = 0, warnings = 0;
429  enum CommandResult line_rc;
430  struct Buffer *token = NULL, *linebuf = NULL;
431  char *line = NULL;
432  char *currentline = NULL;
433  char rcfile[PATH_MAX];
434  size_t linelen = 0;
435  pid_t pid;
436 
437  mutt_str_copy(rcfile, rcfile_path, sizeof(rcfile));
438 
439  size_t rcfilelen = mutt_str_len(rcfile);
440  if (rcfilelen == 0)
441  return -1;
442 
443  bool ispipe = rcfile[rcfilelen - 1] == '|';
444 
445  if (!ispipe)
446  {
447  struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
448  if (!mutt_path_to_absolute(rcfile, np ? NONULL(np->data) : ""))
449  {
450  mutt_error(_("Error: Can't build path of '%s'"), rcfile_path);
451  return -1;
452  }
453 
454  STAILQ_FOREACH(np, &MuttrcStack, entries)
455  {
456  if (mutt_str_equal(np->data, rcfile))
457  {
458  break;
459  }
460  }
461  if (np)
462  {
463  mutt_error(_("Error: Cyclic sourcing of configuration file '%s'"), rcfile);
464  return -1;
465  }
466 
468  }
469 
470  mutt_debug(LL_DEBUG2, "Reading configuration file '%s'\n", rcfile);
471 
472  FILE *fp = mutt_open_read(rcfile, &pid);
473  if (!fp)
474  {
475  mutt_buffer_printf(err, "%s: %s", rcfile, strerror(errno));
476  return -1;
477  }
478 
479  token = mutt_buffer_pool_get();
480  linebuf = mutt_buffer_pool_get();
481 
482  while ((line = mutt_file_read_line(line, &linelen, fp, &lineno, MUTT_RL_CONT)) != NULL)
483  {
484  const bool conv = C_ConfigCharset && C_Charset;
485  if (conv)
486  {
487  currentline = mutt_str_dup(line);
488  if (!currentline)
489  continue;
491  }
492  else
493  currentline = line;
494 
495  mutt_buffer_strcpy(linebuf, currentline);
496 
497  mutt_buffer_reset(err);
498  line_rc = mutt_parse_rc_buffer(linebuf, token, err);
499  if (line_rc == MUTT_CMD_ERROR)
500  {
501  mutt_error(_("Error in %s, line %d: %s"), rcfile, lineno, err->data);
502  if (--rc < -MAX_ERRS)
503  {
504  if (conv)
505  FREE(&currentline);
506  break;
507  }
508  }
509  else if (line_rc == MUTT_CMD_WARNING)
510  {
511  /* Warning */
512  mutt_warning(_("Warning in %s, line %d: %s"), rcfile, lineno, err->data);
513  warnings++;
514  }
515  else if (line_rc == MUTT_CMD_FINISH)
516  {
517  break; /* Found "finish" command */
518  }
519  else
520  {
521  if (rc < 0)
522  rc = -1;
523  }
524  if (conv)
525  FREE(&currentline);
526  }
527 
528  FREE(&line);
529  mutt_file_fclose(&fp);
530  if (pid != -1)
531  filter_wait(pid);
532 
533  if (rc)
534  {
535  /* the neomuttrc source keyword */
536  mutt_buffer_reset(err);
537  mutt_buffer_printf(err, (rc >= -MAX_ERRS) ? _("source: errors in %s") : _("source: reading aborted due to too many errors in %s"),
538  rcfile);
539  rc = -1;
540  }
541  else
542  {
543  /* Don't alias errors with warnings */
544  if (warnings > 0)
545  {
546  mutt_buffer_printf(err, ngettext("source: %d warning in %s", "source: %d warnings in %s", warnings),
547  warnings, rcfile);
548  rc = -2;
549  }
550  }
551 
552  if (!ispipe && !STAILQ_EMPTY(&MuttrcStack))
553  {
554  struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
555  STAILQ_REMOVE_HEAD(&MuttrcStack, entries);
556  FREE(&np->data);
557  FREE(&np);
558  }
559 
560  mutt_buffer_pool_release(&token);
561  mutt_buffer_pool_release(&linebuf);
562  return rc;
563 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_alternates()

enum CommandResult parse_alternates ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'alternates' command - Implements Command::parse()

Definition at line 568 of file command_parse.c.

570 {
571  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
572 
574 
575  do
576  {
578 
579  if (parse_grouplist(&gl, buf, s, err) == -1)
580  goto bail;
581 
582  mutt_regexlist_remove(&UnAlternates, buf->data);
583 
584  if (mutt_regexlist_add(&Alternates, buf->data, REG_ICASE, err) != 0)
585  goto bail;
586 
587  if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
588  goto bail;
589  } while (MoreArgs(s));
590 
592  return MUTT_CMD_SUCCESS;
593 
594 bail:
596  return MUTT_CMD_ERROR;
597 }
+ Here is the call graph for this function:

◆ parse_attachments()

enum CommandResult parse_attachments ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'attachments' command - Implements Command::parse()

Definition at line 602 of file command_parse.c.

604 {
605  char op;
606  char *category = NULL;
607  struct ListHead *head = NULL;
608 
610  if (!buf->data || (*buf->data == '\0'))
611  {
612  mutt_buffer_strcpy(err, _("attachments: no disposition"));
613  return MUTT_CMD_WARNING;
614  }
615 
616  category = buf->data;
617  op = *category++;
618 
619  if (op == '?')
620  {
621  mutt_endwin();
622  fflush(stdout);
623  printf("\n%s\n\n", _("Current attachments settings:"));
624  print_attach_list(&AttachAllow, '+', "A");
625  print_attach_list(&AttachExclude, '-', "A");
626  print_attach_list(&InlineAllow, '+', "I");
627  print_attach_list(&InlineExclude, '-', "I");
629  return MUTT_CMD_SUCCESS;
630  }
631 
632  if ((op != '+') && (op != '-'))
633  {
634  op = '+';
635  category--;
636  }
637  if (mutt_istr_startswith("attachment", category))
638  {
639  if (op == '+')
640  head = &AttachAllow;
641  else
642  head = &AttachExclude;
643  }
644  else if (mutt_istr_startswith("inline", category))
645  {
646  if (op == '+')
647  head = &InlineAllow;
648  else
649  head = &InlineExclude;
650  }
651  else
652  {
653  mutt_buffer_strcpy(err, _("attachments: invalid disposition"));
654  return MUTT_CMD_ERROR;
655  }
656 
657  return parse_attach_list(buf, s, head, err);
658 }
+ Here is the call graph for this function:

◆ parse_cd()

enum CommandResult parse_cd ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'cd' command - Implements Command::parse()

Definition at line 663 of file command_parse.c.

665 {
668  if (mutt_buffer_len(buf) == 0)
669  {
670  if (HomeDir)
672  else
673  {
674  mutt_buffer_printf(err, _("%s: too few arguments"), "cd");
675  return MUTT_CMD_ERROR;
676  }
677  }
678 
679  if (chdir(mutt_buffer_string(buf)) != 0)
680  {
681  mutt_buffer_printf(err, "cd: %s", strerror(errno));
682  return MUTT_CMD_ERROR;
683  }
684 
685  return MUTT_CMD_SUCCESS;
686 }
+ Here is the call graph for this function:

◆ parse_echo()

enum CommandResult parse_echo ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'echo' command - Implements Command::parse()

Definition at line 691 of file command_parse.c.

693 {
694  if (!MoreArgs(s))
695  {
696  mutt_buffer_printf(err, _("%s: too few arguments"), "echo");
697  return MUTT_CMD_WARNING;
698  }
700  OptForceRefresh = true;
701  mutt_message("%s", buf->data);
702  OptForceRefresh = false;
703  mutt_sleep(0);
704 
705  return MUTT_CMD_SUCCESS;
706 }
+ Here is the call graph for this function:

◆ parse_finish()

enum CommandResult parse_finish ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'finish' command - Implements Command::parse()

Return values
MUTT_CMD_FINISHStop processing the current file
MUTT_CMD_WARNINGFailed

If the 'finish' command is found, we should stop reading the current file.

Definition at line 715 of file command_parse.c.

717 {
718  if (MoreArgs(s))
719  {
720  mutt_buffer_printf(err, _("%s: too many arguments"), "finish");
721  return MUTT_CMD_WARNING;
722  }
723 
724  return MUTT_CMD_FINISH;
725 }
+ Here is the call graph for this function:

◆ parse_group()

enum CommandResult parse_group ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'group' and 'ungroup' commands - Implements Command::parse()

Definition at line 730 of file command_parse.c.

732 {
733  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
734  enum GroupState state = GS_NONE;
735 
736  do
737  {
739  if (parse_grouplist(&gl, buf, s, err) == -1)
740  goto bail;
741 
742  if ((data == MUTT_UNGROUP) && mutt_istr_equal(buf->data, "*"))
743  {
745  goto out;
746  }
747 
748  if (mutt_istr_equal(buf->data, "-rx"))
749  state = GS_RX;
750  else if (mutt_istr_equal(buf->data, "-addr"))
751  state = GS_ADDR;
752  else
753  {
754  switch (state)
755  {
756  case GS_NONE:
757  mutt_buffer_printf(err, _("%sgroup: missing -rx or -addr"),
758  (data == MUTT_UNGROUP) ? "un" : "");
759  goto warn;
760 
761  case GS_RX:
762  if ((data == MUTT_GROUP) &&
763  (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0))
764  {
765  goto bail;
766  }
767  else if ((data == MUTT_UNGROUP) &&
768  (mutt_grouplist_remove_regex(&gl, buf->data) < 0))
769  {
770  goto bail;
771  }
772  break;
773 
774  case GS_ADDR:
775  {
776  char *estr = NULL;
777  struct AddressList al = TAILQ_HEAD_INITIALIZER(al);
778  mutt_addrlist_parse2(&al, buf->data);
779  if (TAILQ_EMPTY(&al))
780  goto bail;
781  if (mutt_addrlist_to_intl(&al, &estr))
782  {
783  mutt_buffer_printf(err, _("%sgroup: warning: bad IDN '%s'"),
784  (data == 1) ? "un" : "", estr);
785  mutt_addrlist_clear(&al);
786  FREE(&estr);
787  goto bail;
788  }
789  if (data == MUTT_GROUP)
790  mutt_grouplist_add_addrlist(&gl, &al);
791  else if (data == MUTT_UNGROUP)
793  mutt_addrlist_clear(&al);
794  break;
795  }
796  }
797  }
798  } while (MoreArgs(s));
799 
800 out:
802  return MUTT_CMD_SUCCESS;
803 
804 bail:
806  return MUTT_CMD_ERROR;
807 
808 warn:
810  return MUTT_CMD_WARNING;
811 }
+ Here is the call graph for this function:

◆ parse_ifdef()

enum CommandResult parse_ifdef ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'ifdef' and 'ifndef' commands - Implements Command::parse()

The 'ifdef' command allows conditional elements in the config file. If a given variable, function, command or compile-time symbol exists, then read the rest of the line of config commands. e.g. ifdef sidebar source ~/.neomutt/sidebar.rc

If (data == 1) then it means use the 'ifndef' (if-not-defined) command. e.g. ifndef imap finish

Definition at line 826 of file command_parse.c.

828 {
830 
831  // is the item defined as:
832  bool res = cs_subset_lookup(NeoMutt->sub, buf->data) // a variable?
833  || feature_enabled(buf->data) // a compiled-in feature?
834  || is_function(buf->data) // a function?
835  || mutt_command_get(buf->data) // a command?
836  || myvar_get(buf->data) // a my_ variable?
837  || mutt_str_getenv(buf->data); // an environment variable?
838 
839  if (!MoreArgs(s))
840  {
841  mutt_buffer_printf(err, _("%s: too few arguments"), (data ? "ifndef" : "ifdef"));
842  return MUTT_CMD_WARNING;
843  }
845 
846  /* ifdef KNOWN_SYMBOL or ifndef UNKNOWN_SYMBOL */
847  if ((res && (data == 0)) || (!res && (data == 1)))
848  {
849  enum CommandResult rc = mutt_parse_rc_line(buf->data, err);
850  if (rc == MUTT_CMD_ERROR)
851  {
852  mutt_error(_("Error: %s"), err->data);
853  return MUTT_CMD_ERROR;
854  }
855  return rc;
856  }
857  return MUTT_CMD_SUCCESS;
858 }
+ Here is the call graph for this function:

◆ parse_ignore()

enum CommandResult parse_ignore ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'ignore' command - Implements Command::parse()

Definition at line 863 of file command_parse.c.

865 {
866  do
867  {
870  add_to_stailq(&Ignore, buf->data);
871  } while (MoreArgs(s));
872 
873  return MUTT_CMD_SUCCESS;
874 }
+ Here is the call graph for this function:

◆ parse_lists()

enum CommandResult parse_lists ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'lists' command - Implements Command::parse()

Definition at line 879 of file command_parse.c.

881 {
882  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
883 
884  do
885  {
887 
888  if (parse_grouplist(&gl, buf, s, err) == -1)
889  goto bail;
890 
892 
893  if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
894  goto bail;
895 
896  if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
897  goto bail;
898  } while (MoreArgs(s));
899 
901  return MUTT_CMD_SUCCESS;
902 
903 bail:
905  return MUTT_CMD_ERROR;
906 }
+ Here is the call graph for this function:

◆ parse_mailboxes()

enum CommandResult parse_mailboxes ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'mailboxes' command - Implements Command::parse()

This is also used by 'virtual-mailboxes'.

Definition at line 913 of file command_parse.c.

915 {
916  while (MoreArgs(s))
917  {
918  struct Mailbox *m = mailbox_new();
919 
920  if (data & MUTT_NAMED)
921  {
922  // This may be empty, e.g. `named-mailboxes "" +inbox`
924  m->name = mutt_buffer_strdup(buf);
925  }
926 
928  if (mutt_buffer_is_empty(buf))
929  {
930  /* Skip empty tokens. */
931  mailbox_free(&m);
932  continue;
933  }
934 
935  mutt_buffer_strcpy(&m->pathbuf, buf->data);
936  /* int rc = */ mx_path_canon2(m, C_Folder);
937 
938  if (m->type <= MUTT_UNKNOWN)
939  {
940  mutt_error("Unknown Mailbox: %s", m->realpath);
941  mailbox_free(&m);
942  return MUTT_CMD_ERROR;
943  }
944 
945  bool new_account = false;
946  struct Account *a = mx_ac_find(m);
947  if (!a)
948  {
949  a = account_new(NULL, NeoMutt->sub);
950  a->type = m->type;
951  new_account = true;
952  }
953 
954  if (!new_account)
955  {
956  struct Mailbox *m_old = mx_mbox_find(a, m->realpath);
957  if (m_old)
958  {
959  const bool show = (m_old->flags == MB_HIDDEN);
960  if (show)
961  {
962  m_old->flags = MB_NORMAL;
963  m_old->gen = mailbox_gen();
964  }
965 
966  const bool rename = (data & MUTT_NAMED) && !mutt_str_equal(m_old->name, m->name);
967  if (rename)
968  {
969  mutt_str_replace(&m_old->name, m->name);
970  }
971 
972  mailbox_free(&m);
973  continue;
974  }
975  }
976 
977  if (!mx_ac_add(a, m))
978  {
979  //error
980  mailbox_free(&m);
981  if (new_account)
982  {
983  cs_subset_free(&a->sub);
984  FREE(&a->name);
985  notify_free(&a->notify);
986  FREE(&a);
987  }
988  continue;
989  }
990  if (new_account)
991  {
993  }
994 
995 #ifdef USE_INOTIFY
996  mutt_monitor_add(m);
997 #endif
998  }
999  return MUTT_CMD_SUCCESS;
1000 }
+ Here is the call graph for this function:

◆ parse_my_hdr()

enum CommandResult parse_my_hdr ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'my_hdr' command - Implements Command::parse()

Definition at line 1005 of file command_parse.c.

1007 {
1009  char *p = strpbrk(buf->data, ": \t");
1010  if (!p || (*p != ':'))
1011  {
1012  mutt_buffer_strcpy(err, _("invalid header field"));
1013  return MUTT_CMD_WARNING;
1014  }
1015 
1016  struct EventHeader event = { buf->data };
1017  struct ListNode *n = header_find(&UserHeader, buf->data);
1018 
1019  if (n)
1020  {
1021  header_update(n, buf->data);
1023  }
1024  else
1025  {
1026  header_add(&UserHeader, buf->data);
1028  }
1029 
1030  return MUTT_CMD_SUCCESS;
1031 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_set()

enum CommandResult parse_set ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'set' family of commands - Implements Command::parse()

This is used by 'reset', 'set', 'toggle' and 'unset'.

Definition at line 1038 of file command_parse.c.

1040 {
1041  /* The order must match `enum MuttSetCommand` */
1042  static const char *set_commands[] = { "set", "toggle", "unset", "reset" };
1043 
1044  int rc = 0;
1045 
1046  while (MoreArgs(s))
1047  {
1048  bool prefix = false;
1049  bool query = false;
1050  bool inv = (data == MUTT_SET_INV);
1051  bool reset = (data == MUTT_SET_RESET);
1052  bool unset = (data == MUTT_SET_UNSET);
1053 
1054  if (*s->dptr == '?')
1055  {
1056  prefix = true;
1057  query = true;
1058  s->dptr++;
1059  }
1060  else if (mutt_str_startswith(s->dptr, "no"))
1061  {
1062  prefix = true;
1063  unset = !unset;
1064  s->dptr += 2;
1065  }
1066  else if (mutt_str_startswith(s->dptr, "inv"))
1067  {
1068  prefix = true;
1069  inv = !inv;
1070  s->dptr += 3;
1071  }
1072  else if (*s->dptr == '&')
1073  {
1074  prefix = true;
1075  reset = true;
1076  s->dptr++;
1077  }
1078 
1079  if (prefix && (data != MUTT_SET_SET))
1080  {
1081  mutt_buffer_printf(err, _("Can't use 'inv', 'no', '&' or '?' with the '%s' command"),
1082  set_commands[data]);
1083  return MUTT_CMD_WARNING;
1084  }
1085 
1086  /* get the variable name */
1088 
1089  bool bq = false;
1090  bool equals = false;
1091  bool increment = false;
1092  bool decrement = false;
1093 
1094  struct HashElem *he = NULL;
1095  bool my = mutt_str_startswith(buf->data, "my_");
1096  if (!my)
1097  {
1098  he = cs_subset_lookup(NeoMutt->sub, buf->data);
1099  if (!he)
1100  {
1101  if (reset && mutt_str_equal(buf->data, "all"))
1102  {
1103  struct HashElem **list = get_elem_list(NeoMutt->sub->cs);
1104  if (!list)
1105  return MUTT_CMD_ERROR;
1106 
1107  for (size_t i = 0; list[i]; i++)
1108  cs_subset_he_reset(NeoMutt->sub, list[i], NULL);
1109 
1110  FREE(&list);
1111  break;
1112  }
1113  else
1114  {
1115  mutt_buffer_printf(err, _("%s: unknown variable"), buf->data);
1116  return MUTT_CMD_ERROR;
1117  }
1118  }
1119 
1120  bq = ((DTYPE(he->type) == DT_BOOL) || (DTYPE(he->type) == DT_QUAD));
1121  }
1122 
1123  if (*s->dptr == '?')
1124  {
1125  if (prefix)
1126  {
1127  mutt_buffer_printf(err,
1128  _("Can't use a prefix when querying a variable"));
1129  return MUTT_CMD_WARNING;
1130  }
1131 
1132  if (reset || unset || inv)
1133  {
1134  mutt_buffer_printf(err, _("Can't query a variable with the '%s' command"),
1135  set_commands[data]);
1136  return MUTT_CMD_WARNING;
1137  }
1138 
1139  query = true;
1140  s->dptr++;
1141  }
1142  else if (*s->dptr == '+' || *s->dptr == '-')
1143  {
1144  if (prefix)
1145  {
1147  err,
1148  _("Can't use prefix when incrementing or decrementing a variable"));
1149  return MUTT_CMD_WARNING;
1150  }
1151 
1152  if (reset || unset || inv)
1153  {
1154  mutt_buffer_printf(err, _("Can't set a variable with the '%s' command"),
1155  set_commands[data]);
1156  return MUTT_CMD_WARNING;
1157  }
1158  if (*s->dptr == '+')
1159  increment = true;
1160  else
1161  decrement = true;
1162 
1163  s->dptr++;
1164  if (*s->dptr == '=')
1165  {
1166  equals = true;
1167  s->dptr++;
1168  }
1169  }
1170  else if (*s->dptr == '=')
1171  {
1172  if (prefix)
1173  {
1174  mutt_buffer_printf(err, _("Can't use prefix when setting a variable"));
1175  return MUTT_CMD_WARNING;
1176  }
1177 
1178  if (reset || unset || inv)
1179  {
1180  mutt_buffer_printf(err, _("Can't set a variable with the '%s' command"),
1181  set_commands[data]);
1182  return MUTT_CMD_WARNING;
1183  }
1184 
1185  equals = true;
1186  s->dptr++;
1187  }
1188 
1189  if (!bq && (inv || (unset && prefix)))
1190  {
1191  if (data == MUTT_SET_SET)
1192  {
1193  mutt_buffer_printf(err, _("Prefixes 'no' and 'inv' may only be used "
1194  "with bool/quad variables"));
1195  }
1196  else
1197  {
1198  mutt_buffer_printf(err, _("Command '%s' can only be used with bool/quad variables"),
1199  set_commands[data]);
1200  }
1201  return MUTT_CMD_WARNING;
1202  }
1203 
1204  if (reset)
1205  {
1206  // mutt_buffer_printf(err, "ACT24 reset variable %s", buf->data);
1207  if (he)
1208  {
1209  rc = cs_subset_he_reset(NeoMutt->sub, he, err);
1210  if (CSR_RESULT(rc) != CSR_SUCCESS)
1211  return MUTT_CMD_ERROR;
1212  }
1213  else
1214  {
1215  myvar_del(buf->data);
1216  }
1217  continue;
1218  }
1219 
1220  if ((data == MUTT_SET_SET) && !inv && !unset)
1221  {
1222  if (query)
1223  {
1224  // mutt_buffer_printf(err, "ACT08 query variable %s", buf->data);
1225  if (he)
1226  {
1227  mutt_buffer_addstr(err, buf->data);
1228  mutt_buffer_addch(err, '=');
1229  mutt_buffer_reset(buf);
1230  rc = cs_subset_he_string_get(NeoMutt->sub, he, buf);
1231  if (CSR_RESULT(rc) != CSR_SUCCESS)
1232  {
1233  mutt_buffer_addstr(err, buf->data);
1234  return MUTT_CMD_ERROR;
1235  }
1236  if (DTYPE(he->type) == DT_PATH)
1237  mutt_pretty_mailbox(buf->data, buf->dsize);
1238  pretty_var(buf->data, err);
1239  }
1240  else
1241  {
1242  const char *val = myvar_get(buf->data);
1243  if (val)
1244  {
1245  mutt_buffer_addstr(err, buf->data);
1246  mutt_buffer_addch(err, '=');
1247  pretty_var(val, err);
1248  }
1249  else
1250  {
1251  mutt_buffer_printf(err, _("%s: unknown variable"), buf->data);
1252  return MUTT_CMD_ERROR;
1253  }
1254  }
1255  break;
1256  }
1257  else if (equals)
1258  {
1259  // mutt_buffer_printf(err, "ACT11 set variable %s to ", buf->data);
1260  const char *name = NULL;
1261  if (my)
1262  {
1263  name = mutt_str_dup(buf->data);
1264  }
1266  if (my)
1267  {
1268  myvar_set(name, buf->data);
1269  FREE(&name);
1270  }
1271  else
1272  {
1273  if (DTYPE(he->type) == DT_PATH)
1274  {
1275  if (he->type & (DT_PATH_DIR | DT_PATH_FILE))
1277  else
1278  mutt_path_tilde(buf->data, buf->dsize, HomeDir);
1279  }
1280  else if (IS_MAILBOX(he))
1281  {
1283  }
1284  else if (IS_COMMAND(he))
1285  {
1286  struct Buffer scratch = mutt_buffer_make(1024);
1287  mutt_buffer_copy(&scratch, buf);
1288 
1289  if (!mutt_str_equal(buf->data, "builtin"))
1290  {
1291  mutt_buffer_expand_path(&scratch);
1292  }
1293  mutt_buffer_reset(buf);
1294  mutt_buffer_addstr(buf, mutt_buffer_string(&scratch));
1295  mutt_buffer_dealloc(&scratch);
1296  }
1297  if (increment)
1298  {
1299  rc = cs_subset_he_string_plus_equals(NeoMutt->sub, he, buf->data, err);
1300  }
1301  else if (decrement)
1302  {
1303  rc = cs_subset_he_string_minus_equals(NeoMutt->sub, he, buf->data, err);
1304  }
1305  else
1306  {
1307  rc = cs_subset_he_string_set(NeoMutt->sub, he, buf->data, err);
1308  }
1309  if (CSR_RESULT(rc) != CSR_SUCCESS)
1310  return MUTT_CMD_ERROR;
1311  }
1312  continue;
1313  }
1314  else
1315  {
1316  if (bq)
1317  {
1318  // mutt_buffer_printf(err, "ACT23 set variable %s to 'yes'", buf->data);
1319  rc = cs_subset_he_native_set(NeoMutt->sub, he, true, err);
1320  if (CSR_RESULT(rc) != CSR_SUCCESS)
1321  return MUTT_CMD_ERROR;
1322  continue;
1323  }
1324  else
1325  {
1326  // mutt_buffer_printf(err, "ACT10 query variable %s", buf->data);
1327  if (he)
1328  {
1329  mutt_buffer_addstr(err, buf->data);
1330  mutt_buffer_addch(err, '=');
1331  mutt_buffer_reset(buf);
1332  rc = cs_subset_he_string_get(NeoMutt->sub, he, buf);
1333  if (CSR_RESULT(rc) != CSR_SUCCESS)
1334  {
1335  mutt_buffer_addstr(err, buf->data);
1336  return MUTT_CMD_ERROR;
1337  }
1338  if (DTYPE(he->type) == DT_PATH)
1339  mutt_pretty_mailbox(buf->data, buf->dsize);
1340  pretty_var(buf->data, err);
1341  }
1342  else
1343  {
1344  const char *val = myvar_get(buf->data);
1345  if (val)
1346  {
1347  mutt_buffer_addstr(err, buf->data);
1348  mutt_buffer_addch(err, '=');
1349  pretty_var(val, err);
1350  }
1351  else
1352  {
1353  mutt_buffer_printf(err, _("%s: unknown variable"), buf->data);
1354  return MUTT_CMD_ERROR;
1355  }
1356  }
1357  break;
1358  }
1359  }
1360  }
1361 
1362  if (my)
1363  {
1364  myvar_del(buf->data);
1365  }
1366  else if (bq)
1367  {
1368  if (inv)
1369  {
1370  // mutt_buffer_printf(err, "ACT25 TOGGLE bool/quad variable %s", buf->data);
1371  if (DTYPE(he->type) == DT_BOOL)
1372  bool_he_toggle(NeoMutt->sub, he, err);
1373  else
1374  quad_he_toggle(NeoMutt->sub, he, err);
1375  }
1376  else
1377  {
1378  // mutt_buffer_printf(err, "ACT26 UNSET bool/quad variable %s", buf->data);
1379  rc = cs_subset_he_native_set(NeoMutt->sub, he, false, err);
1380  if (CSR_RESULT(rc) != CSR_SUCCESS)
1381  return MUTT_CMD_ERROR;
1382  }
1383  continue;
1384  }
1385  else
1386  {
1387  rc = cs_subset_he_string_set(NeoMutt->sub, he, NULL, err);
1388  if (CSR_RESULT(rc) != CSR_SUCCESS)
1389  return MUTT_CMD_ERROR;
1390  }
1391  }
1392 
1393  return MUTT_CMD_SUCCESS;
1394 }
+ Here is the call graph for this function:

◆ parse_setenv()

enum CommandResult parse_setenv ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'setenv' and 'unsetenv' commands - Implements Command::parse()

Definition at line 1399 of file command_parse.c.

1401 {
1402  char **envp = mutt_envlist_getlist();
1403 
1404  bool query = false;
1405  bool prefix = false;
1406  bool unset = (data == MUTT_SET_UNSET);
1407 
1408  if (!MoreArgs(s))
1409  {
1410  mutt_buffer_printf(err, _("%s: too few arguments"), "setenv");
1411  return MUTT_CMD_WARNING;
1412  }
1413 
1414  if (*s->dptr == '?')
1415  {
1416  query = true;
1417  prefix = true;
1418 
1419  if (unset)
1420  {
1421  mutt_buffer_printf(err, _("Can't query a variable with the '%s' command"), "unsetenv");
1422  return MUTT_CMD_WARNING;
1423  }
1424 
1425  s->dptr++;
1426  }
1427 
1428  /* get variable name */
1430 
1431  if (*s->dptr == '?')
1432  {
1433  if (unset)
1434  {
1435  mutt_buffer_printf(err, _("Can't query a variable with the '%s' command"), "unsetenv");
1436  return MUTT_CMD_WARNING;
1437  }
1438 
1439  if (prefix)
1440  {
1441  mutt_buffer_printf(err, _("Can't use a prefix when querying a variable"));
1442  return MUTT_CMD_WARNING;
1443  }
1444 
1445  query = true;
1446  s->dptr++;
1447  }
1448 
1449  if (query)
1450  {
1451  bool found = false;
1452  while (envp && *envp)
1453  {
1454  /* This will display all matches for "^QUERY" */
1455  if (mutt_str_startswith(*envp, buf->data))
1456  {
1457  if (!found)
1458  {
1459  mutt_endwin();
1460  found = true;
1461  }
1462  puts(*envp);
1463  }
1464  envp++;
1465  }
1466 
1467  if (found)
1468  {
1470  return MUTT_CMD_SUCCESS;
1471  }
1472 
1473  mutt_buffer_printf(err, _("%s is unset"), buf->data);
1474  return MUTT_CMD_WARNING;
1475  }
1476 
1477  if (unset)
1478  {
1479  if (mutt_envlist_unset(buf->data))
1480  return MUTT_CMD_SUCCESS;
1481  return MUTT_CMD_ERROR;
1482  }
1483 
1484  /* set variable */
1485 
1486  if (*s->dptr == '=')
1487  {
1488  s->dptr++;
1489  SKIPWS(s->dptr);
1490  }
1491 
1492  if (!MoreArgs(s))
1493  {
1494  mutt_buffer_printf(err, _("%s: too few arguments"), "setenv");
1495  return MUTT_CMD_WARNING;
1496  }
1497 
1498  char *name = mutt_str_dup(buf->data);
1500  mutt_envlist_set(name, buf->data, true);
1501  FREE(&name);
1502 
1503  return MUTT_CMD_SUCCESS;
1504 }
+ Here is the call graph for this function:

◆ parse_source()

enum CommandResult parse_source ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'source' command - Implements Command::parse()

Definition at line 1509 of file command_parse.c.

1511 {
1512  char path[PATH_MAX];
1513 
1514  do
1515  {
1516  if (mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS) != 0)
1517  {
1518  mutt_buffer_printf(err, _("source: error at %s"), s->dptr);
1519  return MUTT_CMD_ERROR;
1520  }
1521  mutt_str_copy(path, buf->data, sizeof(path));
1522  mutt_expand_path(path, sizeof(path));
1523 
1524  if (source_rc(path, err) < 0)
1525  {
1526  mutt_buffer_printf(err, _("source: file %s could not be sourced"), path);
1527  return MUTT_CMD_ERROR;
1528  }
1529 
1530  } while (MoreArgs(s));
1531 
1532  return MUTT_CMD_SUCCESS;
1533 }
+ Here is the call graph for this function:

◆ parse_spam_list()

enum CommandResult parse_spam_list ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'spam' and 'nospam' commands - Implements Command::parse()

Definition at line 1538 of file command_parse.c.

1540 {
1541  struct Buffer templ;
1542 
1543  mutt_buffer_init(&templ);
1544 
1545  /* Insist on at least one parameter */
1546  if (!MoreArgs(s))
1547  {
1548  if (data == MUTT_SPAM)
1549  mutt_buffer_strcpy(err, _("spam: no matching pattern"));
1550  else
1551  mutt_buffer_strcpy(err, _("nospam: no matching pattern"));
1552  return MUTT_CMD_ERROR;
1553  }
1554 
1555  /* Extract the first token, a regex */
1557 
1558  /* data should be either MUTT_SPAM or MUTT_NOSPAM. MUTT_SPAM is for spam commands. */
1559  if (data == MUTT_SPAM)
1560  {
1561  /* If there's a second parameter, it's a template for the spam tag. */
1562  if (MoreArgs(s))
1563  {
1565 
1566  /* Add to the spam list. */
1567  if (mutt_replacelist_add(&SpamList, buf->data, templ.data, err) != 0)
1568  {
1569  FREE(&templ.data);
1570  return MUTT_CMD_ERROR;
1571  }
1572  FREE(&templ.data);
1573  }
1574  /* If not, try to remove from the nospam list. */
1575  else
1576  {
1578  }
1579 
1580  return MUTT_CMD_SUCCESS;
1581  }
1582  /* MUTT_NOSPAM is for nospam commands. */
1583  else if (data == MUTT_NOSPAM)
1584  {
1585  /* nospam only ever has one parameter. */
1586 
1587  /* "*" is a special case. */
1588  if (mutt_str_equal(buf->data, "*"))
1589  {
1592  return MUTT_CMD_SUCCESS;
1593  }
1594 
1595  /* If it's on the spam list, just remove it. */
1596  if (mutt_replacelist_remove(&SpamList, buf->data) != 0)
1597  return MUTT_CMD_SUCCESS;
1598 
1599  /* Otherwise, add it to the nospam list. */
1600  if (mutt_regexlist_add(&NoSpamList, buf->data, REG_ICASE, err) != 0)
1601  return MUTT_CMD_ERROR;
1602 
1603  return MUTT_CMD_SUCCESS;
1604  }
1605 
1606  /* This should not happen. */
1607  mutt_buffer_strcpy(err, "This is no good at all.");
1608  return MUTT_CMD_ERROR;
1609 }
+ Here is the call graph for this function:

◆ parse_stailq()

enum CommandResult parse_stailq ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse a list command - Implements Command::parse()

This is used by 'alternative_order', 'auto_view' and several others.

Definition at line 1616 of file command_parse.c.

1618 {
1619  do
1620  {
1622  add_to_stailq((struct ListHead *) data, buf->data);
1623  } while (MoreArgs(s));
1624 
1625  return MUTT_CMD_SUCCESS;
1626 }
+ Here is the call graph for this function:

◆ parse_subjectrx_list()

enum CommandResult parse_subjectrx_list ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'subjectrx' command - Implements Command::parse()

Definition at line 1631 of file command_parse.c.

1633 {
1634  enum CommandResult rc;
1635 
1636  rc = parse_replace_list(buf, s, &SubjectRegexList, err);
1637  if (rc == MUTT_CMD_SUCCESS)
1639  return rc;
1640 }
+ Here is the call graph for this function:

◆ parse_subscribe()

enum CommandResult parse_subscribe ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'subscribe' command - Implements Command::parse()

Definition at line 1645 of file command_parse.c.

1647 {
1648  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
1649 
1650  do
1651  {
1653 
1654  if (parse_grouplist(&gl, buf, s, err) == -1)
1655  goto bail;
1656 
1659 
1660  if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
1661  goto bail;
1662  if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
1663  goto bail;
1664  if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
1665  goto bail;
1666  } while (MoreArgs(s));
1667 
1669  return MUTT_CMD_SUCCESS;
1670 
1671 bail:
1673  return MUTT_CMD_ERROR;
1674 }
+ Here is the call graph for this function:

◆ parse_subscribe_to()

enum CommandResult parse_subscribe_to ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'subscribe-to' command - Implements Command::parse()

The 'subscribe-to' command allows to subscribe to an IMAP-Mailbox. Patterns are not supported. Use it as follows: subscribe-to =folder

Definition at line 1684 of file command_parse.c.

1686 {
1687  if (!buf || !s || !err)
1688  return MUTT_CMD_ERROR;
1689 
1690  mutt_buffer_reset(err);
1691 
1692  if (MoreArgs(s))
1693  {
1695 
1696  if (MoreArgs(s))
1697  {
1698  mutt_buffer_printf(err, _("%s: too many arguments"), "subscribe-to");
1699  return MUTT_CMD_WARNING;
1700  }
1701 
1702  if (buf->data && (*buf->data != '\0'))
1703  {
1704  /* Expand and subscribe */
1705  if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), true) == 0)
1706  {
1707  mutt_message(_("Subscribed to %s"), buf->data);
1708  return MUTT_CMD_SUCCESS;
1709  }
1710 
1711  mutt_buffer_printf(err, _("Could not subscribe to %s"), buf->data);
1712  return MUTT_CMD_ERROR;
1713  }
1714 
1715  mutt_debug(LL_DEBUG1, "Corrupted buffer");
1716  return MUTT_CMD_ERROR;
1717  }
1718 
1719  mutt_buffer_addstr(err, _("No folder specified"));
1720  return MUTT_CMD_WARNING;
1721 }
+ Here is the call graph for this function:

◆ parse_tag_formats()

enum CommandResult parse_tag_formats ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'tag-formats' command - Implements Command::parse()

Definition at line 1727 of file command_parse.c.

1729 {
1730  if (!buf || !s)
1731  return MUTT_CMD_ERROR;
1732 
1733  char *tmp = NULL;
1734 
1735  while (MoreArgs(s))
1736  {
1737  char *tag = NULL, *format = NULL;
1738 
1740  if (buf->data && (*buf->data != '\0'))
1741  tag = mutt_str_dup(buf->data);
1742  else
1743  continue;
1744 
1746  format = mutt_str_dup(buf->data);
1747 
1748  /* avoid duplicates */
1749  tmp = mutt_hash_find(TagFormats, format);
1750  if (tmp)
1751  {
1752  mutt_debug(LL_DEBUG3, "tag format '%s' already registered as '%s'\n", format, tmp);
1753  FREE(&tag);
1754  FREE(&format);
1755  continue;
1756  }
1757 
1758  mutt_hash_insert(TagFormats, format, tag);
1759  }
1760  return MUTT_CMD_SUCCESS;
1761 }
+ Here is the call graph for this function:

◆ parse_tag_transforms()

enum CommandResult parse_tag_transforms ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'tag-transforms' command - Implements Command::parse()

Definition at line 1766 of file command_parse.c.

1768 {
1769  if (!buf || !s)
1770  return MUTT_CMD_ERROR;
1771 
1772  char *tmp = NULL;
1773 
1774  while (MoreArgs(s))
1775  {
1776  char *tag = NULL, *transform = NULL;
1777 
1779  if (buf->data && (*buf->data != '\0'))
1780  tag = mutt_str_dup(buf->data);
1781  else
1782  continue;
1783 
1785  transform = mutt_str_dup(buf->data);
1786 
1787  /* avoid duplicates */
1788  tmp = mutt_hash_find(TagTransforms, tag);
1789  if (tmp)
1790  {
1791  mutt_debug(LL_DEBUG3, "tag transform '%s' already registered as '%s'\n", tag, tmp);
1792  FREE(&tag);
1793  FREE(&transform);
1794  continue;
1795  }
1796 
1797  mutt_hash_insert(TagTransforms, tag, transform);
1798  }
1799  return MUTT_CMD_SUCCESS;
1800 }
+ Here is the call graph for this function:

◆ parse_unalternates()

enum CommandResult parse_unalternates ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unalternates' command - Implements Command::parse()

Definition at line 1805 of file command_parse.c.

1807 {
1808  alternates_clean();
1809  do
1810  {
1812  mutt_regexlist_remove(&Alternates, buf->data);
1813 
1814  if (!mutt_str_equal(buf->data, "*") &&
1815  (mutt_regexlist_add(&UnAlternates, buf->data, REG_ICASE, err) != 0))
1816  {
1817  return MUTT_CMD_ERROR;
1818  }
1819 
1820  } while (MoreArgs(s));
1821 
1822  return MUTT_CMD_SUCCESS;
1823 }
+ Here is the call graph for this function:

◆ parse_unattachments()

enum CommandResult parse_unattachments ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unattachments' command - Implements Command::parse()

Definition at line 1828 of file command_parse.c.

1830 {
1831  char op;
1832  char *p = NULL;
1833  struct ListHead *head = NULL;
1834 
1836  if (!buf->data || (*buf->data == '\0'))
1837  {
1838  mutt_buffer_strcpy(err, _("unattachments: no disposition"));
1839  return MUTT_CMD_WARNING;
1840  }
1841 
1842  p = buf->data;
1843  op = *p++;
1844 
1845  if (op == '*')
1846  {
1852  return 0;
1853  }
1854 
1855  if ((op != '+') && (op != '-'))
1856  {
1857  op = '+';
1858  p--;
1859  }
1860  if (mutt_istr_startswith("attachment", p))
1861  {
1862  if (op == '+')
1863  head = &AttachAllow;
1864  else
1865  head = &AttachExclude;
1866  }
1867  else if (mutt_istr_startswith("inline", p))
1868  {
1869  if (op == '+')
1870  head = &InlineAllow;
1871  else
1872  head = &InlineExclude;
1873  }
1874  else
1875  {
1876  mutt_buffer_strcpy(err, _("unattachments: invalid disposition"));
1877  return MUTT_CMD_ERROR;
1878  }
1879 
1880  return parse_unattach_list(buf, s, head, err);
1881 }
+ Here is the call graph for this function:

◆ parse_unignore()

enum CommandResult parse_unignore ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unignore' command - Implements Command::parse()

Definition at line 1886 of file command_parse.c.

1888 {
1889  do
1890  {
1892 
1893  /* don't add "*" to the unignore list */
1894  if (strcmp(buf->data, "*") != 0)
1895  add_to_stailq(&UnIgnore, buf->data);
1896 
1897  remove_from_stailq(&Ignore, buf->data);
1898  } while (MoreArgs(s));
1899 
1900  return MUTT_CMD_SUCCESS;
1901 }
+ Here is the call graph for this function:

◆ parse_unlists()

enum CommandResult parse_unlists ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unlists' command - Implements Command::parse()

Definition at line 1906 of file command_parse.c.

1908 {
1910  do
1911  {
1915 
1916  if (!mutt_str_equal(buf->data, "*") &&
1917  (mutt_regexlist_add(&UnMailLists, buf->data, REG_ICASE, err) != 0))
1918  {
1919  return MUTT_CMD_ERROR;
1920  }
1921  } while (MoreArgs(s));
1922 
1923  return MUTT_CMD_SUCCESS;
1924 }
+ Here is the call graph for this function:

◆ do_unmailboxes()

static void do_unmailboxes ( struct Mailbox m)
static

Remove a Mailbox from the Sidebar/notifications.

Parameters
mMailbox to unmailboxes

Definition at line 1930 of file command_parse.c.

1931 {
1932 #ifdef USE_INOTIFY
1934 #endif
1935  m->flags = MB_HIDDEN;
1936  m->gen = -1;
1937  if (Context && (Context->mailbox == m))
1938  {
1939  struct EventMailbox em = { NULL };
1941  }
1942  else
1943  {
1945  mailbox_free(&m);
1946  }
1947 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_unmailboxes_star()

static void do_unmailboxes_star ( void  )
static

Remove all Mailboxes from the Sidebar/notifications.

Definition at line 1952 of file command_parse.c.

1953 {
1954  struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
1956  struct MailboxNode *np = NULL;
1957  struct MailboxNode *nptmp = NULL;
1958  STAILQ_FOREACH_SAFE(np, &ml, entries, nptmp)
1959  {
1960  do_unmailboxes(np->mailbox);
1961  }
1963 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_unmailboxes()

enum CommandResult parse_unmailboxes ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unmailboxes' command - Implements Command::parse()

This is also used by 'unvirtual-mailboxes'

Definition at line 1970 of file command_parse.c.

1972 {
1973  while (MoreArgs(s))
1974  {
1976 
1977  if (mutt_str_equal(buf->data, "*"))
1978  {
1980  return MUTT_CMD_SUCCESS;
1981  }
1982 
1984 
1985  struct Account *a = NULL;
1986  TAILQ_FOREACH(a, &NeoMutt->accounts, entries)
1987  {
1988  struct Mailbox *m = mx_mbox_find(a, mutt_buffer_string(buf));
1989  if (m)
1990  {
1991  do_unmailboxes(m);
1992  break;
1993  }
1994  }
1995  }
1996  return MUTT_CMD_SUCCESS;
1997 }
+ Here is the call graph for this function:

◆ parse_unmy_hdr()

enum CommandResult parse_unmy_hdr ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unmy_hdr' command - Implements Command::parse()

Definition at line 2002 of file command_parse.c.

2004 {
2005  struct ListNode *np = NULL, *tmp = NULL;
2006  size_t l;
2007 
2008  do
2009  {
2011  if (mutt_str_equal("*", buf->data))
2012  {
2013  /* Clear all headers, send a notification for each header */
2014  STAILQ_FOREACH(np, &UserHeader, entries)
2015  {
2016  struct EventHeader event = { np->data };
2018  }
2019  mutt_list_free(&UserHeader);
2020  continue;
2021  }
2022 
2023  l = mutt_str_len(buf->data);
2024  if (buf->data[l - 1] == ':')
2025  l--;
2026 
2027  STAILQ_FOREACH_SAFE(np, &UserHeader, entries, tmp)
2028  {
2029  if (mutt_istrn_equal(buf->data, np->data, l) && (np->data[l] == ':'))
2030  {
2031  struct EventHeader event = { np->data };
2033 
2034  header_free(&UserHeader, np);
2035  }
2036  }
2037  } while (MoreArgs(s));
2038  return MUTT_CMD_SUCCESS;
2039 }
+ Here is the call graph for this function:

◆ parse_unstailq()

enum CommandResult parse_unstailq ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse an unlist command - Implements Command::parse()

This is used by 'unalternative_order', 'unauto_view' and several others.

Definition at line 2046 of file command_parse.c.

2048 {
2049  do
2050  {
2052  /* Check for deletion of entire list */
2053  if (mutt_str_equal(buf->data, "*"))
2054  {
2055  mutt_list_free((struct ListHead *) data);
2056  break;
2057  }
2058  remove_from_stailq((struct ListHead *) data, buf->data);
2059  } while (MoreArgs(s));
2060 
2061  return MUTT_CMD_SUCCESS;
2062 }
+ Here is the call graph for this function:

◆ parse_unsubjectrx_list()

enum CommandResult parse_unsubjectrx_list ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unsubjectrx' command - Implements Command::parse()

Definition at line 2067 of file command_parse.c.

2069 {
2070  enum CommandResult rc;
2071 
2072  rc = parse_unreplace_list(buf, s, &SubjectRegexList, err);
2073  if (rc == MUTT_CMD_SUCCESS)
2075  return rc;
2076 }
+ Here is the call graph for this function:

◆ parse_unsubscribe()

enum CommandResult parse_unsubscribe ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unsubscribe' command - Implements Command::parse()

Definition at line 2081 of file command_parse.c.

2083 {
2085  do
2086  {
2089 
2090  if (!mutt_str_equal(buf->data, "*") &&
2091  (mutt_regexlist_add(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0))
2092  {
2093  return MUTT_CMD_ERROR;
2094  }
2095  } while (MoreArgs(s));
2096 
2097  return MUTT_CMD_SUCCESS;
2098 }
+ Here is the call graph for this function:

◆ parse_unsubscribe_from()

enum CommandResult parse_unsubscribe_from ( struct Buffer buf,
struct Buffer s,
intptr_t  data,
struct Buffer err 
)

Parse the 'unsubscribe-from' command - Implements Command::parse()

The 'unsubscribe-from' command allows to unsubscribe from an IMAP-Mailbox. Patterns are not supported. Use it as follows: unsubscribe-from =folder

Definition at line 2108 of file command_parse.c.

2110 {
2111  if (!buf || !s || !err)
2112  return MUTT_CMD_ERROR;
2113 
2114  if (MoreArgs(s))
2115  {
2117 
2118  if (MoreArgs(s))
2119  {
2120  mutt_buffer_printf(err, _("%s: too many arguments"), "unsubscribe-from");
2121  return MUTT_CMD_WARNING;
2122  }
2123 
2124  if (buf->data && (*buf->data != '\0'))
2125  {
2126  /* Expand and subscribe */
2127  if (imap_subscribe(mutt_expand_path(buf->data, buf->dsize), false) == 0)
2128  {
2129  mutt_message(_("Unsubscribed from %s"), buf->data);
2130  return MUTT_CMD_SUCCESS;
2131  }
2132 
2133  mutt_buffer_printf(err, _("Could not unsubscribe from %s"), buf->data);
2134  return MUTT_CMD_ERROR;
2135  }
2136 
2137  mutt_debug(LL_DEBUG1, "Corrupted buffer");
2138  return MUTT_CMD_ERROR;
2139  }
2140 
2141  mutt_buffer_addstr(err, _("No folder specified"));
2142  return MUTT_CMD_WARNING;
2143 }
+ Here is the call graph for this function:

◆ clear_source_stack()

void clear_source_stack ( void  )

Free memory from the stack used for the souce command.

Definition at line 2149 of file command_parse.c.

2150 {
2152 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ MuttrcStack

struct ListHead MuttrcStack = STAILQ_HEAD_INITIALIZER(MuttrcStack)
static

Definition at line 68 of file command_parse.c.

MUTT_SPAM
#define MUTT_SPAM
Definition: mutt.h:114
DT_QUAD
#define DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition: types.h:37
AttachMatch
An attachment matching a regex for attachment counter.
Definition: mutt_parse.h:34
TagTransforms
struct HashTable * TagTransforms
Lookup table of alternative tag names.
Definition: tags.c:38
mutt_endwin
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:572
print_attach_list
static int print_attach_list(struct ListHead *h, const char op, const char *name)
Print a list of attachments.
Definition: command_parse.c:353
mutt_open_read
FILE * mutt_open_read(const char *path, pid_t *thepid)
Run a command to read from.
Definition: muttlib.c:1306
UnSubscribedLists
struct RegexList UnSubscribedLists
List of regexes to blacklist false matches in SubscribedLists.
Definition: globals.c:49
MUTT_SET_UNSET
@ MUTT_SET_UNSET
default is to unset all vars
Definition: mutt_commands.h:69
mutt_parse_rc_line
enum CommandResult mutt_parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
Definition: init.c:1044
cs_subset_lookup
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
Definition: subset.c:168
AutoSubscribeCache
struct HashTable * AutoSubscribeCache
Hash Table of auto-subscribed mailing lists.
Definition: globals.c:48
InlineAllow
struct ListHead InlineAllow
List of inline types to counted.
Definition: mutt_parse.c:41
header_find
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition: email.c:172
mutt_regexlist_add
int mutt_regexlist_add(struct RegexList *rl, const char *str, uint16_t flags, struct Buffer *err)
Compile a regex string and add it to a list.
Definition: regex.c:132
MailboxNode
List of Mailboxes.
Definition: mailbox.h:152
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
NeoMutt::accounts
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:40
_
#define _(a)
Definition: message.h:28
NONULL
#define NONULL(x)
Definition: string2.h:37
Mailbox
A mailbox.
Definition: mailbox.h:81
mutt_grouplist_add_addrlist
void mutt_grouplist_add_addrlist(struct GroupList *gl, struct AddressList *al)
Add Address list to a GroupList.
Definition: group.c:226
MUTT_TOKEN_BACKTICK_VARS
#define MUTT_TOKEN_BACKTICK_VARS
Expand variables within backticks.
Definition: mutt.h:78
Binding
Mapping between a user key and a function.
Definition: keymap.h:120
Mailbox::emails
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
mutt_grouplist_add_regex
int mutt_grouplist_add_regex(struct GroupList *gl, const char *s, uint16_t flags, struct Buffer *err)
Add matching Addresses to a GroupList.
Definition: group.c:276
MoreArgs
#define MoreArgs(buf)
Definition: buffer.h:40
IS_COMMAND
#define IS_COMMAND(x)
Definition: types.h:58
ListNode
A List node for strings.
Definition: list.h:34
Buffer
String manipulation buffer.
Definition: buffer.h:33
mutt_monitor_remove
int mutt_monitor_remove(struct Mailbox *m)
Remove a watch for a mailbox.
Definition: monitor.c:526
GS_NONE
@ GS_NONE
Group is missing an argument.
Definition: command_parse.c:77
Account::type
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
LL_DEBUG3
@ LL_DEBUG3
Log at debug level 3.
Definition: logging.h:42
mutt_addrlist_to_intl
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1304
source_rc
int source_rc(const char *rcfile_path, struct Buffer *err)
Read an initialization file.
Definition: command_parse.c:426
STAILQ_REMOVE
#define STAILQ_REMOVE(head, elm, type, field)
Definition: queue.h:399
ctx_mailbox
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
Definition: context.c:429
header_add
struct ListNode * header_add(struct ListHead *hdrlist, const char *header)
Add a header to a list.
Definition: email.c:195
mutt_file_fclose
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:153
mailbox_gen
int mailbox_gen(void)
Get the next generation number.
Definition: mailbox.c:42
mutt_buffer_is_empty
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
mutt_buffer_dealloc
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
mutt_regexlist_remove
int mutt_regexlist_remove(struct RegexList *rl, const char *str)
Remove a Regex from a list.
Definition: regex.c:227
km_get_table
const struct Binding * km_get_table(enum MenuType menu)
Lookup a menu's keybindings.
Definition: keymap.c:1306
parse_attach_list
static enum CommandResult parse_attach_list(struct Buffer *buf, struct Buffer *s, struct ListHead *head, struct Buffer *err)
Parse the "attachments" command.
Definition: command_parse.c:279
NT_HEADER_CHANGE
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:160
CSR_SUCCESS
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
cs_subset_he_native_set
int cs_subset_he_native_set(const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
Definition: subset.c:270
MUTT_ICONV_NO_FLAGS
#define MUTT_ICONV_NO_FLAGS
No flags are set.
Definition: charset.h:73
CSR_RESULT
#define CSR_RESULT(x)
Definition: set.h:52
HashElem::data
void * data
User-supplied data.
Definition: hash.h:47
NeoMutt::notify
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
Account::name
char * name
Name of Account.
Definition: account.h:39
Ignore
struct ListHead Ignore
List of header patterns to ignore.
Definition: globals.c:45
DTYPE
#define DTYPE(x)
Mask for the Data Type.
Definition: types.h:44
TAILQ_EMPTY
#define TAILQ_EMPTY(head)
Definition: queue.h:714
MUTT_UNGROUP
#define MUTT_UNGROUP
'ungroup' config command
Definition: group.h:34
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:718
mutt_buffer_init
struct Buffer * mutt_buffer_init(struct Buffer *buf)
Initialise a new Buffer.
Definition: buffer.c:46
mutt_path_tilde
bool mutt_path_tilde(char *buf, size_t buflen, const char *homedir)
Expand '~' in a path.
Definition: path.c:223
DT_PATH_DIR
#define DT_PATH_DIR
Path is a directory.
Definition: types.h:53
neomutt_mailboxlist_get_all
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:160
MUTT_TOKEN_QUESTION
#define MUTT_TOKEN_QUESTION
Treat '?' as a special.
Definition: mutt.h:80
do_unmailboxes
static void do_unmailboxes(struct Mailbox *m)
Remove a Mailbox from the Sidebar/notifications.
Definition: command_parse.c:1930
mx_ac_find
struct Account * mx_ac_find(struct Mailbox *m)
Find the Account owning a Mailbox.
Definition: mx.c:1568
Context
The "current" mailbox.
Definition: context.h:38
mutt_str_dup
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
feature_enabled
bool feature_enabled(const char *name)
Test if a compile-time feature is enabled.
Definition: version.c:565
LL_DEBUG1
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
Mailbox::flags
uint8_t flags
e.g. MB_NORMAL
Definition: mailbox.h:134
attachments_clean
static void attachments_clean(void)
always wise to do what someone else did before
Definition: command_parse.c:111
MUTT_SET_RESET
@ MUTT_SET_RESET
default is to reset all vars to default
Definition: mutt_commands.h:70
mutt_check_mime_type
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition: parse.c:325
mutt_grouplist_remove_regex
int mutt_grouplist_remove_regex(struct GroupList *gl, const char *s)
Remove matching addresses from a GroupList.
Definition: group.c:301
FREE
#define FREE(x)
Definition: memory.h:40
STAILQ_FIRST
#define STAILQ_FIRST(head)
Definition: queue.h:347
MUTT_TOKEN_NO_FLAGS
#define MUTT_TOKEN_NO_FLAGS
No flags are set.
Definition: mutt.h:70
MENU_MAX
@ MENU_MAX
Definition: keymap.h:96
ContentType
ContentType
Content-Type.
Definition: mime.h:29
SubscribedLists
struct RegexList SubscribedLists
List of regexes to match subscribed mailing lists.
Definition: globals.c:52
Buffer::dptr
char * dptr
Current read/write position.
Definition: buffer.h:36
list_free_t
void(* list_free_t)(void **ptr)
Prototype for a function to free List data.
Definition: list.h:45
Buffer::dsize
size_t dsize
Length of data.
Definition: buffer.h:37
mx_mbox_find
struct Mailbox * mx_mbox_find(struct Account *a, const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1592
mutt_attachmatch_new
static struct AttachMatch * mutt_attachmatch_new(void)
Create a new AttachMatch.
Definition: command_parse.c:266
PATH_MAX
#define PATH_MAX
Definition: mutt.h:44
MailboxNode::mailbox
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
cs_subset_he_string_plus_equals
int cs_subset_he_string_plus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Add to a config item by string.
Definition: subset.c:411
mutt_ch_convert_string
int mutt_ch_convert_string(char **ps, const char *from, const char *to, uint8_t flags)
Convert a string between encodings.
Definition: charset.c:754
mutt_replacelist_add
int mutt_replacelist_add(struct ReplaceList *rl, const char *pat, const char *templ, struct Buffer *err)
Add a pattern and a template to a list.
Definition: regex.c:263
mutt_buffer_reset
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
mutt_sleep
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1448
Binding::name
const char * name
name of the function
Definition: keymap.h:122
mutt_buffer_pool_release
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
MuttrcStack
static struct ListHead MuttrcStack
Definition: command_parse.c:68
STAILQ_EMPTY
#define STAILQ_EMPTY(head)
Definition: queue.h:345
mailbox_free
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:71
myvar_get
const char * myvar_get(const char *var)
Get the value of a "my_" variable.
Definition: myvar.c:73
mutt_list_insert_tail
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
cs_subset_he_reset
int cs_subset_he_reset(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
Definition: subset.c:307
quad_he_toggle
int quad_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a quad.
Definition: quad.c:202
notify_send
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:152
mutt_monitor_add
int mutt_monitor_add(struct Mailbox *m)
Add a watch for a mailbox.
Definition: monitor.c:481
MUTT_NAMED
#define MUTT_NAMED
Definition: mutt_commands.h:74
cs_subset_he_string_minus_equals
int cs_subset_he_string_minus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Remove from a config item by string.
Definition: subset.c:449
SKIPWS
#define SKIPWS(ch)
Definition: string2.h:46
mutt_istr_equal
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:883
mutt_hash_find
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition: hash.c:354
mutt_str_equal
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
get_elem_list
struct HashElem ** get_elem_list(struct ConfigSet *cs)
Create a sorted list of all config items.
Definition: subset.c:64
clear_subject_mods
static void clear_subject_mods(void)
Clear out all modified email subjects.
Definition: command_parse.c:192
EventMailbox
An Event that happened to a Mailbox.
Definition: mailbox.h:183
NoSpamList
struct RegexList NoSpamList
List of regexes to whitelist non-spam emails.
Definition: globals.c:43
cs_subset_free
void cs_subset_free(struct ConfigSubset **ptr)
Free a Config Subset.
Definition: subset.c:93
MB_HIDDEN
#define MB_HIDDEN
Definition: mailbox.h:38
TAILQ_HEAD_INITIALIZER
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:630
EventHeader
An event that happened to a header.
Definition: email.h:167
mutt_extract_token
int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
Definition: init.c:393
NT_MAILBOX
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:42
mutt_any_key_to_continue
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition: curs_lib.c:605
mutt_buffer_addch
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:240
mutt_expand_path
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:128
mutt_buffer_pool_get
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
NT_HEADER
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:41
Mailbox::type
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
C_ConfigCharset
WHERE char * C_ConfigCharset
Config: Character set that the config files are in.
Definition: mutt_globals.h:88
MUTT_CMD_FINISH
@ MUTT_CMD_FINISH
Finish: Stop processing this file.
Definition: mutt_commands.h:39
mutt_buffer_copy
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:445
bool_he_toggle
int bool_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a bool.
Definition: bool.c:185
Account
A group of associated Mailboxes.
Definition: account.h:36
C_Folder
WHERE char * C_Folder
Config: Base folder for a set of mailboxes.
Definition: mutt_globals.h:96
OptForceRefresh
WHERE bool OptForceRefresh
(pseudo) refresh even during macros
Definition: options.h:37
add_to_stailq
void add_to_stailq(struct ListHead *head, const char *str)
Add a string to a list.
Definition: muttlib.c:1704
MailLists
struct RegexList MailLists
List of regexes to match mailing lists.
Definition: globals.c:50
InlineExclude
struct ListHead InlineExclude
List of inline types to ignore.
Definition: mutt_parse.c:42
Mailbox::gen
int gen
Generation number, for sorting.
Definition: mailbox.h:146
Mailbox::name
char * name
A short name for the Mailbox.
Definition: mailbox.h:85
Mailbox::account
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:131
mutt_list_insert_head
struct ListNode * mutt_list_insert_head(struct ListHead *h, char *s)
Insert a string at the beginning of a List.
Definition: list.c:45
mutt_grouplist_destroy
void mutt_grouplist_destroy(struct GroupList *gl)
Free a GroupList.
Definition: group.c:157
mutt_parse_rc_buffer
enum CommandResult mutt_parse_rc_buffer(struct Buffer *line, struct Buffer *token, struct Buffer *err)
Parse a line of user config.
Definition: init.c:986
MUTT_NOSPAM
#define MUTT_NOSPAM
Definition: mutt.h:115
cs_subset_he_string_set
int cs_subset_he_string_set(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Set a config item by string.
Definition: subset.c:373
Mailbox::msg_count
int msg_count
Total number of messages.
Definition: mailbox.h:91
MUTT_MAILBOX_ANY
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
Definition: mailbox.h:45
ConfigSubset::cs
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
MUTT_UNKNOWN
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition: mailbox.h:47
mutt_hash_insert
struct HashElem * mutt_hash_insert(struct HashTable *table, const char *strkey, void *data)
Add a new element to the Hash Table (with string keys)
Definition: hash.c:327
MUTT_SET_SET
@ MUTT_SET_SET
default is to set all vars
Definition: mutt_commands.h:67
pretty_var
size_t pretty_var(const char *str, struct Buffer *buf)
Escape and stringify a config item value.
Definition: dump.c:83
mutt_addrlist_clear
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1468
alternates_clean
static void alternates_clean(void)
Clear the recipient valid flag of all emails.
Definition: command_parse.c:369
IS_MAILBOX
#define IS_MAILBOX(x)
Definition: types.h:57
mutt_addrlist_parse2
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:616
parse_grouplist
int parse_grouplist(struct GroupList *gl, struct Buffer *buf, struct Buffer *s, struct Buffer *err)
Parse a group context.
Definition: command_parse.c:393
NT_MAILBOX_SWITCH
@ NT_MAILBOX_SWITCH
Current Mailbox has changed.
Definition: mailbox.h:175
Menus
const struct Mapping Menus[]
Menu name lookup table.
Definition: keymap.c:61
DT_PATH
#define DT_PATH
a path to a file/directory
Definition: types.h:36
do_unmailboxes_star
static void do_unmailboxes_star(void)
Remove all Mailboxes from the Sidebar/notifications.
Definition: command_parse.c:1952
Context::mailbox
struct Mailbox * mailbox
Definition: context.h:50
mutt_list_free_type
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
Definition: list.c:144
Email::env
struct Envelope * env
Envelope information.
Definition: email.h:90
mutt_attachmatch_free
void mutt_attachmatch_free(struct AttachMatch **ptr)
Free an AttachMatch - Implements list_free_t.
Definition: mutt_parse.c:243
mutt_debug
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
MUTT_SET_INV
@ MUTT_SET_INV
default is to invert all vars
Definition: mutt_commands.h:68
MUTT_CMD_SUCCESS
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition: mutt_commands.h:38
AttachMatch::major_int
enum ContentType major_int
Definition: mutt_parse.h:37
HashElem::type
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:45
mutt_grouplist_remove_addrlist
int mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *al)
Remove an AddressList from a GroupList.
Definition: group.c:245
imap_subscribe
int imap_subscribe(char *path, bool subscribe)
Subscribe to a mailbox.
Definition: imap.c:1272
REG_COMP
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
Definition: regex3.h:54
MUTT_TOKEN_EQUAL
#define MUTT_TOKEN_EQUAL
Treat '=' as a special.
Definition: mutt.h:71
MUTT_GROUP
#define MUTT_GROUP
'group' config command
Definition: group.h:33
mailbox_new
struct Mailbox * mailbox_new(void)
Create a new Mailbox.
Definition: mailbox.c:52
NT_HEADER_REMOVE
@ NT_HEADER_REMOVE
A header is about to be removed.
Definition: email.h:161
mutt_regexlist_free
void mutt_regexlist_free(struct RegexList *rl)
Free a RegexList object.
Definition: regex.c:171
Mailbox::realpath
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:84
mutt_buffer_expand_path
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:323
mutt_envlist_unset
bool mutt_envlist_unset(const char *name)
Unset an environment variable.
Definition: envlist.c:132
STAILQ_REMOVE_HEAD
#define STAILQ_REMOVE_HEAD(head, field)
Definition: queue.h:419
mutt_pattern_group
struct Group * mutt_pattern_group(const char *pat)
Match a pattern to a Group.
Definition: group.c:65
mutt_str_len
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:631
mutt_str_getenv
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:991
mutt_buffer_string
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
STAILQ_FOREACH_SAFE
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:359
account_new
struct Account * account_new(const char *name, struct ConfigSubset *sub)
Create a new Account.
Definition: account.c:43
GS_RX
@ GS_RX
Entry is a regular expression.
Definition: command_parse.c:78
Envelope::disp_subj
char * disp_subj
Display subject (modified copy of subject)
Definition: envelope.h:68
MUTT_CMD_ERROR
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition: mutt_commands.h:36
mx_path_canon2
int mx_path_canon2(struct Mailbox *m, const char *folder)
Canonicalise the path to realpath.
Definition: mx.c:1482
mutt_str_replace
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:446
filter_wait
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Definition: filter.c:217
UnMailLists
struct RegexList UnMailLists
List of regexes to blacklist false matches in MailLists.
Definition: globals.c:51
CommandResult
CommandResult
Error codes for command_t parse functions.
Definition: mutt_commands.h:34
DT_BOOL
#define DT_BOOL
boolean option
Definition: types.h:30
NT_HEADER_ADD
@ NT_HEADER_ADD
A new header has been added.
Definition: email.h:159
STAILQ_HEAD_INITIALIZER
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:321
HashElem
The item stored in a Hash Table.
Definition: hash.h:43
is_function
static bool is_function(const char *name)
Is the argument a neomutt function?
Definition: command_parse.c:247
MUTT_CMD_WARNING
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition: mutt_commands.h:37
header_update
struct ListNode * header_update(struct ListNode *hdr, const char *header)
Update an existing header.
Definition: email.c:209
HomeDir
char * HomeDir
User's home directory.
Definition: mutt_globals.h:49
mutt_replacelist_remove
int mutt_replacelist_remove(struct ReplaceList *rl, const char *pat)
Remove a pattern from a list.
Definition: regex.c:565
mutt_mem_malloc
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
mutt_command_get
struct Command * mutt_command_get(const char *s)
Get a Command by its name.
Definition: mutt_commands.c:197
parse_replace_list
static enum CommandResult parse_replace_list(struct Buffer *buf, struct Buffer *s, struct ReplaceList *list, struct Buffer *err)
Parse a string replacement rule - Implements Command::parse()
Definition: command_parse.c:210
NeoMutt
Container for Accounts, Notifications.
Definition: neomutt.h:36
DT_PATH_FILE
#define DT_PATH_FILE
Path is a file.
Definition: types.h:54
MUTT_TOKEN_QUOTE
#define MUTT_TOKEN_QUOTE
Don't interpret quotes.
Definition: mutt.h:74
mutt_istr_startswith
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition: string.c:172
remove_from_stailq
void remove_from_stailq(struct ListHead *head, const char *str)
Remove an item, matching a string, from a List.
Definition: muttlib.c:1729
header_free
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:237
MenuType
MenuType
Types of GUI selections.
Definition: keymap.h:72
cs_subset_he_string_get
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
Definition: subset.c:341
notify_free
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:62
Email::recip_valid
bool recip_valid
Is_recipient is valid.
Definition: email.h:58
myvar_del
void myvar_del(const char *var)
Unset the value of a "my_" variable.
Definition: myvar.c:112
mutt_buffer_len
size_t mutt_buffer_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition: buffer.c:356
parse_unreplace_list
static enum CommandResult parse_unreplace_list(struct Buffer *buf, struct Buffer *s, struct ReplaceList *list, struct Buffer *err)
Remove a string replacement rule - Implements Command::parse()
Definition: command_parse.c:85
ListNode::data
char * data
String.
Definition: list.h:36
mx_ac_add
bool mx_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition: mx.c:1768
NeoMutt::sub
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
Email::attach_valid
bool attach_valid
true when the attachment count is valid
Definition: email.h:70
AttachMatch::minor_regex
regex_t minor_regex
Definition: mutt_parse.h:39
mutt_grouplist_clear
void mutt_grouplist_clear(struct GroupList *gl)
Clear a GroupList.
Definition: group.c:103
mutt_envlist_getlist
char ** mutt_envlist_getlist(void)
Get the private environment.
Definition: envlist.c:169
GS_ADDR
@ GS_ADDR
Entry is an address.
Definition: command_parse.c:79
mutt_buffer_addstr
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:225
mutt_istrn_equal
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
Definition: string.c:621
MAX_ERRS
#define MAX_ERRS
Definition: command_parse.c:70
MB_NORMAL
#define MB_NORMAL
Definition: mailbox.h:37
AttachMatch::major
const char * major
Definition: mutt_parse.h:36
neomutt_account_add
bool neomutt_account_add(struct NeoMutt *n, struct Account *a)
Add an Account to the global list.
Definition: neomutt.c:84
mutt_buffer_strdup
char * mutt_buffer_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition: buffer.c:432
account_mailbox_remove
bool account_mailbox_remove(struct Account *a, struct Mailbox *m)
Remove a Mailbox from an Account.
Definition: account.c:94
TagFormats
WHERE struct HashTable * TagFormats
Hash Table of tag-formats (tag -> format string)
Definition: mutt_globals.h:59
SpamList
struct ReplaceList SpamList
List of regexes and patterns to match spam emails.
Definition: globals.c:44
mutt_replacelist_free
void mutt_replacelist_free(struct ReplaceList *rl)
Free a ReplaceList object.
Definition: regex.c:448
C_Charset
char * C_Charset
Config: Default character set for displaying text on screen.
Definition: charset.c:53
mutt_pretty_mailbox
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:523
Buffer::data
char * data
Pointer to data.
Definition: buffer.h:35
MUTT_RL_CONT
#define MUTT_RL_CONT
-continuation
Definition: file.h:40
Email
The envelope/body of an email.
Definition: email.h:37
mutt_envlist_set
bool mutt_envlist_set(const char *name, const char *value, bool overwrite)
Set an environment variable.
Definition: envlist.c:85
mutt_str_startswith
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:160
UnIgnore
struct ListHead UnIgnore
List of header patterns to unignore (see)
Definition: globals.c:46
mutt_message
#define mutt_message(...)
Definition: logging.h:83
mutt_grouplist_add
void mutt_grouplist_add(struct GroupList *gl, struct Group *group)
Add a Group to a GroupList.
Definition: group.c:137
mutt_buffer_printf
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
parse_unattach_list
static enum CommandResult parse_unattach_list(struct Buffer *buf, struct Buffer *s, struct ListHead *head, struct Buffer *err)
Parse the "unattachments" command.
Definition: command_parse.c:134
AttachMatch::minor
const char * minor
Definition: mutt_parse.h:38
mutt_warning
#define mutt_warning(...)
Definition: logging.h:82
mutt_buffer_make
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
mutt_list_free
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
Account::notify
struct Notify * notify
Notifications handler.
Definition: account.h:42
MUTT_TOKEN_MINUS
#define MUTT_TOKEN_MINUS
Treat '-' as a special.
Definition: mutt.h:82
SubjectRegexList
struct ReplaceList SubjectRegexList
List of regexes to tidy the view of the email's subject.
Definition: globals.c:53
MUTT_TOKEN_PLUS
#define MUTT_TOKEN_PLUS
Treat '+' as a special.
Definition: mutt.h:81
mutt_buffer_strcpy
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:312
myvar_set
void myvar_set(const char *var, const char *val)
Set the value of a "my_" variable.
Definition: myvar.c:91
GroupState
GroupState
Type of email address group.
Definition: command_parse.c:75
mutt_path_to_absolute
bool mutt_path_to_absolute(char *path, const char *reference)
Convert relative filepath to an absolute path.
Definition: path.c:397
LL_DEBUG2
@ LL_DEBUG2
Log at debug level 2.
Definition: logging.h:41
AttachAllow
struct ListHead AttachAllow
List of attachment types to be counted.
Definition: mutt_parse.c:39
neomutt_mailboxlist_clear
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:137
mutt_hash_free
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
Definition: hash.c:447
MUTT_TOKEN_SPACE
#define MUTT_TOKEN_SPACE
Don't treat whitespace as a term.
Definition: mutt.h:73
Mailbox::pathbuf
struct Buffer pathbuf
Definition: mailbox.h:83
Account::sub
struct ConfigSubset * sub
Inherited config items.
Definition: account.h:40
mutt_error
#define mutt_error(...)
Definition: logging.h:84
AttachExclude
struct ListHead AttachExclude
List of attachment types to be ignored.
Definition: mutt_parse.c:40
mutt_file_read_line
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
Definition: file.c:667
mutt_str_copy
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:716