NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Index Function API

Prototype for an Index Function. More...

+ Collaboration diagram for Index Function API:

Functions

static int op_alias_dialog (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Open the aliases dialog - Implements index_function_t -.
 
static int op_attachment_edit_type (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Edit attachment content type - Implements index_function_t -.
 
static int op_bounce_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Remail a message to another user - Implements index_function_t -.
 
static int op_check_traditional (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Check for classic PGP - Implements index_function_t -.
 
static int op_compose_to_sender (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Compose new message to the current message sender - Implements index_function_t -.
 
static int op_create_alias (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Create an alias from a message sender - Implements index_function_t -.
 
static int op_delete (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Delete the current entry - Implements index_function_t -.
 
static int op_delete_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Delete all messages in thread - Implements index_function_t -.
 
static int op_display_address (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Display full address of sender - Implements index_function_t -.
 
static int op_display_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Display a message - Implements index_function_t -.
 
static int op_edit_label (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Add, change, or delete a message's label - Implements index_function_t -.
 
static int op_edit_raw_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Edit the raw message (edit and edit-raw-message are synonyms) - Implements index_function_t -.
 
static int op_end_cond (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 End of conditional execution (noop) - Implements index_function_t -.
 
static int op_exit (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Exit this menu - Implements index_function_t -.
 
static int op_extract_keys (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Extract supported public keys - Implements index_function_t -.
 
static int op_flag_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Toggle a message's 'important' flag - Implements index_function_t -.
 
static int op_forget_passphrase (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Wipe passphrases from memory - Implements index_function_t -.
 
static int op_forward_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Forward a message with comments - Implements index_function_t -.
 
static int op_group_reply (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Reply to all recipients - Implements index_function_t -.
 
static int op_jump (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Jump to an index number - Implements index_function_t -.
 
static int op_list_reply (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Reply to specified mailing list - Implements index_function_t -.
 
static int op_list_subscribe (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Subscribe to a mailing list - Implements index_function_t -.
 
static int op_list_unsubscribe (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Unsubscribe from mailing list - Implements index_function_t -.
 
static int op_mail (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Compose a new mail message - Implements index_function_t -.
 
static int op_mailbox_list (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 List mailboxes with new mail - Implements index_function_t -.
 
static int op_mail_key (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Mail a PGP public key - Implements index_function_t -.
 
static int op_main_break_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Break the thread in two - Implements index_function_t -.
 
static int op_main_change_folder (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Open a different folder - Implements index_function_t -.
 
static int op_main_collapse_all (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Collapse/uncollapse all threads - Implements index_function_t -.
 
static int op_main_collapse_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Collapse/uncollapse current thread - Implements index_function_t -.
 
static int op_main_delete_pattern (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Delete messages matching a pattern - Implements index_function_t -.
 
static int op_main_limit (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Limit view to a pattern/thread - Implements index_function_t -.
 
static int op_main_link_threads (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Link tagged message to the current one - Implements index_function_t -.
 
static int op_main_modify_tags (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Modify (notmuch/imap) tags - Implements index_function_t -.
 
static int op_main_next_new (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Jump to the next new message - Implements index_function_t -.
 
static int op_main_next_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Jump to the next thread - Implements index_function_t -.
 
static int op_main_next_undeleted (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Move to the next undeleted message - Implements index_function_t -.
 
static int op_main_next_unread_mailbox (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Open next mailbox with unread mail - Implements index_function_t -.
 
static int op_main_prev_undeleted (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Move to the previous undeleted message - Implements index_function_t -.
 
static int op_main_quasi_delete (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Delete from NeoMutt, don't touch on disk - Implements index_function_t -.
 
static int op_main_read_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Mark the current thread as read - Implements index_function_t -.
 
static int op_main_root_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Jump to root message in thread - Implements index_function_t -.
 
static int op_main_set_flag (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Set a status flag on a message - Implements index_function_t -.
 
static int op_main_show_limit (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Show currently active limit pattern - Implements index_function_t -.
 
static int op_main_sync_folder (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Save changes to mailbox - Implements index_function_t -.
 
static int op_main_tag_pattern (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Tag messages matching a pattern - Implements index_function_t -.
 
static int op_main_undelete_pattern (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Undelete messages matching a pattern - Implements index_function_t -.
 
static int op_main_untag_pattern (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Untag messages matching a pattern - Implements index_function_t -.
 
static int op_mark_msg (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Create a hotkey macro for the current message - Implements index_function_t -.
 
static int op_next_entry (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Move to the next entry - Implements index_function_t -.
 
static int op_pipe (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Pipe message/attachment to a shell command - Implements index_function_t -.
 
static int op_prev_entry (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Move to the previous entry - Implements index_function_t -.
 
static int op_print (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Print the current entry - Implements index_function_t -.
 
static int op_query (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Query external program for addresses - Implements index_function_t -.
 
static int op_quit (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Save changes to mailbox and quit - Implements index_function_t -.
 
static int op_recall_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Recall a postponed message - Implements index_function_t -.
 
static int op_reply (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Reply to a message - Implements index_function_t -.
 
static int op_resend (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Use the current message as a template for a new one - Implements index_function_t -.
 
static int op_save (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Make decrypted copy - Implements index_function_t -.
 
static int op_search (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Search for a regular expression - Implements index_function_t -.
 
static int op_sort (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Sort messages - Implements index_function_t -.
 
static int op_tag (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Tag the current entry - Implements index_function_t -.
 
static int op_tag_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Tag the current thread - Implements index_function_t -.
 
static int op_toggle_new (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Toggle a message's 'new' flag - Implements index_function_t -.
 
static int op_toggle_write (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Toggle whether the mailbox will be rewritten - Implements index_function_t -.
 
static int op_undelete (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Undelete the current entry - Implements index_function_t -.
 
static int op_undelete_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Undelete all messages in thread - Implements index_function_t -.
 
static int op_view_attachments (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Show MIME attachments - Implements index_function_t -.
 
static int op_autocrypt_acct_menu (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Manage autocrypt accounts - Implements index_function_t -.
 
static int op_main_imap_fetch (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Force retrieval of mail from IMAP server - Implements index_function_t -.
 
static int op_main_imap_logout_all (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Logout from all IMAP servers - Implements index_function_t -.
 
static int op_catchup (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Mark all articles in newsgroup as read - Implements index_function_t -.
 
static int op_get_children (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Get all children of the current message - Implements index_function_t -.
 
static int op_get_message (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Get parent of the current message - Implements index_function_t -.
 
static int op_main_change_group (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Open a different newsgroup - Implements index_function_t -.
 
static int op_post (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Followup to newsgroup - Implements index_function_t -.
 
static int op_main_entire_thread (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Read entire thread of the current message - Implements index_function_t -.
 
static int op_main_vfolder_from_query (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Generate virtual folder from query - Implements index_function_t -.
 
static int op_main_windowed_vfolder (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Shifts virtual folder time window - Implements index_function_t -.
 
static int op_main_fetch_mail (struct IndexSharedData *shared, struct IndexPrivateData *priv, const struct KeyEvent *event)
 Retrieve mail from POP server - Implements index_function_t -.
 

Detailed Description

Prototype for an Index Function.

Parameters
sharedShared Index data
privPrivate Index data
eventEvent to process
Return values
numFunctionRetval or opcode, e.g. OP_JUMP
Precondition
shared is not NULL
priv is not NULL
event is not NULL

Function Documentation

◆ op_alias_dialog()

static int op_alias_dialog ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Open the aliases dialog - Implements index_function_t -.

Definition at line 425 of file functions.c.

427{
428 alias_dialog(shared->mailbox, shared->sub);
429 return FR_SUCCESS;
430}
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
void alias_dialog(struct Mailbox *m, struct ConfigSubset *sub)
Open the aliases dialog.
Definition dlg_alias.c:493
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:41
struct ConfigSubset * sub
Config set to use.
Definition shared_data.h:38
+ Here is the call graph for this function:

◆ op_attachment_edit_type()

static int op_attachment_edit_type ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Edit attachment content type - Implements index_function_t -.

Definition at line 435 of file functions.c.

438{
439 if (!shared->email)
440 return FR_NO_ACTION;
441 mutt_edit_content_type(shared->email, shared->email->body, NULL);
442
444 return FR_SUCCESS;
445}
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition external.c:1072
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:188
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition lib.h:59
struct Body * body
List of MIME parts.
Definition email.h:69
struct Menu * menu
Menu controlling the index.
struct Email * email
Currently selected Email.
Definition shared_data.h:42
+ Here is the call graph for this function:

◆ op_bounce_message()

static int op_bounce_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Remail a message to another user - Implements index_function_t -.

Definition at line 450 of file functions.c.

452{
453 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
454 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
455 index_bounce_message(shared->mailbox, &ea);
456 ARRAY_FREE(&ea);
457
458 return FR_SUCCESS;
459}
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition array.h:58
void index_bounce_message(struct Mailbox *m, struct EmailArray *ea)
Bounce an email.
Definition external.c:87
int ea_add_tagged(struct EmailArray *ea, struct MailboxView *mv, struct Email *e, bool use_tagged)
Get an array of the tagged Emails.
Definition mview.c:375
bool tag_prefix
tag-prefix has been pressed
struct MailboxView * mailbox_view
Current Mailbox view.
Definition shared_data.h:40
+ Here is the call graph for this function:

◆ op_check_traditional()

static int op_check_traditional ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Check for classic PGP - Implements index_function_t -.

Definition at line 464 of file functions.c.

466{
468 return FR_NOT_IMPL;
469 if (!shared->email)
470 return FR_NO_ACTION;
471
472 if (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED))
473 {
474 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
475 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
476 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
478 ARRAY_FREE(&ea);
479 }
480
481 return FR_SUCCESS;
482}
@ FR_NOT_IMPL
Invalid function - feature not enabled.
Definition dispatcher.h:37
bool mutt_check_traditional_pgp(struct Mailbox *m, struct EmailArray *ea)
Check if a message has inline PGP content.
Definition external.c:1213
#define MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:60
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
Definition lib.h:100
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition lib.h:98
#define WithCrypto
Definition lib.h:124
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
+ Here is the call graph for this function:

◆ op_compose_to_sender()

static int op_compose_to_sender ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Compose new message to the current message sender - Implements index_function_t -.

Definition at line 487 of file functions.c.

489{
490 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
491 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
492 int rc = mutt_send_message(SEND_TO_SENDER, NULL, NULL, shared->mailbox, &ea,
493 shared->sub);
494 ARRAY_FREE(&ea);
496
497 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
498}
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
int mutt_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Mailbox *m, struct EmailArray *ea, struct ConfigSubset *sub)
Send an email.
Definition send.c:2037
#define SEND_TO_SENDER
Compose new email to sender.
Definition send.h:53
+ Here is the call graph for this function:

◆ op_create_alias()

static int op_create_alias ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Create an alias from a message sender - Implements index_function_t -.

Definition at line 503 of file functions.c.

505{
506 struct AddressList *al = NULL;
507 if (shared->email && shared->email->env)
508 al = mutt_get_address(shared->email->env, NULL);
509 alias_create(al, shared->sub);
511
512 return FR_SUCCESS;
513}
void alias_create(struct AddressList *al, const struct ConfigSubset *sub)
Create a new Alias from an Address.
Definition alias.c:368
struct AddressList * mutt_get_address(struct Envelope *env, const char **prefix)
Get an Address from an Envelope.
Definition alias.c:328
struct Envelope * env
Envelope information.
Definition email.h:68
+ Here is the call graph for this function:

◆ op_delete()

static int op_delete ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Delete the current entry - Implements index_function_t -.

This function handles:

  • OP_DELETE
  • OP_PURGE_MESSAGE

Definition at line 522 of file functions.c.

524{
525 /* L10N: CHECK_ACL */
526 if (!check_acl(shared->mailbox, MUTT_ACL_DELETE, _("Can't delete message")))
527 return FR_ERROR;
528
529 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
530 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
531
532 mutt_emails_set_flag(shared->mailbox, &ea, MUTT_DELETE, true);
533 mutt_emails_set_flag(shared->mailbox, &ea, MUTT_PURGE, (event->op == OP_PURGE_MESSAGE));
534 const bool c_delete_untag = cs_subset_bool(shared->sub, "delete_untag");
535 if (c_delete_untag)
536 mutt_emails_set_flag(shared->mailbox, &ea, MUTT_TAG, false);
537 ARRAY_FREE(&ea);
538
539 if (priv->tag_prefix)
540 {
542 }
543 else
544 {
546 }
547
548 return FR_SUCCESS;
549}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
#define MUTT_ACL_DELETE
Delete a message.
Definition mailbox.h:62
bool check_acl(struct Mailbox *m, AclFlags acl, const char *msg)
Check the ACLs for a function.
Definition dlg_index.c:135
void mutt_emails_set_flag(struct Mailbox *m, struct EmailArray *ea, enum MessageType flag, bool bf)
Set flag on messages.
Definition flags.c:358
static bool resolve_email(struct IndexPrivateData *priv, struct IndexSharedData *shared, enum ResolveMethod rm)
Pick the next Email to advance the cursor to.
Definition functions.c:345
@ RESOLVE_NEXT_UNDELETED
Next undeleted email.
Definition functions.c:314
#define MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:57
#define _(a)
Definition message.h:28
@ MUTT_PURGE
Messages to be purged (bypass trash)
Definition mutt.h:96
@ MUTT_TAG
Tagged messages.
Definition mutt.h:99
@ MUTT_DELETE
Messages to be deleted.
Definition mutt.h:94
int op
Function opcode, e.g. OP_HELP.
Definition get.h:52
+ Here is the call graph for this function:

◆ op_delete_thread()

static int op_delete_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Delete all messages in thread - Implements index_function_t -.

This function handles:

  • OP_DELETE_SUBTHREAD
  • OP_DELETE_THREAD
  • OP_PURGE_THREAD

Definition at line 559 of file functions.c.

561{
562 /* L10N: CHECK_ACL */
563 /* L10N: Due to the implementation details we do not know whether we
564 delete zero, 1, 12, ... messages. So in English we use
565 "messages". Your language might have other means to express this. */
566 if (!check_acl(shared->mailbox, MUTT_ACL_DELETE, _("Can't delete messages")))
567 return FR_ERROR;
568 if (!shared->email)
569 return FR_NO_ACTION;
570
571 const int op = event->op;
572 int subthread = (op == OP_DELETE_SUBTHREAD);
573 int rc = mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_DELETE, true, subthread);
574 if (rc == -1)
575 return FR_ERROR;
576 if (op == OP_PURGE_THREAD)
577 {
578 rc = mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_PURGE, true, subthread);
579 if (rc == -1)
580 return FR_ERROR;
581 }
582
583 const bool c_delete_untag = cs_subset_bool(shared->sub, "delete_untag");
584 if (c_delete_untag)
585 mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_TAG, false, subthread);
586
589 return FR_SUCCESS;
590}
int mutt_thread_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool subthread)
Set a flag on an entire thread.
Definition flags.c:382
+ Here is the call graph for this function:

◆ op_display_address()

static int op_display_address ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Display full address of sender - Implements index_function_t -.

Definition at line 595 of file functions.c.

597{
598 if (!shared->email)
599 return FR_NO_ACTION;
601
602 return FR_SUCCESS;
603}
void mutt_display_address(struct Envelope *env)
Display the address of a message.
Definition external.c:663
+ Here is the call graph for this function:

◆ op_display_message()

static int op_display_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Display a message - Implements index_function_t -.

This function handles:

  • OP_DISPLAY_HEADERS
  • OP_DISPLAY_MESSAGE

Definition at line 612 of file functions.c.

614{
615 if (!shared->email)
616 return FR_NO_ACTION;
617
619
620 int op = event->op;
621 /* toggle the weeding of headers so that a user can press the key
622 * again while reading the message. */
623 if (op == OP_DISPLAY_HEADERS)
624 {
625 bool_str_toggle(shared->sub, "weed", NULL);
626 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, shared);
627 if (!window_is_focused(priv->win_index))
628 return FR_SUCCESS;
629 }
630
631 OptNeedResort = false;
632
633 if (mutt_using_threads() && shared->email->collapsed)
634 {
636 mutt_set_vnum(shared->mailbox);
637 const bool c_uncollapse_jump = cs_subset_bool(shared->sub, "uncollapse_jump");
638 if (c_uncollapse_jump)
640 }
641
642 const bool c_pgp_auto_decode = cs_subset_bool(shared->sub, "pgp_auto_decode");
643 if (c_pgp_auto_decode &&
644 (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED)))
645 {
646 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
647 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
648 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
650 ARRAY_FREE(&ea);
651 }
652 const int index = menu_get_index(priv->menu);
654
655 const char *const c_pager = pager_get_pager(NeoMutt->sub);
656 if (c_pager)
657 {
658 op = external_pager(shared->mailbox_view, shared->email, c_pager);
659 }
660 else
661 {
662 op = mutt_display_message(priv->win_index, shared);
663 }
664
666 if (op < OP_NULL)
667 {
668 OptNeedResort = false;
669 return FR_ERROR;
670 }
671
672 if (shared->mailbox)
673 {
675 shared->mailbox->msg_count, shared);
676 }
677
678 return op;
679}
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
Definition bool.c:229
@ CMD_MESSAGE_HOOK
:message-hook
Definition command.h:94
void update_index(struct Menu *menu, struct MailboxView *mv, enum MxStatus check, int oldcount, const struct IndexSharedData *shared)
Update the index.
Definition dlg_index.c:541
bool OptNeedResort
(pseudo) used to force a re-sort
Definition globals.c:52
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition thread.c:1402
#define mutt_thread_next_unread(e)
Definition thread.h:110
#define mutt_using_threads()
Definition thread.h:113
#define mutt_uncollapse_thread(e)
Definition thread.h:107
void exec_message_hook(struct Mailbox *m, struct Email *e, enum CommandId id)
Perform a message hook.
Definition exec.c:135
#define NT_INDEX_EMAIL
Email has changed.
Definition lib.h:76
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:164
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:178
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:415
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition mxapi.h:62
@ NT_INDEX
Index data has changed, NotifyIndex, IndexSharedData.
Definition notify_type.h:48
const char * pager_get_pager(struct ConfigSubset *sub)
Get the value of $pager.
Definition config.c:111
int mutt_display_message(struct MuttWindow *win_index, struct IndexSharedData *shared)
Display a message in the pager.
Definition message.c:444
int external_pager(struct MailboxView *mv, struct Email *e, const char *command)
Display a message in an external program.
Definition message.c:296
bool collapsed
Is this message part of a collapsed thread?
Definition email.h:120
struct MuttWindow * win_index
Window for the Index.
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition shared_data.h:44
int msg_count
Total number of messages.
Definition mailbox.h:87
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
+ Here is the call graph for this function:

◆ op_edit_label()

static int op_edit_label ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Add, change, or delete a message's label - Implements index_function_t -.

Definition at line 684 of file functions.c.

686{
687 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
688 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
689 int num_changed = mutt_label_message(shared->mailbox_view, &ea);
690 ARRAY_FREE(&ea);
691
692 if (num_changed > 0)
693 {
694 shared->mailbox->changed = true;
696 /* L10N: This is displayed when the x-label on one or more
697 messages is edited. */
698 mutt_message(ngettext("%d label changed", "%d labels changed", num_changed), num_changed);
699
700 if (!priv->tag_prefix)
702 return FR_SUCCESS;
703 }
704
705 /* L10N: This is displayed when editing an x-label, but no messages
706 were updated. Possibly due to canceling at the prompt or if the new
707 label is the same as the old label. */
708 mutt_message(_("No labels changed"));
709 return FR_NO_ACTION;
710}
int mutt_label_message(struct MailboxView *mv, struct EmailArray *ea)
Let the user label a message.
Definition header.c:130
#define mutt_message(...)
Definition logging2.h:93
bool changed
Mailbox has been modified.
Definition mailbox.h:109
+ Here is the call graph for this function:

◆ op_edit_raw_message()

static int op_edit_raw_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Edit the raw message (edit and edit-raw-message are synonyms) - Implements index_function_t -.

This function handles:

  • OP_EDIT_OR_VIEW_RAW_MESSAGE
  • OP_EDIT_RAW_MESSAGE
  • OP_VIEW_RAW_MESSAGE

Definition at line 720 of file functions.c.

722{
723 /* TODO split this into 3 cases? */
724 bool edit;
725 const int op = event->op;
726 if (op == OP_EDIT_RAW_MESSAGE)
727 {
728 /* L10N: CHECK_ACL */
729 if (!check_acl(shared->mailbox, MUTT_ACL_INSERT, _("Can't edit message")))
730 return FR_ERROR;
731 edit = true;
732 }
733 else if (op == OP_EDIT_OR_VIEW_RAW_MESSAGE)
734 {
735 edit = !shared->mailbox->readonly && (shared->mailbox->rights & MUTT_ACL_INSERT);
736 }
737 else
738 {
739 edit = false;
740 }
741
742 if (!shared->email)
743 return FR_NO_ACTION;
744 const bool c_pgp_auto_decode = cs_subset_bool(shared->sub, "pgp_auto_decode");
745 if (c_pgp_auto_decode &&
746 (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED)))
747 {
748 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
749 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
750 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
752 ARRAY_FREE(&ea);
753 }
754 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
755 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
756 mutt_ev_message(shared->mailbox, &ea, edit ? EVM_EDIT : EVM_VIEW);
757 ARRAY_FREE(&ea);
759
760 return FR_SUCCESS;
761}
#define MUTT_ACL_INSERT
Add/copy into the mailbox (used when editing a message)
Definition mailbox.h:65
int mutt_ev_message(struct Mailbox *m, struct EmailArray *ea, enum EvMessage action)
Edit or view a message.
Definition editmsg.c:282
@ EVM_VIEW
View the message.
Definition mutt.h:76
@ EVM_EDIT
Edit the message.
Definition mutt.h:77
AclFlags rights
ACL bits, see AclFlags.
Definition mailbox.h:118
bool readonly
Don't allow changes to the mailbox.
Definition mailbox.h:115
+ Here is the call graph for this function:

◆ op_end_cond()

static int op_end_cond ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

End of conditional execution (noop) - Implements index_function_t -.

Definition at line 766 of file functions.c.

768{
769 return FR_SUCCESS;
770}

◆ op_exit()

static int op_exit ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Exit this menu - Implements index_function_t -.

Definition at line 775 of file functions.c.

777{
778 if (shared->attach_msg)
779 return FR_DONE;
780
781 if (query_quadoption(_("Exit NeoMutt without saving?"), shared->sub, "quit") == MUTT_YES)
782 {
783 if (shared->mailbox_view)
784 {
785 mx_fastclose_mailbox(shared->mailbox, false);
786 mview_free(&shared->mailbox_view);
787 }
788 return FR_DONE;
789 }
790
791 return FR_NO_ACTION;
792}
@ FR_DONE
Exit the Dialog.
Definition dispatcher.h:36
void mview_free(struct MailboxView **ptr)
Free a MailboxView.
Definition mview.c:47
void mx_fastclose_mailbox(struct Mailbox *m, bool keep_account)
Free up memory associated with the Mailbox.
Definition mx.c:411
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
Definition question.c:378
bool attach_msg
Are we in "attach message" mode?
Definition shared_data.h:46
+ Here is the call graph for this function:

◆ op_extract_keys()

static int op_extract_keys ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Extract supported public keys - Implements index_function_t -.

Definition at line 797 of file functions.c.

799{
800 if (!WithCrypto)
801 return FR_NOT_IMPL;
802 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
803 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
805 ARRAY_FREE(&ea);
807
808 return FR_SUCCESS;
809}
void crypt_extract_keys_from_messages(struct Mailbox *m, struct EmailArray *ea)
Extract keys from a message.
Definition crypt.c:858
+ Here is the call graph for this function:

◆ op_flag_message()

static int op_flag_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Toggle a message's 'important' flag - Implements index_function_t -.

Definition at line 814 of file functions.c.

816{
817 /* L10N: CHECK_ACL */
818 if (!check_acl(shared->mailbox, MUTT_ACL_WRITE, _("Can't flag message")))
819 return FR_ERROR;
820
821 struct Mailbox *m = shared->mailbox;
822 if (priv->tag_prefix)
823 {
824 for (size_t i = 0; i < m->msg_count; i++)
825 {
826 struct Email *e = m->emails[i];
827 if (!e)
828 break;
829 if (message_is_tagged(e))
830 mutt_set_flag(m, e, MUTT_FLAG, !e->flagged, true);
831 }
832
834 }
835 else
836 {
837 if (!shared->email)
838 return FR_NO_ACTION;
839 mutt_set_flag(m, shared->email, MUTT_FLAG, !shared->email->flagged, true);
840
842 }
843
844 return FR_SUCCESS;
845}
#define MUTT_ACL_WRITE
Write to a message (for flagging or linking threads)
Definition mailbox.h:70
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition flags.c:54
@ MUTT_FLAG
Flagged messages.
Definition mutt.h:98
bool message_is_tagged(struct Email *e)
Is a message in the index tagged (and within limit)
Definition mview.c:361
The envelope/body of an email.
Definition email.h:39
bool flagged
Marked important?
Definition email.h:47
A mailbox.
Definition mailbox.h:78
struct Email ** emails
Array of Emails.
Definition mailbox.h:95
+ Here is the call graph for this function:

◆ op_forget_passphrase()

static int op_forget_passphrase ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Wipe passphrases from memory - Implements index_function_t -.

Definition at line 850 of file functions.c.

852{
854 return FR_SUCCESS;
855}
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition crypt.c:89
+ Here is the call graph for this function:

◆ op_forward_message()

static int op_forward_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Forward a message with comments - Implements index_function_t -.

Definition at line 860 of file functions.c.

862{
863 if (!shared->email)
864 return FR_NO_ACTION;
865 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
866 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
867 const bool c_pgp_auto_decode = cs_subset_bool(shared->sub, "pgp_auto_decode");
868 if (c_pgp_auto_decode &&
869 (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED)))
870 {
871 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
873 }
874 int rc = mutt_send_message(SEND_FORWARD, NULL, NULL, shared->mailbox, &ea,
875 shared->sub);
876 ARRAY_FREE(&ea);
878
879 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
880}
#define SEND_FORWARD
Forward email.
Definition send.h:45
+ Here is the call graph for this function:

◆ op_group_reply()

static int op_group_reply ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Reply to all recipients - Implements index_function_t -.

This function handles:

  • OP_GROUP_CHAT_REPLY
  • OP_GROUP_REPLY

Definition at line 889 of file functions.c.

891{
892 SendFlags replyflags = SEND_REPLY;
893 if (event->op == OP_GROUP_REPLY)
894 replyflags |= SEND_GROUP_REPLY;
895 else
896 replyflags |= SEND_GROUP_CHAT_REPLY;
897 if (!shared->email)
898 return FR_NO_ACTION;
899 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
900 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
901 const bool c_pgp_auto_decode = cs_subset_bool(shared->sub, "pgp_auto_decode");
902 if (c_pgp_auto_decode &&
903 (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED)))
904 {
905 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
907 }
908 int rc = mutt_send_message(replyflags, NULL, NULL, shared->mailbox, &ea,
909 shared->sub);
910 ARRAY_FREE(&ea);
912
913 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
914}
#define SEND_GROUP_CHAT_REPLY
Reply to all recipients preserving To/Cc.
Definition send.h:54
uint32_t SendFlags
Flags for mutt_send_message(), e.g. SEND_REPLY.
Definition send.h:40
#define SEND_GROUP_REPLY
Reply to all.
Definition send.h:43
#define SEND_REPLY
Reply to sender.
Definition send.h:42
+ Here is the call graph for this function:

◆ op_jump()

static int op_jump ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Jump to an index number - Implements index_function_t -.

Definition at line 919 of file functions.c.

921{
922 int rc = FR_ERROR;
923 struct Buffer *buf = buf_pool_get();
924
925 const int digit = event->op - OP_JUMP;
926 if ((digit > 0) && (digit < 10))
927 {
928 mutt_unget_ch('0' + digit);
929 }
930
931 int msg_num = 0;
932 if ((mw_get_field(_("Jump to message: "), buf, MUTT_COMP_NO_FLAGS, HC_OTHER, NULL, NULL) != 0) ||
933 buf_is_empty(buf))
934 {
935 mutt_message(_("Nothing to do"));
936 rc = FR_NO_ACTION;
937 }
938 else if (!mutt_str_atoi_full(buf_string(buf), &msg_num))
939 {
940 mutt_warning(_("Argument must be a message number"));
941 }
942 else if ((msg_num < 1) || (msg_num > shared->mailbox->msg_count))
943 {
944 mutt_warning(_("Invalid message number"));
945 }
946 else if (!shared->mailbox->emails[msg_num - 1] ||
947 !shared->mailbox->emails[msg_num - 1]->visible)
948 {
949 mutt_warning(_("That message is not visible"));
950 }
951 else
952 {
953 struct Email *e = shared->mailbox->emails[msg_num - 1];
954
955 if (mutt_messages_in_thread(shared->mailbox, e, MIT_POSITION) > 1)
956 {
958 mutt_set_vnum(shared->mailbox);
959 }
960 menu_set_index(priv->menu, e->vnum);
961 rc = FR_SUCCESS;
962 }
963
964 buf_pool_release(&buf);
965 return rc;
966}
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:291
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
int digit(const char *s)
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition wdata.h:42
void mutt_unget_ch(int ch)
Return a keystroke to the input buffer.
Definition get.c:122
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
Definition window.c:270
#define mutt_warning(...)
Definition logging2.h:92
int mutt_messages_in_thread(struct Mailbox *m, struct Email *e, enum MessageInThread mit)
Count the messages in a thread.
Definition thread.c:1655
@ MIT_POSITION
Our position in the thread.
Definition thread.h:89
@ HC_OTHER
Miscellaneous strings.
Definition lib.h:60
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
String manipulation buffer.
Definition buffer.h:36
bool visible
Is this message part of the view?
Definition email.h:121
int vnum
Virtual message number.
Definition email.h:114
+ Here is the call graph for this function:

◆ op_list_reply()

static int op_list_reply ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Reply to specified mailing list - Implements index_function_t -.

Definition at line 971 of file functions.c.

973{
974 if (!shared->email)
975 return FR_NO_ACTION;
976 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
977 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
978 const bool c_pgp_auto_decode = cs_subset_bool(shared->sub, "pgp_auto_decode");
979 if (c_pgp_auto_decode &&
980 (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED)))
981 {
982 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
984 }
985 int rc = mutt_send_message(SEND_REPLY | SEND_LIST_REPLY, NULL, NULL,
986 shared->mailbox, &ea, shared->sub);
987 ARRAY_FREE(&ea);
989
990 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
991}
#define SEND_LIST_REPLY
Reply to mailing list.
Definition send.h:44
+ Here is the call graph for this function:

◆ op_list_subscribe()

static int op_list_subscribe ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Subscribe to a mailing list - Implements index_function_t -.

Definition at line 996 of file functions.c.

998{
999 return mutt_send_list_subscribe(shared->mailbox, shared->email) ? FR_SUCCESS : FR_NO_ACTION;
1000}
bool mutt_send_list_subscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list subscription email.
Definition send.c:2955
+ Here is the call graph for this function:

◆ op_list_unsubscribe()

static int op_list_unsubscribe ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Unsubscribe from mailing list - Implements index_function_t -.

Definition at line 1005 of file functions.c.

1007{
1008 return mutt_send_list_unsubscribe(shared->mailbox, shared->email) ? FR_SUCCESS : FR_NO_ACTION;
1009}
bool mutt_send_list_unsubscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list unsubscription email.
Definition send.c:2984
+ Here is the call graph for this function:

◆ op_mail()

static int op_mail ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Compose a new mail message - Implements index_function_t -.

Definition at line 1014 of file functions.c.

1016{
1017 int rc = mutt_send_message(SEND_NO_FLAGS, NULL, NULL, shared->mailbox, NULL,
1018 shared->sub);
1020 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
1021}
#define SEND_NO_FLAGS
No flags are set.
Definition send.h:41
+ Here is the call graph for this function:

◆ op_mailbox_list()

static int op_mailbox_list ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

List mailboxes with new mail - Implements index_function_t -.

Definition at line 1026 of file functions.c.

1028{
1030 return FR_SUCCESS;
1031}
bool mutt_mailbox_list(void)
Show a message with the list of mailboxes with new mail.
+ Here is the call graph for this function:

◆ op_mail_key()

static int op_mail_key ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Mail a PGP public key - Implements index_function_t -.

Definition at line 1036 of file functions.c.

1038{
1039 if (!(WithCrypto & APPLICATION_PGP))
1040 return FR_NOT_IMPL;
1041 int rc = mutt_send_message(SEND_KEY, NULL, NULL, NULL, NULL, shared->sub);
1043
1044 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
1045}
#define SEND_KEY
Mail a PGP public key.
Definition send.h:48
+ Here is the call graph for this function:

◆ op_main_break_thread()

static int op_main_break_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Break the thread in two - Implements index_function_t -.

Definition at line 1050 of file functions.c.

1052{
1053 struct Mailbox *m = shared->mailbox;
1054 /* L10N: CHECK_ACL */
1055 if (!check_acl(m, MUTT_ACL_WRITE, _("Can't break thread")))
1056 return FR_ERROR;
1057
1058 struct Email *e = shared->email;
1059 if (!e)
1060 return FR_NO_ACTION;
1061
1062 if (!mutt_using_threads())
1063 {
1064 mutt_warning(_("Threading is not enabled"));
1065 return FR_NO_ACTION;
1066 }
1067
1068 struct MailboxView *mv = shared->mailbox_view;
1070 {
1071 {
1073 mutt_sort_headers(mv, true);
1074 menu_set_index(priv->menu, e->vnum);
1075 }
1076
1077 m->changed = true;
1078 mutt_message(_("Thread broken"));
1079
1081 }
1082 else
1083 {
1084 mutt_error(_("Thread can't be broken, message is not part of a thread"));
1085 }
1086
1087 return FR_SUCCESS;
1088}
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Definition sort.c:354
void mutt_break_thread(struct Email *e)
Break the email Thread.
Definition thread.c:229
#define mutt_error(...)
Definition logging2.h:94
#define STAILQ_EMPTY(head)
Definition queue.h:382
struct ListHead references
message references (in reverse order)
Definition envelope.h:83
struct ListHead in_reply_to
in-reply-to header content
Definition envelope.h:84
View of a Mailbox.
Definition mview.h:40
+ Here is the call graph for this function:

◆ op_main_change_folder()

static int op_main_change_folder ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Open a different folder - Implements index_function_t -.

This function handles:

  • OP_MAIN_CHANGE_FOLDER
  • OP_MAIN_CHANGE_FOLDER_READONLY
  • OP_MAIN_CHANGE_VFOLDER

Definition at line 1098 of file functions.c.

1100{
1101 struct Buffer *folderbuf = buf_pool_get();
1102 buf_alloc(folderbuf, PATH_MAX);
1103
1104 char *cp = NULL;
1105 bool read_only;
1106 const bool c_read_only = cs_subset_bool(shared->sub, "read_only");
1107 const int op = event->op;
1108 if (shared->attach_msg || c_read_only || (op == OP_MAIN_CHANGE_FOLDER_READONLY))
1109 {
1110 cp = _("Open mailbox in read-only mode");
1111 read_only = true;
1112 }
1113 else
1114 {
1115 cp = _("Open mailbox");
1116 read_only = false;
1117 }
1118
1119 const bool c_change_folder_next = cs_subset_bool(shared->sub, "change_folder_next");
1120 if (c_change_folder_next && shared->mailbox && !buf_is_empty(&shared->mailbox->pathbuf))
1121 {
1122 buf_strcpy(folderbuf, mailbox_path(shared->mailbox));
1123 pretty_mailbox(folderbuf);
1124 }
1125 /* By default, fill buf with the next mailbox that contains unread mail */
1126 mutt_mailbox_next(shared->mailbox_view ? shared->mailbox : NULL, folderbuf);
1127
1128 if (mw_enter_fname(cp, folderbuf, true, shared->mailbox, false, NULL, NULL,
1129 MUTT_SEL_NO_FLAGS) == -1)
1130 {
1131 goto changefoldercleanup;
1132 }
1133
1134 /* Selected directory is okay, let's save it. */
1136
1137 if (buf_is_empty(folderbuf))
1138 {
1139 msgwin_clear_text(NULL);
1140 goto changefoldercleanup;
1141 }
1142
1143 struct Mailbox *m = mx_mbox_find2(buf_string(folderbuf));
1144 if (m)
1145 {
1146 change_folder_mailbox(priv->menu, m, &priv->oldcount, shared, read_only);
1147 }
1148 else
1149 {
1150 change_folder_string(priv->menu, folderbuf, &priv->oldcount, shared, read_only);
1151 }
1152
1153changefoldercleanup:
1154 buf_pool_release(&folderbuf);
1156
1157 return FR_SUCCESS;
1158}
#define MUTT_SEL_NO_FLAGS
No flags are set.
Definition lib.h:58
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:395
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition buffer.c:337
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition mailbox.h:213
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
void change_folder_mailbox(struct Menu *menu, struct Mailbox *m, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Mailbox by pointer.
Definition dlg_index.c:610
void change_folder_string(struct Menu *menu, struct Buffer *buf, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Mailbox by string.
Definition dlg_index.c:756
int mw_enter_fname(const char *prompt, struct Buffer *fname, bool mailbox, struct Mailbox *m, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file -.
Definition curs_lib.c:236
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition msgwin.c:518
#define PATH_MAX
Definition mutt.h:49
struct Mailbox * mutt_mailbox_next(struct Mailbox *m_cur, struct Buffer *s)
Incoming folders completion routine.
void pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition muttlib.c:427
struct Mailbox * mx_mbox_find2(const char *path)
Find a Mailbox on an Account.
Definition mx.c:1615
int oldcount
Old count of mails in the mailbox.
struct Buffer pathbuf
Path of the Mailbox.
Definition mailbox.h:79
+ Here is the call graph for this function:

◆ op_main_collapse_all()

static int op_main_collapse_all ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Collapse/uncollapse all threads - Implements index_function_t -.

Definition at line 1163 of file functions.c.

1165{
1166 if (!mutt_using_threads())
1167 {
1168 mutt_error(_("Threading is not enabled"));
1169 return FR_ERROR;
1170 }
1171 collapse_all(shared->mailbox_view, priv->menu, 1);
1172 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1173
1174 return FR_SUCCESS;
1175}
void collapse_all(struct MailboxView *mv, struct Menu *menu, int toggle)
Collapse/uncollapse all threads.
Definition dlg_index.c:162
+ Here is the call graph for this function:

◆ op_main_collapse_thread()

static int op_main_collapse_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Collapse/uncollapse current thread - Implements index_function_t -.

Definition at line 1180 of file functions.c.

1183{
1184 if (!mutt_using_threads())
1185 {
1186 mutt_error(_("Threading is not enabled"));
1187 return FR_ERROR;
1188 }
1189
1190 if (!shared->email)
1191 return FR_NO_ACTION;
1192
1193 if (shared->email->collapsed)
1194 {
1195 int index = mutt_uncollapse_thread(shared->email);
1196 mutt_set_vnum(shared->mailbox);
1197 const bool c_uncollapse_jump = cs_subset_bool(shared->sub, "uncollapse_jump");
1198 if (c_uncollapse_jump)
1199 index = mutt_thread_next_unread(shared->email);
1200 menu_set_index(priv->menu, index);
1201 }
1202 else if (mutt_thread_can_collapse(shared->email))
1203 {
1205 mutt_set_vnum(shared->mailbox);
1206 }
1207 else
1208 {
1209 mutt_error(_("Thread contains unread or flagged messages"));
1210 return FR_ERROR;
1211 }
1212
1214 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1215
1216 return FR_SUCCESS;
1217}
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
Definition thread.c:1815
#define mutt_collapse_thread(e)
Definition thread.h:106
+ Here is the call graph for this function:

◆ op_main_delete_pattern()

static int op_main_delete_pattern ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Delete messages matching a pattern - Implements index_function_t -.

Definition at line 1222 of file functions.c.

1224{
1225 /* L10N: CHECK_ACL */
1226 /* L10N: Due to the implementation details we do not know whether we
1227 delete zero, 1, 12, ... messages. So in English we use
1228 "messages". Your language might have other means to express this. */
1229 if (!check_acl(shared->mailbox, MUTT_ACL_DELETE, _("Can't delete messages")))
1230 return FR_ERROR;
1231
1232 mutt_pattern_func(shared->mailbox_view, MUTT_DELETE, _("Delete messages matching: "));
1234
1235 return FR_SUCCESS;
1236}
int mutt_pattern_func(struct MailboxView *mv, int op, char *prompt)
Perform some Pattern matching.
Definition pattern.c:307
+ Here is the call graph for this function:

◆ op_main_limit()

static int op_main_limit ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Limit view to a pattern/thread - Implements index_function_t -.

This function handles:

  • OP_LIMIT_CURRENT_THREAD
  • OP_MAIN_LIMIT
  • OP_TOGGLE_READ

Definition at line 1246 of file functions.c.

1248{
1249 const bool lmt = mview_has_limit(shared->mailbox_view);
1250 int old_index = shared->email ? shared->email->index : -1;
1251 const int op = event->op;
1252 if (op == OP_TOGGLE_READ)
1253 {
1254 struct Buffer *buf2 = buf_pool_get();
1255
1256 if (!lmt || !mutt_strn_equal(shared->mailbox_view->pattern, "!~R!~D~s", 8))
1257 {
1258 buf_printf(buf2, "!~R!~D~s%s", lmt ? shared->mailbox_view->pattern : ".*");
1259 }
1260 else
1261 {
1262 const char *pat = shared->mailbox_view->pattern + 8;
1263 if ((*pat == '\0') || mutt_strn_equal(pat, ".*", 2))
1264 buf_strcpy(buf2, "~A");
1265 else
1266 buf_strcpy(buf2, pat);
1267 }
1269 buf_pool_release(&buf2);
1271 }
1272
1273 if (((op == OP_LIMIT_CURRENT_THREAD) &&
1274 mutt_limit_current_thread(shared->mailbox_view, shared->email)) ||
1275 (op == OP_TOGGLE_READ) ||
1276 ((op == OP_MAIN_LIMIT) && (mutt_pattern_func(shared->mailbox_view, MUTT_LIMIT,
1277 _("Limit to messages matching: ")) == 0)))
1278 {
1279 priv->menu->max = shared->mailbox->vcount;
1280 menu_set_index(priv->menu, 0);
1281 if (old_index >= 0)
1282 {
1283 /* try to find what used to be the current message */
1284 for (size_t i = 0; i < shared->mailbox->vcount; i++)
1285 {
1286 struct Email *e = mutt_get_virt_email(shared->mailbox, i);
1287 if (!e)
1288 continue;
1289 if (e->index == old_index)
1290 {
1291 menu_set_index(priv->menu, i);
1292 break;
1293 }
1294 }
1295 }
1296
1297 if ((shared->mailbox->msg_count != 0) && mutt_using_threads())
1298 {
1299 const bool c_collapse_all = cs_subset_bool(shared->sub, "collapse_all");
1300 if (c_collapse_all)
1301 collapse_all(shared->mailbox_view, priv->menu, 0);
1303 }
1304 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1306 }
1307 if (lmt)
1308 mutt_message(_("To view all messages, limit to \"all\""));
1309
1310 return FR_SUCCESS;
1311}
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
void mutt_draw_tree(struct ThreadsContext *tctx)
Draw a tree of threaded emails.
Definition thread.c:390
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition string.c:429
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
@ MUTT_LIMIT
Messages in limited view.
Definition mutt.h:101
bool mutt_limit_current_thread(struct MailboxView *mv, struct Email *e)
Limit the email view to the current thread.
Definition mview.c:478
bool mview_has_limit(const struct MailboxView *mv)
Is a limit active?
Definition mview.c:436
int index
The absolute (unsorted) message number.
Definition email.h:110
struct ThreadsContext * threads
Threads context.
Definition mview.h:44
char * pattern
Limit pattern string.
Definition mview.h:42
int vcount
The number of virtual messages.
Definition mailbox.h:98
int max
Number of entries in the menu.
Definition lib.h:82
+ Here is the call graph for this function:

◆ op_main_link_threads()

static int op_main_link_threads ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Link tagged message to the current one - Implements index_function_t -.

Definition at line 1316 of file functions.c.

1318{
1319 struct Mailbox *m = shared->mailbox;
1320 /* L10N: CHECK_ACL */
1321 if (!check_acl(m, MUTT_ACL_WRITE, _("Can't link threads")))
1322 return FR_ERROR;
1323
1324 struct Email *e = shared->email;
1325 if (!e)
1326 return FR_NO_ACTION;
1327
1328 enum FunctionRetval rc = FR_ERROR;
1329
1330 if (!mutt_using_threads())
1331 {
1332 mutt_error(_("Threading is not enabled"));
1333 }
1334 else if (!e->env->message_id)
1335 {
1336 mutt_error(_("No Message-ID: header available to link thread"));
1337 }
1338 else
1339 {
1340 struct MailboxView *mv = shared->mailbox_view;
1341 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
1342 ea_add_tagged(&ea, mv, NULL, true);
1343
1344 if (mutt_link_threads(e, &ea, m))
1345 {
1346 mutt_sort_headers(mv, true);
1347 menu_set_index(priv->menu, e->vnum);
1348
1349 m->changed = true;
1350 mutt_message(_("Threads linked"));
1351 rc = FR_SUCCESS;
1352 }
1353 else
1354 {
1355 mutt_error(_("No thread linked"));
1356 rc = FR_NO_ACTION;
1357 }
1358
1359 ARRAY_FREE(&ea);
1360 }
1361
1363 return rc;
1364}
FunctionRetval
Possible return values for NeoMutt functions.
Definition dispatcher.h:33
bool mutt_link_threads(struct Email *parent, struct EmailArray *children, struct Mailbox *m)
Forcibly link threads together.
Definition thread.c:1745
char * message_id
Message ID.
Definition envelope.h:73
+ Here is the call graph for this function:

◆ op_main_modify_tags()

static int op_main_modify_tags ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Modify (notmuch/imap) tags - Implements index_function_t -.

This function handles:

  • OP_MAIN_MODIFY_TAGS
  • OP_MAIN_MODIFY_TAGS_THEN_HIDE

Definition at line 1373 of file functions.c.

1375{
1376 int rc = FR_ERROR;
1377 struct Buffer *buf = NULL;
1378
1379 if (!shared->mailbox)
1380 goto done;
1381 struct Mailbox *m = shared->mailbox;
1382 if (!mx_tags_is_supported(m))
1383 {
1384 mutt_message(_("Folder doesn't support tagging, aborting"));
1385 goto done;
1386 }
1387 if (!shared->email)
1388 {
1389 rc = FR_NO_ACTION;
1390 goto done;
1391 }
1392
1393 const int op = event->op;
1394 struct Buffer *tags = buf_pool_get();
1395 if (!priv->tag_prefix)
1396 driver_tags_get_with_hidden(&shared->email->tags, tags);
1397 buf = buf_pool_get();
1398 int rc2 = mx_tags_edit(m, buf_string(tags), buf);
1399 buf_pool_release(&tags);
1400 if (rc2 < 0)
1401 {
1402 goto done;
1403 }
1404 else if (rc2 == 0)
1405 {
1406 mutt_message(_("No tag specified, aborting"));
1407 goto done;
1408 }
1409
1410 if (priv->tag_prefix)
1411 {
1412 struct Progress *progress = NULL;
1413
1414 if (m->verbose)
1415 {
1417 progress_set_message(progress, _("Update tags..."));
1418 }
1419
1420#ifdef USE_NOTMUCH
1421 if (m->type == MUTT_NOTMUCH)
1422 nm_db_longrun_init(m, true);
1423#endif
1424 for (int px = 0, i = 0; i < m->msg_count; i++)
1425 {
1426 struct Email *e = m->emails[i];
1427 if (!e)
1428 break;
1429 if (!message_is_tagged(e))
1430 continue;
1431
1432 progress_update(progress, ++px, -1);
1433 mx_tags_commit(m, e, buf_string(buf));
1434 e->attr_color = NULL;
1435 if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
1436 {
1437 bool still_queried = false;
1438#ifdef USE_NOTMUCH
1439 if (m->type == MUTT_NOTMUCH)
1440 still_queried = nm_message_is_still_queried(m, e);
1441#endif
1442 e->quasi_deleted = !still_queried;
1443 m->changed = true;
1444 }
1445 }
1446 progress_free(&progress);
1447#ifdef USE_NOTMUCH
1448 if (m->type == MUTT_NOTMUCH)
1450#endif
1452 }
1453 else
1454 {
1455 if (mx_tags_commit(m, shared->email, buf_string(buf)))
1456 {
1457 mutt_message(_("Failed to modify tags, aborting"));
1458 goto done;
1459 }
1460 shared->email->attr_color = NULL;
1461 if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
1462 {
1463 bool still_queried = false;
1464#ifdef USE_NOTMUCH
1465 if (m->type == MUTT_NOTMUCH)
1466 still_queried = nm_message_is_still_queried(m, shared->email);
1467#endif
1468 shared->email->quasi_deleted = !still_queried;
1469 m->changed = true;
1470 }
1471
1473 }
1474 rc = FR_SUCCESS;
1475
1476done:
1477 buf_pool_release(&buf);
1478 return rc;
1479}
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition mailbox.h:50
int mx_tags_edit(struct Mailbox *m, const char *tags, struct Buffer *buf)
Start the tag editor of the mailbox.
Definition mx.c:1276
bool mx_tags_is_supported(struct Mailbox *m)
Return true if mailbox support tagging.
Definition mx.c:1313
int mx_tags_commit(struct Mailbox *m, struct Email *e, const char *tags)
Save tags to the Mailbox - Wrapper for MxOps::tags_commit()
Definition mx.c:1296
void nm_db_longrun_done(struct Mailbox *m)
Finish a long transaction.
Definition db.c:379
void nm_db_longrun_init(struct Mailbox *m, bool writable)
Start a long transaction.
Definition db.c:364
bool nm_message_is_still_queried(struct Mailbox *m, struct Email *e)
Is a message still visible in the query?
Definition notmuch.c:1734
@ MUTT_PROGRESS_WRITE
Progress tracks elements, according to $write_inc
Definition lib.h:85
struct Progress * progress_new(enum ProgressType type, size_t size)
Create a new Progress Bar.
Definition progress.c:139
void progress_free(struct Progress **ptr)
Free a Progress Bar.
Definition progress.c:110
void progress_set_message(struct Progress *progress, const char *fmt,...) __attribute__((__format__(__printf__
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
Definition progress.c:80
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition email.h:112
struct TagList tags
For drivers that support server tagging.
Definition email.h:72
bool quasi_deleted
Deleted from neomutt, but not modified on disk.
Definition email.h:103
enum MailboxType type
Mailbox type.
Definition mailbox.h:101
int msg_tagged
How many messages are tagged?
Definition mailbox.h:93
bool verbose
Display status messages?
Definition mailbox.h:116
void driver_tags_get_with_hidden(struct TagList *tl, struct Buffer *tags)
Get all tags, also hidden ones, separated by space.
Definition tags.c:175
+ Here is the call graph for this function:

◆ op_main_next_new()

static int op_main_next_new ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Jump to the next new message - Implements index_function_t -.

This function handles:

  • OP_MAIN_NEXT_NEW
  • OP_MAIN_NEXT_NEW_THEN_UNREAD
  • OP_MAIN_NEXT_UNREAD
  • OP_MAIN_PREV_NEW
  • OP_MAIN_PREV_NEW_THEN_UNREAD
  • OP_MAIN_PREV_UNREAD

Definition at line 1492 of file functions.c.

1494{
1495 int first_unread = -1;
1496 int first_new = -1;
1497
1498 const int saved_current = menu_get_index(priv->menu);
1499 int mcur = saved_current;
1500 int index = -1;
1501 const bool threaded = mutt_using_threads();
1502 const int op = event->op;
1503 for (size_t i = 0; i != shared->mailbox->vcount; i++)
1504 {
1505 if ((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_NEXT_UNREAD) ||
1506 (op == OP_MAIN_NEXT_NEW_THEN_UNREAD))
1507 {
1508 mcur++;
1509 if (mcur > (shared->mailbox->vcount - 1))
1510 {
1511 mcur = 0;
1512 }
1513 }
1514 else
1515 {
1516 mcur--;
1517 if (mcur < 0)
1518 {
1519 mcur = shared->mailbox->vcount - 1;
1520 }
1521 }
1522
1523 struct Email *e = mutt_get_virt_email(shared->mailbox, mcur);
1524 if (!e)
1525 break;
1526 if (e->collapsed && threaded)
1527 {
1528 int unread = mutt_thread_contains_unread(e);
1529 if ((unread != 0) && (first_unread == -1))
1530 first_unread = mcur;
1531 if ((unread == 1) && (first_new == -1))
1532 first_new = mcur;
1533 }
1534 else if (!e->deleted && !e->read)
1535 {
1536 if (first_unread == -1)
1537 first_unread = mcur;
1538 if (!e->old && (first_new == -1))
1539 first_new = mcur;
1540 }
1541
1542 if (((op == OP_MAIN_NEXT_UNREAD) || (op == OP_MAIN_PREV_UNREAD)) && (first_unread != -1))
1543 {
1544 break;
1545 }
1546 if (((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_PREV_NEW) ||
1547 (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) || (op == OP_MAIN_PREV_NEW_THEN_UNREAD)) &&
1548 (first_new != -1))
1549 {
1550 break;
1551 }
1552 }
1553 if (((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_PREV_NEW) ||
1554 (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) || (op == OP_MAIN_PREV_NEW_THEN_UNREAD)) &&
1555 (first_new != -1))
1556 {
1557 index = first_new;
1558 }
1559 else if (((op == OP_MAIN_NEXT_UNREAD) || (op == OP_MAIN_PREV_UNREAD) ||
1560 (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) || (op == OP_MAIN_PREV_NEW_THEN_UNREAD)) &&
1561 (first_unread != -1))
1562 {
1563 index = first_unread;
1564 }
1565
1566 if (index == -1)
1567 {
1568 menu_set_index(priv->menu, saved_current);
1569 if ((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_PREV_NEW))
1570 {
1571 if (mview_has_limit(shared->mailbox_view))
1572 mutt_error(_("No new messages in this limited view"));
1573 else
1574 mutt_error(_("No new messages"));
1575 }
1576 else
1577 {
1578 if (mview_has_limit(shared->mailbox_view))
1579 mutt_error(_("No unread messages in this limited view"));
1580 else
1581 mutt_error(_("No unread messages"));
1582 }
1583 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1584 return FR_ERROR;
1585 }
1586 else
1587 {
1588 menu_set_index(priv->menu, index);
1589 }
1590
1591 index = menu_get_index(priv->menu);
1592 if ((op == OP_MAIN_NEXT_NEW) || (op == OP_MAIN_NEXT_UNREAD) ||
1593 (op == OP_MAIN_NEXT_NEW_THEN_UNREAD))
1594 {
1595 if (saved_current > index)
1596 {
1597 mutt_message(_("Search wrapped to top"));
1598 }
1599 }
1600 else if (saved_current < index)
1601 {
1602 mutt_message(_("Search wrapped to bottom"));
1603 }
1604
1605 return FR_SUCCESS;
1606}
#define mutt_thread_contains_unread(e)
Definition thread.h:108
bool read
Email is read.
Definition email.h:50
bool old
Email is seen, but unread.
Definition email.h:49
bool threaded
Used for threading.
Definition email.h:108
bool deleted
Email is deleted.
Definition email.h:78
+ Here is the call graph for this function:

◆ op_main_next_thread()

static int op_main_next_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Jump to the next thread - Implements index_function_t -.

This function handles:

  • OP_MAIN_NEXT_SUBTHREAD
  • OP_MAIN_NEXT_THREAD
  • OP_MAIN_PREV_SUBTHREAD
  • OP_MAIN_PREV_THREAD

Definition at line 1617 of file functions.c.

1619{
1620 int index = -1;
1621 const int op = event->op;
1622 switch (op)
1623 {
1624 case OP_MAIN_NEXT_THREAD:
1625 index = mutt_next_thread(shared->email);
1626 break;
1627
1628 case OP_MAIN_NEXT_SUBTHREAD:
1629 index = mutt_next_subthread(shared->email);
1630 break;
1631
1632 case OP_MAIN_PREV_THREAD:
1633 index = mutt_previous_thread(shared->email);
1634 break;
1635
1636 case OP_MAIN_PREV_SUBTHREAD:
1637 index = mutt_previous_subthread(shared->email);
1638 break;
1639 }
1640
1641 if (index != -1)
1642 menu_set_index(priv->menu, index);
1643
1644 if (index < 0)
1645 {
1646 if ((op == OP_MAIN_NEXT_THREAD) || (op == OP_MAIN_NEXT_SUBTHREAD))
1647 mutt_error(_("No more threads"));
1648 else
1649 mutt_error(_("You are on the first thread"));
1650
1651 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1652 }
1653
1654 return FR_SUCCESS;
1655}
#define mutt_previous_thread(e)
Definition thread.h:119
#define mutt_next_subthread(e)
Definition thread.h:120
#define mutt_previous_subthread(e)
Definition thread.h:121
#define mutt_next_thread(e)
Definition thread.h:118
+ Here is the call graph for this function:

◆ op_main_next_undeleted()

static int op_main_next_undeleted ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Move to the next undeleted message - Implements index_function_t -.

Definition at line 1660 of file functions.c.

1662{
1663 int index = menu_get_index(priv->menu);
1664 if (index >= (shared->mailbox->vcount - 1))
1665 {
1666 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1667 mutt_message(_("You are on the last message"));
1668 return FR_ERROR;
1669 }
1670
1671 const bool uncollapse = mutt_using_threads() && !window_is_focused(priv->win_index);
1672
1673 index = find_next_undeleted(shared->mailbox_view, index, uncollapse);
1674 if (index != -1)
1675 {
1676 menu_set_index(priv->menu, index);
1677 if (uncollapse)
1679 }
1680
1681 if (index == -1)
1682 {
1683 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1684 mutt_error(_("No undeleted messages"));
1685 }
1686
1687 return FR_SUCCESS;
1688}
int find_next_undeleted(struct MailboxView *mv, int msgno, bool uncollapse)
Find the next undeleted email.
Definition dlg_index.c:238
+ Here is the call graph for this function:

◆ op_main_next_unread_mailbox()

static int op_main_next_unread_mailbox ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Open next mailbox with unread mail - Implements index_function_t -.

Definition at line 1693 of file functions.c.

1696{
1697 struct Mailbox *m = shared->mailbox;
1698
1699 struct Buffer *folderbuf = buf_pool_get();
1700 buf_strcpy(folderbuf, mailbox_path(m));
1701 m = mutt_mailbox_next_unread(m, folderbuf);
1702 buf_pool_release(&folderbuf);
1703
1704 if (!m)
1705 {
1706 mutt_error(_("No mailboxes have new mail"));
1707 return FR_ERROR;
1708 }
1709
1710 change_folder_mailbox(priv->menu, m, &priv->oldcount, shared, false);
1711 return FR_SUCCESS;
1712}
struct Mailbox * mutt_mailbox_next_unread(struct Mailbox *m_cur, struct Buffer *s)
Find next mailbox with unread mail.
+ Here is the call graph for this function:

◆ op_main_prev_undeleted()

static int op_main_prev_undeleted ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Move to the previous undeleted message - Implements index_function_t -.

Definition at line 1717 of file functions.c.

1719{
1720 int index = menu_get_index(priv->menu);
1721 if (index < 1)
1722 {
1723 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1724 mutt_message(_("You are on the first message"));
1725 return FR_ERROR;
1726 }
1727
1728 const bool uncollapse = mutt_using_threads() && !window_is_focused(priv->win_index);
1729
1730 index = find_previous_undeleted(shared->mailbox_view, index, uncollapse);
1731 if (index != -1)
1732 {
1733 menu_set_index(priv->menu, index);
1734 if (uncollapse)
1736 }
1737
1738 if (index == -1)
1739 {
1740 mutt_error(_("No undeleted messages"));
1741 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
1742 }
1743
1744 return FR_SUCCESS;
1745}
int find_previous_undeleted(struct MailboxView *mv, int msgno, bool uncollapse)
Find the previous undeleted email.
Definition dlg_index.c:272
+ Here is the call graph for this function:

◆ op_main_quasi_delete()

static int op_main_quasi_delete ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Delete from NeoMutt, don't touch on disk - Implements index_function_t -.

Definition at line 1750 of file functions.c.

1752{
1753 if (priv->tag_prefix)
1754 {
1755 struct Mailbox *m = shared->mailbox;
1756 for (size_t i = 0; i < m->msg_count; i++)
1757 {
1758 struct Email *e = m->emails[i];
1759 if (!e)
1760 break;
1761 if (message_is_tagged(e))
1762 {
1763 e->quasi_deleted = true;
1764 m->changed = true;
1765 }
1766 }
1767 }
1768 else
1769 {
1770 if (!shared->email)
1771 return FR_NO_ACTION;
1772 shared->email->quasi_deleted = true;
1773 shared->mailbox->changed = true;
1774 }
1775
1776 return FR_SUCCESS;
1777}
+ Here is the call graph for this function:

◆ op_main_read_thread()

static int op_main_read_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Mark the current thread as read - Implements index_function_t -.

This function handles:

  • OP_MAIN_READ_SUBTHREAD
  • OP_MAIN_READ_THREAD

Definition at line 1786 of file functions.c.

1788{
1789 /* L10N: CHECK_ACL */
1790 /* L10N: Due to the implementation details we do not know whether we
1791 mark zero, 1, 12, ... messages as read. So in English we use
1792 "messages". Your language might have other means to express this. */
1793 if (!check_acl(shared->mailbox, MUTT_ACL_SEEN, _("Can't mark messages as read")))
1794 return FR_ERROR;
1795
1796 const int op = event->op;
1797 int rc = mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_READ, true,
1798 (op != OP_MAIN_READ_THREAD));
1799 if (rc != -1)
1800 {
1801 const enum ResolveMethod rm = (op == OP_MAIN_READ_THREAD) ? RESOLVE_NEXT_THREAD :
1803 resolve_email(priv, shared, rm);
1805 }
1806
1807 return FR_SUCCESS;
1808}
#define MUTT_ACL_SEEN
Change the 'seen' status of a message.
Definition mailbox.h:69
ResolveMethod
How to advance the cursor.
Definition functions.c:312
@ RESOLVE_NEXT_SUBTHREAD
Next sibling sub-thread.
Definition functions.c:316
@ RESOLVE_NEXT_THREAD
Next top-level thread.
Definition functions.c:315
@ MUTT_READ
Messages that have been read.
Definition mutt.h:92
+ Here is the call graph for this function:

◆ op_main_root_message()

static int op_main_root_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Jump to root message in thread - Implements index_function_t -.

This function handles:

  • OP_MAIN_PARENT_MESSAGE
  • OP_MAIN_ROOT_MESSAGE

Definition at line 1817 of file functions.c.

1819{
1820 int index = mutt_parent_message(shared->email, event->op == OP_MAIN_ROOT_MESSAGE);
1821 if (index != -1)
1822 menu_set_index(priv->menu, index);
1823
1824 return FR_SUCCESS;
1825}
int mutt_parent_message(struct Email *e, bool find_root)
Find the parent of a message.
Definition thread.c:1352
+ Here is the call graph for this function:

◆ op_main_set_flag()

static int op_main_set_flag ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Set a status flag on a message - Implements index_function_t -.

This function handles:

  • OP_MAIN_CLEAR_FLAG
  • OP_MAIN_SET_FLAG

Definition at line 1834 of file functions.c.

1836{
1837 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
1838 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
1839
1840 if (mw_change_flag(shared->mailbox, &ea, (event->op == OP_MAIN_SET_FLAG)) == 0)
1841 {
1842 if (priv->tag_prefix)
1843 {
1845 }
1846 else
1847 {
1849 }
1850 }
1851 ARRAY_FREE(&ea);
1852
1853 return FR_SUCCESS;
1854}
int mw_change_flag(struct Mailbox *m, struct EmailArray *ea, bool bf)
Change the flag on a Message -.
Definition flags.c:451
+ Here is the call graph for this function:

◆ op_main_show_limit()

static int op_main_show_limit ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Show currently active limit pattern - Implements index_function_t -.

Definition at line 1859 of file functions.c.

1861{
1862 if (mview_has_limit(shared->mailbox_view))
1863 {
1864 struct Buffer *buf = buf_pool_get();
1865 /* L10N: ask for a limit to apply */
1866 buf_printf(buf, _("Limit: %s"), shared->mailbox_view->pattern);
1867 mutt_message("%s", buf_string(buf));
1868 buf_pool_release(&buf);
1869 }
1870 else
1871 {
1872 mutt_message(_("No limit pattern is in effect"));
1873 }
1874
1875 return FR_SUCCESS;
1876}
+ Here is the call graph for this function:

◆ op_main_sync_folder()

static int op_main_sync_folder ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Save changes to mailbox - Implements index_function_t -.

Definition at line 1881 of file functions.c.

1883{
1884 if (!shared->mailbox || (shared->mailbox->msg_count == 0) || shared->mailbox->readonly)
1885 return FR_NO_ACTION;
1886
1887 int ovc = shared->mailbox->vcount;
1888 int oc = shared->mailbox->msg_count;
1889 struct Email *e = NULL;
1890
1891 /* don't attempt to move the cursor if there are no visible messages in the current limit */
1892 int index = menu_get_index(priv->menu);
1893 if (index < shared->mailbox->vcount)
1894 {
1895 /* threads may be reordered, so figure out what header the cursor
1896 * should be on. */
1897 int newidx = index;
1898 if (!shared->email)
1899 return FR_NO_ACTION;
1900 if (shared->email->deleted)
1901 newidx = find_next_undeleted(shared->mailbox_view, index, false);
1902 if (newidx < 0)
1903 newidx = find_previous_undeleted(shared->mailbox_view, index, false);
1904 if (newidx >= 0)
1905 e = mutt_get_virt_email(shared->mailbox, newidx);
1906 }
1907
1908 enum MxStatus check = mx_mbox_sync(shared->mailbox);
1909 if (check == MX_STATUS_OK)
1910 {
1911 if (e && (shared->mailbox->vcount != ovc))
1912 {
1913 for (size_t i = 0; i < shared->mailbox->vcount; i++)
1914 {
1915 struct Email *e2 = mutt_get_virt_email(shared->mailbox, i);
1916 if (e2 == e)
1917 {
1918 menu_set_index(priv->menu, i);
1919 break;
1920 }
1921 }
1922 }
1924 }
1925 else if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
1926 {
1927 update_index(priv->menu, shared->mailbox_view, check, oc, shared);
1928 }
1929
1930 /* do a sanity check even if mx_mbox_sync failed. */
1931
1932 index = menu_get_index(priv->menu);
1933 if ((index < 0) || (shared->mailbox && (index >= shared->mailbox->vcount)))
1934 {
1936 }
1937
1938 /* check for a fatal error, or all messages deleted */
1939 if (shared->mailbox && buf_is_empty(&shared->mailbox->pathbuf))
1940 {
1941 mview_free(&shared->mailbox_view);
1942 }
1943
1944 if (shared->mailbox)
1945 {
1946 priv->menu->max = shared->mailbox->vcount;
1948
1949 struct EventMailbox ev_m = { shared->mailbox };
1951 }
1952 else
1953 {
1954 priv->menu->max = 0;
1956 }
1957
1958 return FR_SUCCESS;
1959}
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
Definition compile.c:826
@ NT_MAILBOX_CHANGE
Mailbox has been changed.
Definition mailbox.h:175
int find_first_message(struct MailboxView *mv)
Get index of first new message.
Definition dlg_index.c:306
enum MxStatus mx_mbox_sync(struct Mailbox *m)
Save changes to mailbox.
Definition mx.c:903
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
Definition mxapi.h:59
@ MX_STATUS_OK
No changes.
Definition mxapi.h:61
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition mxapi.h:64
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition notify_type.h:49
An Event that happened to a Mailbox.
Definition mailbox.h:189
struct SearchState * search_state
State of the current search.
Definition shared_data.h:45
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
Definition mailbox.h:144
struct PatternList * pattern
compiled search pattern
+ Here is the call graph for this function:

◆ op_main_tag_pattern()

static int op_main_tag_pattern ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Tag messages matching a pattern - Implements index_function_t -.

Definition at line 1964 of file functions.c.

1966{
1967 mutt_pattern_func(shared->mailbox_view, MUTT_TAG, _("Tag messages matching: "));
1969
1970 return FR_SUCCESS;
1971}
+ Here is the call graph for this function:

◆ op_main_undelete_pattern()

static int op_main_undelete_pattern ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Undelete messages matching a pattern - Implements index_function_t -.

Definition at line 1976 of file functions.c.

1979{
1980 /* L10N: CHECK_ACL */
1981 /* L10N: Due to the implementation details we do not know whether we
1982 undelete zero, 1, 12, ... messages. So in English we use
1983 "messages". Your language might have other means to express this. */
1984 if (!check_acl(shared->mailbox, MUTT_ACL_DELETE, _("Can't undelete messages")))
1985 return FR_ERROR;
1986
1988 _("Undelete messages matching: ")) == 0)
1989 {
1991 }
1992
1993 return FR_SUCCESS;
1994}
@ MUTT_UNDELETE
Messages to be un-deleted.
Definition mutt.h:95
+ Here is the call graph for this function:

◆ op_main_untag_pattern()

static int op_main_untag_pattern ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Untag messages matching a pattern - Implements index_function_t -.

Definition at line 1999 of file functions.c.

2001{
2002 if (mutt_pattern_func(shared->mailbox_view, MUTT_UNTAG, _("Untag messages matching: ")) == 0)
2004
2005 return FR_SUCCESS;
2006}
@ MUTT_UNTAG
Messages to be un-tagged.
Definition mutt.h:100
+ Here is the call graph for this function:

◆ op_mark_msg()

static int op_mark_msg ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Create a hotkey macro for the current message - Implements index_function_t -.

Definition at line 2011 of file functions.c.

2013{
2014 if (!shared->email)
2015 return FR_NO_ACTION;
2016
2017 int rc = FR_SUCCESS;
2018
2019 if (shared->email->env->message_id)
2020 {
2021 struct Buffer *buf = buf_pool_get();
2022
2023 /* L10N: This is the prompt for <mark-message>. Whatever they
2024 enter will be prefixed by $mark_macro_prefix and will become
2025 a macro hotkey to jump to the currently selected message. */
2026 if ((mw_get_field(_("Enter macro stroke: "), buf, MUTT_COMP_NO_FLAGS,
2027 HC_OTHER, NULL, NULL) == 0) &&
2028 !buf_is_empty(buf))
2029 {
2030 const char *const c_mark_macro_prefix = cs_subset_string(shared->sub, "mark_macro_prefix");
2031 char str[256] = { 0 };
2032 snprintf(str, sizeof(str), "%s%s", c_mark_macro_prefix, buf_string(buf));
2033
2034 struct Buffer *msg_id = buf_pool_get();
2035 mutt_file_sanitize_regex(msg_id, shared->email->env->message_id);
2036 char macro[256] = { 0 };
2037 snprintf(macro, sizeof(macro), "<search>~i '%s'\n", buf_string(msg_id));
2038 buf_pool_release(&msg_id);
2039
2040 /* L10N: "message hotkey" is the key bindings menu description of a
2041 macro created by <mark-message>. */
2042 km_bind(MdIndex, str, OP_MACRO, macro, _("message hotkey"), NULL);
2043
2044 /* L10N: This is echoed after <mark-message> creates a new hotkey
2045 macro. %s is the hotkey string ($mark_macro_prefix followed
2046 by whatever they typed at the prompt.) */
2047 buf_printf(buf, _("Message bound to %s"), str);
2048 mutt_message("%s", buf_string(buf));
2049 mutt_debug(LL_DEBUG1, "Mark: %s => %s\n", str, macro);
2050 }
2051 buf_pool_release(&buf);
2052 }
2053 else
2054 {
2055 /* L10N: This error is printed if <mark-message> can't find a
2056 Message-ID for the currently selected message in the index. */
2057 mutt_error(_("No message ID to macro"));
2058 rc = FR_ERROR;
2059 }
2060
2061 return rc;
2062}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
int mutt_file_sanitize_regex(struct Buffer *dest, const char *src)
Escape any regex-magic characters in a string.
Definition file.c:628
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
struct MenuDefinition * MdIndex
Index Menu Definition.
Definition functions.c:80
enum CommandResult km_bind(struct MenuDefinition *md, const char *key_str, int op, char *macro, char *desc, struct Buffer *err)
Set up a key binding.
Definition menu.c:51
@ LL_DEBUG1
Log at debug level 1.
Definition logging2.h:45
+ Here is the call graph for this function:

◆ op_next_entry()

static int op_next_entry ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Move to the next entry - Implements index_function_t -.

Definition at line 2067 of file functions.c.

2069{
2070 const int index = menu_get_index(priv->menu) + 1;
2071 if (index >= shared->mailbox->vcount)
2072 {
2073 mutt_message(_("You are on the last message"));
2074 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
2075 return FR_ERROR;
2076 }
2077 menu_set_index(priv->menu, index);
2078 return FR_SUCCESS;
2079}
+ Here is the call graph for this function:

◆ op_pipe()

static int op_pipe ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Pipe message/attachment to a shell command - Implements index_function_t -.

Definition at line 2084 of file functions.c.

2086{
2087 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
2088 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
2089 mutt_pipe_message(shared->mailbox, &ea);
2090 ARRAY_FREE(&ea);
2091
2092 /* in an IMAP folder index with imap_peek=no, piping could change
2093 * new or old messages status to read. Redraw what's needed. */
2094 const bool c_imap_peek = cs_subset_bool(shared->sub, "imap_peek");
2095 if ((shared->mailbox->type == MUTT_IMAP) && !c_imap_peek)
2096 {
2098 }
2099
2100 return FR_SUCCESS;
2101}
@ MUTT_IMAP
'IMAP' Mailbox type
Definition mailbox.h:49
void mutt_pipe_message(struct Mailbox *m, struct EmailArray *ea)
Pipe a message.
Definition external.c:404
+ Here is the call graph for this function:

◆ op_prev_entry()

static int op_prev_entry ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Move to the previous entry - Implements index_function_t -.

Definition at line 2106 of file functions.c.

2108{
2109 int index = menu_get_index(priv->menu);
2110 if (index < 1)
2111 {
2112 notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
2113 mutt_message(_("You are on the first message"));
2114 return FR_ERROR;
2115 }
2116 menu_set_index(priv->menu, index - 1);
2117 return FR_SUCCESS;
2118}
+ Here is the call graph for this function:

◆ op_print()

static int op_print ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Print the current entry - Implements index_function_t -.

Definition at line 2123 of file functions.c.

2125{
2126 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
2127 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
2128 mutt_print_message(shared->mailbox, &ea);
2129 ARRAY_FREE(&ea);
2130
2131 /* in an IMAP folder index with imap_peek=no, printing could change
2132 * new or old messages status to read. Redraw what's needed. */
2133 const bool c_imap_peek = cs_subset_bool(shared->sub, "imap_peek");
2134 if ((shared->mailbox->type == MUTT_IMAP) && !c_imap_peek)
2135 {
2137 }
2138
2139 return FR_SUCCESS;
2140}
void mutt_print_message(struct Mailbox *m, struct EmailArray *ea)
Print a message.
Definition external.c:435
+ Here is the call graph for this function:

◆ op_query()

static int op_query ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Query external program for addresses - Implements index_function_t -.

Definition at line 2145 of file functions.c.

2147{
2148 query_index(shared->mailbox, shared->sub);
2149 return FR_SUCCESS;
2150}
void query_index(struct Mailbox *m, struct ConfigSubset *sub)
Perform an Alias Query and display the results.
Definition dlg_query.c:483
+ Here is the call graph for this function:

◆ op_quit()

static int op_quit ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Save changes to mailbox and quit - Implements index_function_t -.

Definition at line 2155 of file functions.c.

2157{
2158 if (shared->attach_msg)
2159 return FR_DONE;
2160
2161 if (query_quadoption(_("Quit NeoMutt?"), shared->sub, "quit") == MUTT_YES)
2162 {
2163 priv->oldcount = shared->mailbox ? shared->mailbox->msg_count : 0;
2164
2166 mutt_debug(LL_NOTIFY, "NT_GLOBAL_SHUTDOWN\n");
2168
2169 enum MxStatus check = MX_STATUS_OK;
2170 if (!shared->mailbox_view || ((check = mx_mbox_close(shared->mailbox)) == MX_STATUS_OK))
2171 {
2172 mview_free(&shared->mailbox_view);
2173 mailbox_free(&shared->mailbox);
2174 return FR_DONE;
2175 }
2176
2177 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
2178 {
2179 update_index(priv->menu, shared->mailbox_view, check, priv->oldcount, shared);
2180 }
2181
2182 menu_queue_redraw(priv->menu, MENU_REDRAW_FULL); /* new mail arrived? */
2184 }
2185
2186 return FR_NO_ACTION;
2187}
@ CMD_SHUTDOWN_HOOK
:shutdown-hook
Definition command.h:110
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition mailbox.c:90
void exec_startup_shutdown_hook(enum CommandId id)
Execute any startup/shutdown hooks.
Definition exec.c:410
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
Definition mx.c:595
@ NT_GLOBAL_SHUTDOWN
NeoMutt is about to close.
Definition neomutt.h:71
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition notify_type.h:46
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ op_recall_message()

static int op_recall_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Recall a postponed message - Implements index_function_t -.

Definition at line 2192 of file functions.c.

2194{
2195 int rc = mutt_send_message(SEND_POSTPONED, NULL, NULL, shared->mailbox, NULL,
2196 shared->sub);
2198 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
2199}
#define SEND_POSTPONED
Recall a postponed email.
Definition send.h:46
+ Here is the call graph for this function:

◆ op_reply()

static int op_reply ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Reply to a message - Implements index_function_t -.

Definition at line 2204 of file functions.c.

2206{
2207 if (!shared->email)
2208 return FR_NO_ACTION;
2209 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
2210 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
2211 const bool c_pgp_auto_decode = cs_subset_bool(shared->sub, "pgp_auto_decode");
2212 if (c_pgp_auto_decode &&
2213 (priv->tag_prefix || !(shared->email->security & PGP_TRADITIONAL_CHECKED)))
2214 {
2215 if (mutt_check_traditional_pgp(shared->mailbox, &ea))
2217 }
2218 int rc = mutt_send_message(SEND_REPLY, NULL, NULL, shared->mailbox, &ea,
2219 shared->sub);
2220 ARRAY_FREE(&ea);
2222
2223 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
2224}
+ Here is the call graph for this function:

◆ op_resend()

static int op_resend ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Use the current message as a template for a new one - Implements index_function_t -.

Definition at line 2229 of file functions.c.

2231{
2232 int rc = -1;
2233 if (priv->tag_prefix)
2234 {
2235 struct Mailbox *m = shared->mailbox;
2236 for (size_t i = 0; i < m->msg_count; i++)
2237 {
2238 struct Email *e = m->emails[i];
2239 if (!e)
2240 break;
2241 if (message_is_tagged(e))
2242 rc = mutt_resend_message(NULL, shared->mailbox, e, shared->sub);
2243 }
2244 }
2245 else
2246 {
2247 rc = mutt_resend_message(NULL, shared->mailbox, shared->email, shared->sub);
2248 }
2249
2251 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
2252}
int mutt_resend_message(FILE *fp, struct Mailbox *m, struct Email *e_cur, struct ConfigSubset *sub)
Resend an email.
Definition send.c:1552
+ Here is the call graph for this function:

◆ op_save()

static int op_save ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Make decrypted copy - Implements index_function_t -.

This function handles:

  • OP_COPY_MESSAGE
  • OP_DECODE_COPY
  • OP_DECODE_SAVE
  • OP_DECRYPT_COPY
  • OP_DECRYPT_SAVE
  • OP_SAVE

Definition at line 2265 of file functions.c.

2267{
2268 const int op = event->op;
2269 if (((op == OP_DECRYPT_COPY) || (op == OP_DECRYPT_SAVE)) && !WithCrypto)
2270 return FR_NOT_IMPL;
2271
2272 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
2273 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
2274
2275 const enum MessageSaveOpt save_opt = ((op == OP_SAVE) || (op == OP_DECODE_SAVE) ||
2276 (op == OP_DECRYPT_SAVE)) ?
2277 SAVE_MOVE :
2278 SAVE_COPY;
2279
2280 enum MessageTransformOpt transform_opt =
2281 ((op == OP_DECODE_SAVE) || (op == OP_DECODE_COPY)) ? TRANSFORM_DECODE :
2282 ((op == OP_DECRYPT_SAVE) || (op == OP_DECRYPT_COPY)) ? TRANSFORM_DECRYPT :
2284
2285 const int rc = mutt_save_message(shared->mailbox, &ea, save_opt, transform_opt);
2286 if ((rc == 0) && (save_opt == SAVE_MOVE) && !priv->tag_prefix)
2287 {
2289 }
2290 ARRAY_FREE(&ea);
2291
2292 if (priv->tag_prefix)
2294
2295 return (rc == -1) ? FR_ERROR : FR_SUCCESS;
2296}
int mutt_save_message(struct Mailbox *m, struct EmailArray *ea, enum MessageSaveOpt save_opt, enum MessageTransformOpt transform_opt)
Save an email.
Definition external.c:780
MessageTransformOpt
Message transformation option.
Definition external.h:42
@ TRANSFORM_NONE
No transformation.
Definition external.h:43
@ TRANSFORM_DECODE
Decode message.
Definition external.h:45
@ TRANSFORM_DECRYPT
Decrypt message.
Definition external.h:44
MessageSaveOpt
Message save option.
Definition external.h:52
@ SAVE_MOVE
Move message to another mailbox, removing the original.
Definition external.h:54
@ SAVE_COPY
Copy message, making a duplicate in another mailbox.
Definition external.h:53
+ Here is the call graph for this function:

◆ op_search()

static int op_search ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Search for a regular expression - Implements index_function_t -.

This function handles:

  • OP_SEARCH
  • OP_SEARCH_NEXT
  • OP_SEARCH_OPPOSITE
  • OP_SEARCH_REVERSE

Definition at line 2307 of file functions.c.

2309{
2311 switch (event->op)
2312 {
2313 case OP_SEARCH:
2314 flags |= SEARCH_PROMPT;
2315 shared->search_state->reverse = false;
2316 break;
2317 case OP_SEARCH_REVERSE:
2318 flags |= SEARCH_PROMPT;
2319 shared->search_state->reverse = true;
2320 break;
2321 case OP_SEARCH_NEXT:
2322 break;
2323 case OP_SEARCH_OPPOSITE:
2324 flags |= SEARCH_OPPOSITE;
2325 break;
2326 }
2327
2328 // Initiating a search can happen on an empty mailbox, but
2329 // searching for next/previous/... needs to be on a message and
2330 // thus a non-empty mailbox
2331 int index = menu_get_index(priv->menu);
2332 index = mutt_search_command(shared->mailbox_view, priv->menu, index,
2333 shared->search_state, flags);
2334 if (index != -1)
2335 menu_set_index(priv->menu, index);
2336
2337 return FR_SUCCESS;
2338}
int mutt_search_command(struct MailboxView *mv, struct Menu *menu, int cur, struct SearchState *state, SearchFlags flags)
Perform a search.
Definition pattern.c:474
#define SEARCH_OPPOSITE
Search in the opposite direction.
uint8_t SearchFlags
Flags for a specific search, e.g. SEARCH_PROMPT.
#define SEARCH_NO_FLAGS
No flags are set.
#define SEARCH_PROMPT
Ask for search input.
bool reverse
search backwards
+ Here is the call graph for this function:

◆ op_sort()

static int op_sort ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Sort messages - Implements index_function_t -.

This function handles:

  • OP_SORT
  • OP_SORT_REVERSE

Definition at line 2347 of file functions.c.

2349{
2350 if (!mutt_select_sort(event->op == OP_SORT_REVERSE))
2351 return FR_ERROR;
2352
2353 if (shared->mailbox && (shared->mailbox->msg_count != 0))
2354 {
2355 resort_index(shared->mailbox_view, priv->menu);
2357 }
2358
2359 return FR_SUCCESS;
2360}
void resort_index(struct MailboxView *mv, struct Menu *menu)
Resort the index.
Definition dlg_index.c:366
bool mutt_select_sort(bool reverse)
Ask the user for a sort method.
Definition external.c:473
+ Here is the call graph for this function:

◆ op_tag()

static int op_tag ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Tag the current entry - Implements index_function_t -.

Definition at line 2365 of file functions.c.

2367{
2368 const bool c_auto_tag = cs_subset_bool(shared->sub, "auto_tag");
2369 if (priv->tag_prefix && !c_auto_tag)
2370 {
2371 struct Mailbox *m = shared->mailbox;
2372 for (size_t i = 0; i < m->msg_count; i++)
2373 {
2374 struct Email *e = m->emails[i];
2375 if (!e)
2376 break;
2377 if (e->visible)
2378 mutt_set_flag(m, e, MUTT_TAG, false, true);
2379 }
2381 return FR_SUCCESS;
2382 }
2383
2384 if (!shared->email)
2385 return FR_NO_ACTION;
2386
2387 mutt_set_flag(shared->mailbox, shared->email, MUTT_TAG, !shared->email->tagged, true);
2388
2389 resolve_email(priv, shared, RESOLVE_NEXT_EMAIL);
2390 return FR_SUCCESS;
2391}
@ RESOLVE_NEXT_EMAIL
Next email, whatever its state.
Definition functions.c:313
bool tagged
Email is tagged.
Definition email.h:107
+ Here is the call graph for this function:

◆ op_tag_thread()

static int op_tag_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Tag the current thread - Implements index_function_t -.

This function handles:

  • OP_TAG_SUBTHREAD
  • OP_TAG_THREAD

Definition at line 2400 of file functions.c.

2402{
2403 if (!shared->email)
2404 return FR_NO_ACTION;
2405
2406 const int op = event->op;
2407 int rc = mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_TAG,
2408 !shared->email->tagged, (op != OP_TAG_THREAD));
2409 if (rc != -1)
2410 {
2411 const enum ResolveMethod rm = (op == OP_TAG_THREAD) ? RESOLVE_NEXT_THREAD :
2413 resolve_email(priv, shared, rm);
2415 }
2416
2417 return FR_SUCCESS;
2418}
+ Here is the call graph for this function:

◆ op_toggle_new()

static int op_toggle_new ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Toggle a message's 'new' flag - Implements index_function_t -.

Definition at line 2423 of file functions.c.

2425{
2426 /* L10N: CHECK_ACL */
2427 if (!check_acl(shared->mailbox, MUTT_ACL_SEEN, _("Can't toggle new")))
2428 return FR_ERROR;
2429
2430 struct Mailbox *m = shared->mailbox;
2431 if (priv->tag_prefix)
2432 {
2433 for (size_t i = 0; i < m->msg_count; i++)
2434 {
2435 struct Email *e = m->emails[i];
2436 if (!e)
2437 break;
2438 if (!message_is_tagged(e))
2439 continue;
2440
2441 if (e->read || e->old)
2442 mutt_set_flag(m, e, MUTT_NEW, true, true);
2443 else
2444 mutt_set_flag(m, e, MUTT_READ, true, true);
2445 }
2447 }
2448 else
2449 {
2450 if (!shared->email)
2451 return FR_NO_ACTION;
2452 if (shared->email->read || shared->email->old)
2453 mutt_set_flag(m, shared->email, MUTT_NEW, true, true);
2454 else
2455 mutt_set_flag(m, shared->email, MUTT_READ, true, true);
2456
2458 }
2459
2460 return FR_SUCCESS;
2461}
@ MUTT_NEW
New messages.
Definition mutt.h:89
+ Here is the call graph for this function:

◆ op_toggle_write()

static int op_toggle_write ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Toggle whether the mailbox will be rewritten - Implements index_function_t -.

Definition at line 2466 of file functions.c.

2468{
2469 mx_toggle_write(shared->mailbox);
2470 return FR_SUCCESS;
2471}
int mx_toggle_write(struct Mailbox *m)
Toggle the mailbox's readonly flag.
Definition mx.c:1821
+ Here is the call graph for this function:

◆ op_undelete()

static int op_undelete ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Undelete the current entry - Implements index_function_t -.

Definition at line 2476 of file functions.c.

2478{
2479 /* L10N: CHECK_ACL */
2480 if (!check_acl(shared->mailbox, MUTT_ACL_DELETE, _("Can't undelete message")))
2481 return FR_ERROR;
2482
2483 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
2484 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
2485
2486 mutt_emails_set_flag(shared->mailbox, &ea, MUTT_DELETE, false);
2487 mutt_emails_set_flag(shared->mailbox, &ea, MUTT_PURGE, false);
2488 ARRAY_FREE(&ea);
2489
2490 if (priv->tag_prefix)
2491 {
2493 }
2494 else
2495 {
2496 resolve_email(priv, shared, RESOLVE_NEXT_EMAIL);
2497 }
2498
2499 return FR_SUCCESS;
2500}
+ Here is the call graph for this function:

◆ op_undelete_thread()

static int op_undelete_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Undelete all messages in thread - Implements index_function_t -.

This function handles:

  • OP_UNDELETE_SUBTHREAD
  • OP_UNDELETE_THREAD

Definition at line 2509 of file functions.c.

2511{
2512 /* L10N: CHECK_ACL */
2513 /* L10N: Due to the implementation details we do not know whether we
2514 undelete zero, 1, 12, ... messages. So in English we use
2515 "messages". Your language might have other means to express this. */
2516 if (!check_acl(shared->mailbox, MUTT_ACL_DELETE, _("Can't undelete messages")))
2517 return FR_ERROR;
2518
2519 const int op = event->op;
2520 int rc = mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_DELETE,
2521 false, (op != OP_UNDELETE_THREAD));
2522 if (rc != -1)
2523 {
2524 rc = mutt_thread_set_flag(shared->mailbox, shared->email, MUTT_PURGE, false,
2525 (op != OP_UNDELETE_THREAD));
2526 }
2527 if (rc != -1)
2528 {
2529 const enum ResolveMethod rm = (op == OP_UNDELETE_THREAD) ? RESOLVE_NEXT_THREAD :
2531 resolve_email(priv, shared, rm);
2533 }
2534
2535 return FR_SUCCESS;
2536}
+ Here is the call graph for this function:

◆ op_view_attachments()

static int op_view_attachments ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Show MIME attachments - Implements index_function_t -.

Definition at line 2541 of file functions.c.

2543{
2544 if (!shared->email)
2545 return FR_NO_ACTION;
2546
2547 enum FunctionRetval rc = FR_ERROR;
2548 struct Message *msg = mx_msg_open(shared->mailbox, shared->email);
2549 if (msg)
2550 {
2551 dlg_attachment(NeoMutt->sub, shared->mailbox_view, shared->email, msg->fp,
2552 shared->attach_msg);
2553 if (shared->email->attach_del)
2554 {
2555 shared->mailbox->changed = true;
2556 }
2557 mx_msg_close(shared->mailbox, &msg);
2558 rc = FR_SUCCESS;
2559 }
2561 return rc;
2562}
void dlg_attachment(struct ConfigSubset *sub, struct MailboxView *mv, struct Email *e, FILE *fp, bool attach_msg)
Show the attachments in a Menu -.
Definition dlg_attach.c:207
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
Definition mx.c:1182
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
Definition mx.c:1136
bool attach_del
Has an attachment marked for deletion.
Definition email.h:99
A local copy of an email.
Definition message.h:34
FILE * fp
pointer to the message data
Definition message.h:35
+ Here is the call graph for this function:

◆ op_autocrypt_acct_menu()

static int op_autocrypt_acct_menu ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Manage autocrypt accounts - Implements index_function_t -.

Definition at line 2570 of file functions.c.

2572{
2573 dlg_autocrypt();
2574 return FR_SUCCESS;
2575}
void dlg_autocrypt(void)
Display the Autocrypt account Menu -.
+ Here is the call graph for this function:

◆ op_main_imap_fetch()

static int op_main_imap_fetch ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Force retrieval of mail from IMAP server - Implements index_function_t -.

Definition at line 2581 of file functions.c.

2583{
2584 if (!shared->mailbox || (shared->mailbox->type != MUTT_IMAP))
2585 return FR_NO_ACTION;
2586
2587 imap_check_mailbox(shared->mailbox, true);
2588 return FR_SUCCESS;
2589}
enum MxStatus imap_check_mailbox(struct Mailbox *m, bool force)
Use the NOOP or IDLE command to poll for new mail.
Definition imap.c:1212
+ Here is the call graph for this function:

◆ op_main_imap_logout_all()

static int op_main_imap_logout_all ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Logout from all IMAP servers - Implements index_function_t -.

Definition at line 2594 of file functions.c.

2597{
2598 if (shared->mailbox && (shared->mailbox->type == MUTT_IMAP))
2599 {
2600 const enum MxStatus check = mx_mbox_close(shared->mailbox);
2601 if (check == MX_STATUS_OK)
2602 {
2603 mview_free(&shared->mailbox_view);
2604 }
2605 else
2606 {
2607 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
2608 {
2609 update_index(priv->menu, shared->mailbox_view, check, priv->oldcount, shared);
2610 }
2613 return FR_ERROR;
2614 }
2615 }
2617 mutt_message(_("Logged out of IMAP servers"));
2620
2621 return FR_SUCCESS;
2622}
void imap_logout_all(void)
Close all open connections.
Definition imap.c:667
+ Here is the call graph for this function:

◆ op_catchup()

static int op_catchup ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Mark all articles in newsgroup as read - Implements index_function_t -.

Definition at line 2627 of file functions.c.

2629{
2630 struct Mailbox *m = shared->mailbox;
2631 if (!m || (m->type != MUTT_NNTP))
2632 return FR_NO_ACTION;
2633
2634 struct NntpMboxData *mdata = m->mdata;
2635 if (mutt_newsgroup_catchup(m, mdata->adata, mdata->group))
2637
2638 return FR_SUCCESS;
2639}
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition mailbox.h:48
struct NntpMboxData * mutt_newsgroup_catchup(struct Mailbox *m, struct NntpAccountData *adata, char *group)
Catchup newsgroup.
Definition newsrc.c:1225
void * mdata
Driver specific data.
Definition mailbox.h:131
NNTP-specific Mailbox data -.
Definition mdata.h:34
+ Here is the call graph for this function:

◆ op_get_children()

static int op_get_children ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Get all children of the current message - Implements index_function_t -.

This function handles:

  • OP_GET_CHILDREN
  • OP_RECONSTRUCT_THREAD

Definition at line 2648 of file functions.c.

2650{
2651 struct Mailbox *m = shared->mailbox;
2652 if (m->type != MUTT_NNTP)
2653 return FR_ERROR;
2654
2655 struct Email *e = shared->email;
2656 if (!e)
2657 return FR_NO_ACTION;
2658
2659 char buf[PATH_MAX] = { 0 };
2660 int oldmsgcount = m->msg_count;
2661 int oldindex = e->index;
2662 int rc = 0;
2663
2664 if (!e->env->message_id)
2665 {
2666 mutt_error(_("No Message-Id. Unable to perform operation."));
2667 return FR_ERROR;
2668 }
2669
2670 mutt_message(_("Fetching message headers..."));
2671 if (!m->id_hash)
2672 m->id_hash = mutt_make_id_hash(m);
2673 mutt_str_copy(buf, e->env->message_id, sizeof(buf));
2674
2675 const int op = event->op;
2676 /* trying to find msgid of the root message */
2677 if (op == OP_RECONSTRUCT_THREAD)
2678 {
2679 struct ListNode *ref = NULL;
2680 STAILQ_FOREACH(ref, &e->env->references, entries)
2681 {
2682 if (!mutt_hash_find(m->id_hash, ref->data))
2683 {
2684 rc = nntp_check_msgid(m, ref->data);
2685 if (rc < 0)
2686 return FR_ERROR;
2687 }
2688
2689 /* the last msgid in References is the root message */
2690 if (!STAILQ_NEXT(ref, entries))
2691 mutt_str_copy(buf, ref->data, sizeof(buf));
2692 }
2693 }
2694
2695 /* fetching all child messages */
2696 rc = nntp_check_children(m, buf);
2697
2698 /* at least one message has been loaded */
2699 if (m->msg_count > oldmsgcount)
2700 {
2701 bool verbose = m->verbose;
2702
2703 if (rc < 0)
2704 m->verbose = false;
2705
2706 struct MailboxView *mv = shared->mailbox_view;
2707 mutt_sort_headers(mv, (op == OP_RECONSTRUCT_THREAD));
2708 m->verbose = verbose;
2709
2710 /* if the root message was retrieved, move to it */
2711 struct Email *e2 = mutt_hash_find(m->id_hash, buf);
2712 if (e2)
2713 {
2714 menu_set_index(priv->menu, e2->vnum);
2715 }
2716 else
2717 {
2718 /* try to restore old position */
2719 for (int i = 0; i < m->msg_count; i++)
2720 {
2721 e2 = m->emails[i];
2722 if (!e2)
2723 break;
2724 if (e2->index == oldindex)
2725 {
2726 menu_set_index(priv->menu, e2->vnum);
2727 /* as an added courtesy, recenter the menu
2728 * with the current entry at the middle of the screen */
2730 }
2731 }
2732 }
2734 }
2735 else if (rc >= 0)
2736 {
2737 mutt_error(_("No deleted messages found in the thread"));
2738 }
2739
2740 return FR_SUCCESS;
2741}
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
Definition thread.c:1700
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:364
MenuRedrawFlags menu_current_middle(struct Menu *menu)
Move the current selection to the centre of the window.
Definition move.c:467
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:583
int nntp_check_msgid(struct Mailbox *m, const char *msgid)
Fetch article by Message-ID.
Definition nntp.c:2212
int nntp_check_children(struct Mailbox *m, const char *msgid)
Fetch children of article with the Message-ID.
Definition nntp.c:2283
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
#define STAILQ_NEXT(elm, field)
Definition queue.h:439
A List node for strings.
Definition list.h:37
char * data
String.
Definition list.h:38
struct HashTable * id_hash
Hash Table: "message-id" -> Email.
Definition mailbox.h:122
+ Here is the call graph for this function:

◆ op_get_message()

static int op_get_message ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Get parent of the current message - Implements index_function_t -.

This function handles:

  • OP_GET_MESSAGE
  • OP_GET_PARENT

Definition at line 2750 of file functions.c.

2752{
2753 struct Mailbox *m = shared->mailbox;
2754 if (m->type != MUTT_NNTP)
2755 return FR_SUCCESS;
2756
2757 int rc = FR_ERROR;
2758 struct Buffer *buf = buf_pool_get();
2759
2760 const int op = event->op;
2761 if (op == OP_GET_MESSAGE)
2762 {
2763 if ((mw_get_field(_("Enter Message-Id: "), buf, MUTT_COMP_NO_FLAGS,
2764 HC_OTHER, NULL, NULL) != 0) ||
2765 buf_is_empty(buf))
2766 {
2767 goto done;
2768 }
2769 }
2770 else
2771 {
2772 struct Email *e = shared->email;
2773 if (!e || STAILQ_EMPTY(&e->env->references))
2774 {
2775 mutt_error(_("Article has no parent reference"));
2776 goto done;
2777 }
2778 buf_strcpy(buf, STAILQ_FIRST(&e->env->references)->data);
2779 }
2780
2781 if (!m->id_hash)
2782 m->id_hash = mutt_make_id_hash(m);
2783 struct Email *e = mutt_hash_find(m->id_hash, buf_string(buf));
2784 if (e)
2785 {
2786 if (e->vnum != -1)
2787 {
2788 menu_set_index(priv->menu, e->vnum);
2789 }
2790 else if (e->collapsed)
2791 {
2793 mutt_set_vnum(m);
2794 menu_set_index(priv->menu, e->vnum);
2795 }
2796 else
2797 {
2798 mutt_error(_("Message is not visible in limited view"));
2799 }
2800 }
2801 else
2802 {
2803 mutt_message(_("Fetching %s from server..."), buf_string(buf));
2804 int rc2 = nntp_check_msgid(m, buf_string(buf));
2805 if (rc2 == 0)
2806 {
2807 e = m->emails[m->msg_count - 1];
2808 struct MailboxView *mv = shared->mailbox_view;
2809 mutt_sort_headers(mv, false);
2810 menu_set_index(priv->menu, e->vnum);
2812 rc = FR_SUCCESS;
2813 }
2814 else if (rc2 > 0)
2815 {
2816 mutt_error(_("Article %s not found on the server"), buf_string(buf));
2817 }
2818 }
2819
2820done:
2821 buf_pool_release(&buf);
2822 return rc;
2823}
#define STAILQ_FIRST(head)
Definition queue.h:388
+ Here is the call graph for this function:

◆ op_main_change_group()

static int op_main_change_group ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Open a different newsgroup - Implements index_function_t -.

This function handles:

  • OP_MAIN_CHANGE_GROUP
  • OP_MAIN_CHANGE_GROUP_READONLY

Definition at line 2832 of file functions.c.

2834{
2835 struct Buffer *folderbuf = buf_pool_get();
2836 buf_alloc(folderbuf, PATH_MAX);
2837
2838 OptNews = false;
2839 bool read_only;
2840 char *cp = NULL;
2841 const bool c_read_only = cs_subset_bool(shared->sub, "read_only");
2842 const int op = event->op;
2843 if (shared->attach_msg || c_read_only || (op == OP_MAIN_CHANGE_GROUP_READONLY))
2844 {
2845 cp = _("Open newsgroup in read-only mode");
2846 read_only = true;
2847 }
2848 else
2849 {
2850 cp = _("Open newsgroup");
2851 read_only = false;
2852 }
2853
2854 const bool c_change_folder_next = cs_subset_bool(shared->sub, "change_folder_next");
2855 if (c_change_folder_next && shared->mailbox && !buf_is_empty(&shared->mailbox->pathbuf))
2856 {
2857 buf_strcpy(folderbuf, mailbox_path(shared->mailbox));
2858 pretty_mailbox(folderbuf);
2859 }
2860
2861 OptNews = true;
2862 const char *const c_news_server = cs_subset_string(shared->sub, "news_server");
2863 if (!CurrentNewsSrv)
2864 CurrentNewsSrv = nntp_select_server(shared->mailbox, c_news_server, false);
2865 if (!CurrentNewsSrv)
2866 goto changefoldercleanup2;
2867
2868 nntp_mailbox(shared->mailbox, folderbuf->data, folderbuf->dsize);
2869
2870 if (mw_enter_fname(cp, folderbuf, true, shared->mailbox, false, NULL, NULL,
2871 MUTT_SEL_NO_FLAGS) == -1)
2872 {
2873 goto changefoldercleanup2;
2874 }
2875
2876 /* Selected directory is okay, let's save it. */
2878
2879 if (buf_is_empty(folderbuf))
2880 {
2881 msgwin_clear_text(NULL);
2882 goto changefoldercleanup2;
2883 }
2884
2885 struct Mailbox *m = mx_mbox_find2(buf_string(folderbuf));
2886 if (m)
2887 {
2888 change_folder_mailbox(priv->menu, m, &priv->oldcount, shared, read_only);
2889 }
2890 else
2891 {
2892 change_folder_string(priv->menu, folderbuf, &priv->oldcount, shared, read_only);
2893 }
2894 struct MuttWindow *dlg = dialog_find(priv->win_index);
2895 dlg->help_data = IndexNewsHelp;
2896
2897changefoldercleanup2:
2898 buf_pool_release(&folderbuf);
2899 return FR_SUCCESS;
2900}
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
const struct Mapping IndexNewsHelp[]
Help Bar for the News Index dialog.
Definition dlg_index.c:114
bool OptNews
(pseudo) used to change reader mode
Definition globals.c:53
void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen)
Get first newsgroup with new messages.
Definition newsrc.c:1307
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition nntp.c:74
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition newsrc.c:944
size_t dsize
Length of data.
Definition buffer.h:39
char * data
Pointer to data.
Definition buffer.h:37
const struct Mapping * help_data
Data for the Help Bar.
+ Here is the call graph for this function:

◆ op_post()

static int op_post ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Followup to newsgroup - Implements index_function_t -.

This function handles:

  • OP_FOLLOWUP
  • OP_POST

Definition at line 2909 of file functions.c.

2911{
2912 if (!shared->email)
2913 return FR_NO_ACTION;
2914
2915 const int op = event->op;
2916 if ((op != OP_FOLLOWUP) || !shared->email->env->followup_to ||
2917 !mutt_istr_equal(shared->email->env->followup_to, "poster") ||
2918 (query_quadoption(_("Reply by mail as poster prefers?"), shared->sub,
2919 "followup_to_poster") != MUTT_YES))
2920 {
2921 if (shared->mailbox && (shared->mailbox->type == MUTT_NNTP) &&
2922 !((struct NntpMboxData *) shared->mailbox->mdata)->allowed &&
2923 (query_quadoption(_("Posting to this group not allowed, may be moderated. Continue?"),
2924 shared->sub, "post_moderated") != MUTT_YES))
2925 {
2926 return FR_ERROR;
2927 }
2928 if (op == OP_POST)
2929 {
2930 mutt_send_message(SEND_NEWS, NULL, NULL, shared->mailbox, NULL, shared->sub);
2931 }
2932 else
2933 {
2934 struct EmailArray ea = ARRAY_HEAD_INITIALIZER;
2935 ea_add_tagged(&ea, shared->mailbox_view, shared->email, priv->tag_prefix);
2936 mutt_send_message(((op == OP_FOLLOWUP) ? SEND_REPLY : SEND_FORWARD) | SEND_NEWS,
2937 NULL, NULL, shared->mailbox, &ea, shared->sub);
2938 ARRAY_FREE(&ea);
2939 }
2941 return FR_SUCCESS;
2942 }
2943
2944 struct KeyEvent event_r = { 0, OP_REPLY };
2945 return op_reply(shared, priv, &event_r);
2946}
static int op_reply(struct AttachPrivateData *priv, const struct KeyEvent *event)
reply to a message - Implements attach_function_t -
Definition functions.c:613
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition string.c:674
#define SEND_NEWS
Reply to a news article.
Definition send.h:55
char * followup_to
List of 'followup-to' fields.
Definition envelope.h:80
An event such as a keypress.
Definition get.h:50
+ Here is the call graph for this function:

◆ op_main_entire_thread()

static int op_main_entire_thread ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Read entire thread of the current message - Implements index_function_t -.

Definition at line 2952 of file functions.c.

2954{
2955 if (shared->mailbox->type != MUTT_NOTMUCH)
2956 {
2957 if (((shared->mailbox->type != MUTT_MH) && (shared->mailbox->type != MUTT_MAILDIR)) ||
2958 (!shared->email || !shared->email->env || !shared->email->env->message_id))
2959 {
2960 mutt_message(_("No virtual folder and no Message-Id, aborting"));
2961 return FR_ERROR;
2962 } // no virtual folder, but we have message-id, reconstruct thread on-the-fly
2963
2964 struct Buffer *buf = buf_pool_get();
2965 buf_alloc(buf, PATH_MAX);
2966 buf_addstr(buf, "id:");
2967
2968 int msg_id_offset = 0;
2969 if ((shared->email->env->message_id)[0] == '<')
2970 msg_id_offset = 1;
2971
2972 buf_addstr(buf, shared->email->env->message_id + msg_id_offset);
2973
2974 size_t len = buf_len(buf);
2975 ASSERT(len > 0);
2976 if (buf->data[len - 1] == '>')
2977 buf->data[len - 1] = '\0';
2978
2979 change_folder_notmuch(priv->menu, buf->data, buf->dsize, &priv->oldcount, shared, false);
2980 buf_pool_release(&buf);
2981
2982 // If notmuch doesn't contain the message, we're left in an empty
2983 // vfolder. No messages are found, but nm_read_entire_thread assumes
2984 // a valid message-id and will throw a segfault.
2985 //
2986 // To prevent that, stay in the empty vfolder and print an error.
2987 if (shared->mailbox->msg_count == 0)
2988 {
2989 mutt_error(_("failed to find message in notmuch database. try running 'notmuch new'."));
2990 return FR_ERROR;
2991 }
2992 }
2993 priv->oldcount = shared->mailbox->msg_count;
2994 int index = menu_get_index(priv->menu);
2995 struct Email *e_oldcur = mutt_get_virt_email(shared->mailbox, index);
2996 if (!e_oldcur)
2997 return FR_ERROR;
2998
2999 if (nm_read_entire_thread(shared->mailbox, e_oldcur) < 0)
3000 {
3001 mutt_message(_("Failed to read thread, aborting"));
3002 return FR_ERROR;
3003 }
3004
3005 // nm_read_entire_thread() may modify msg_count and menu won't be updated.
3006 priv->menu->max = shared->mailbox->msg_count;
3007
3008 if (priv->oldcount < shared->mailbox->msg_count)
3009 {
3010 /* nm_read_entire_thread() triggers mutt_sort_headers() if necessary */
3011 index = e_oldcur->vnum;
3012 if (e_oldcur->collapsed || shared->mailbox_view->collapsed)
3013 {
3014 index = mutt_uncollapse_thread(e_oldcur);
3015 mutt_set_vnum(shared->mailbox);
3016 }
3017 menu_set_index(priv->menu, index);
3019 }
3020
3021 return FR_SUCCESS;
3022}
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition buffer.c:491
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:226
@ MUTT_MH
'MH' Mailbox type
Definition mailbox.h:46
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition mailbox.h:47
struct Mailbox * change_folder_notmuch(struct Menu *menu, char *buf, int buflen, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Notmuch Mailbox by string.
Definition dlg_index.c:731
int nm_read_entire_thread(struct Mailbox *m, struct Email *e)
Get the entire thread of an email.
Definition notmuch.c:1550
#define ASSERT(COND)
Definition signal2.h:59
bool collapsed
Are all threads collapsed?
Definition mview.h:49
+ Here is the call graph for this function:

◆ op_main_vfolder_from_query()

static int op_main_vfolder_from_query ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Generate virtual folder from query - Implements index_function_t -.

This function handles:

  • OP_MAIN_VFOLDER_FROM_QUERY
  • OP_MAIN_VFOLDER_FROM_QUERY_READONLY op_main_vfolder_from_query

Definition at line 3031 of file functions.c.

3034{
3035 int rc = FR_SUCCESS;
3036 struct Buffer *buf = buf_pool_get();
3037
3038 if ((mw_get_field("Query: ", buf, MUTT_COMP_NO_FLAGS, HC_OTHER,
3039 &CompleteNmQueryOps, NULL) != 0) ||
3040 buf_is_empty(buf))
3041 {
3042 mutt_message(_("No query, aborting"));
3043 rc = FR_NO_ACTION;
3044 goto done;
3045 }
3046
3047 // Keep copy of user's query to name the mailbox
3048 char *query_unencoded = buf_strdup(buf);
3049
3050 buf_alloc(buf, PATH_MAX);
3051 const int op = event->op;
3052 struct Mailbox *m_query = change_folder_notmuch(priv->menu, buf->data, buf->dsize,
3053 &priv->oldcount, shared,
3054 (op == OP_MAIN_VFOLDER_FROM_QUERY_READONLY));
3055 if (m_query)
3056 {
3057 FREE(&m_query->name);
3058 m_query->name = query_unencoded;
3059 query_unencoded = NULL;
3060 rc = FR_SUCCESS;
3061 }
3062 else
3063 {
3064 FREE(&query_unencoded);
3065 }
3066
3067done:
3068 buf_pool_release(&buf);
3069 return rc;
3070}
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:571
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
const struct CompleteOps CompleteNmQueryOps
Auto-Completion of NmQuerys.
Definition complete.c:247
char * name
A short name for the Mailbox.
Definition mailbox.h:81
+ Here is the call graph for this function:

◆ op_main_windowed_vfolder()

static int op_main_windowed_vfolder ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Shifts virtual folder time window - Implements index_function_t -.

This function handles:

  • OP_MAIN_WINDOWED_VFOLDER_BACKWARD
  • OP_MAIN_WINDOWED_VFOLDER_FORWARD
  • OP_MAIN_WINDOWED_VFOLDER_RESET

Definition at line 3080 of file functions.c.

3083{
3084 // Common guard clauses.
3086 {
3087 mutt_message(_("Windowed queries disabled"));
3088 return FR_ERROR;
3089 }
3090 const char *const c_nm_query_window_current_search = cs_subset_string(shared->sub, "nm_query_window_current_search");
3091 if (!c_nm_query_window_current_search)
3092 {
3093 mutt_message(_("No notmuch vfolder currently loaded"));
3094 return FR_ERROR;
3095 }
3096
3097 // Call the specific operation.
3098 switch (event->op)
3099 {
3100 case OP_MAIN_WINDOWED_VFOLDER_BACKWARD:
3102 break;
3103 case OP_MAIN_WINDOWED_VFOLDER_FORWARD:
3105 break;
3106 case OP_MAIN_WINDOWED_VFOLDER_RESET:
3108 break;
3109 }
3110
3111 // Common query window folder change.
3112 char buf[PATH_MAX] = { 0 };
3113 mutt_str_copy(buf, c_nm_query_window_current_search, sizeof(buf));
3114 change_folder_notmuch(priv->menu, buf, sizeof(buf), &priv->oldcount, shared, false);
3115
3116 return FR_SUCCESS;
3117}
void nm_query_window_reset(void)
Resets the vfolder window position to the present.
Definition notmuch.c:1722
void nm_query_window_backward(void)
Function to move the current search window backward in time.
Definition notmuch.c:1711
bool nm_query_window_available(void)
Are windowed queries enabled for use?
Definition notmuch.c:1674
void nm_query_window_forward(void)
Function to move the current search window forward in time.
Definition notmuch.c:1691
+ Here is the call graph for this function:

◆ op_main_fetch_mail()

static int op_main_fetch_mail ( struct IndexSharedData * shared,
struct IndexPrivateData * priv,
const struct KeyEvent * event )
static

Retrieve mail from POP server - Implements index_function_t -.

Definition at line 3123 of file functions.c.

3125{
3128 return FR_SUCCESS;
3129}
void pop_fetch_mail(void)
Fetch messages and save them in $spool_file.
Definition pop.c:517
+ Here is the call graph for this function: