pub struct Session {Show 31 fields
pub dir: PathBuf,
pub title: String,
pub mbox: Option<Mbox>,
pub msgs: Vec<Msg>,
pub visible: Vec<usize>,
pub sel: usize,
pub sort: SortKey,
pub sort_rev: bool,
pub limit: Option<(String, Vec<Pattern>)>,
pub last_search: Option<Vec<Pattern>>,
pub search_rev: bool,
pub thread_depth: Vec<usize>,
pub thread_root: Vec<usize>,
pub thread_pseudo: Vec<bool>,
pub thread_parent: Vec<Option<usize>>,
pub thread_children: Vec<Vec<usize>>,
pub thread_members: Vec<Vec<usize>>,
pub collapsed: HashSet<PathBuf>,
pub config: Config,
pub my_addresses: Vec<String>,
pub lists: Vec<Matcher>,
pub subscribed: Vec<Matcher>,
pub alternates: Vec<Matcher>,
pub idle: Option<IdleWatch>,
pub read_only: bool,
pub read_only_session: bool,
pub message_hooks: Vec<Hook>,
pub reply_hooks: Vec<Hook>,
pub display: Display,
pub quote_re: Regex,
pub reply_re: Regex,
/* private fields */
}Expand description
One open mailbox and everything rmut knows about it.
Fields§
§dir: PathBufThe maildir on disk: the mailbox itself, or the cache mirror of an IMAP folder or an mbox file.
title: StringWhat this mailbox is called: the path for local maildirs, the
imap:account/folder spec for remote ones.
mbox: Option<Mbox>Set when dir mirrors an mbox file; sync writes back into it.
msgs: Vec<Msg>§visible: Vec<usize>Indices into msgs after applying limit and thread folding.
sel: usizeSelection, as an index into visible.
sort: SortKey§sort_rev: bool§limit: Option<(String, Vec<Pattern>)>§last_search: Option<Vec<Pattern>>§search_rev: boolWhich way the last index search went, so n repeats in the
same direction (mutt’s search / search-reverse pair).
thread_depth: Vec<usize>Per-message thread depth/root (aligned with msgs; identity
when not sorted by threads).
thread_root: Vec<usize>§thread_pseudo: Vec<bool>Which messages the subject fallback placed rather than their own References (mutt’s fake_thread): the index stars them.
thread_parent: Vec<Option<usize>>The thread as a tree, from the depth-first layout: each
message’s parent and children, and every root’s members. For
the ~(, ~<, ~> patterns, parent-message, and read-thread.
thread_children: Vec<Vec<usize>>§thread_members: Vec<Vec<usize>>§collapsed: HashSet<PathBuf>Paths of collapsed thread roots.
config: Config§my_addresses: Vec<String>My own addresses (identity, accounts, $EMAIL), lowercase; the
exact half of me(), which adds alternates on top.
lists: Vec<Matcher>Compiled mail.lists + mail.subscribed, for ~l, the L
list-reply target, and Mail-Followup-To.
subscribed: Vec<Matcher>The subscribed half on its own: only it drops my address from a Mail-Followup-To.
alternates: Vec<Matcher>Compiled mail.alternates: my other addresses, joined to me
wherever rmut asks whether an address is mine.
idle: Option<IdleWatch>Background IDLE watcher for the open IMAP folder.
read_only: boolrmut -R: nothing is ever written, not even read marks.
read_only_session: bool-R: the whole session is read-only, so a mailbox switch
cannot quietly make it writable again. Alt+c sets read_only
for one mailbox without touching this.
message_hooks: Vec<Hook>Compiled hook tables (patterns plus the line or mailbox each carries). The front end still runs a hook’s command line, because one can rebind a key; which hooks match a message is the session’s answer to give.
reply_hooks: Vec<Hook>§display: Displayignore/unignore/hdr_order and the [filters] table: how a message’s parts turn into the text a reader sees.
quote_re: RegexCompiled $quote_regexp classifying quoted body lines: a pager colours by it, and the attachment reminder skips them.
reply_re: RegexCompiled $reply_regexp, for the subject a reply carries.
Implementations§
Source§impl Session
impl Session
pub fn ask_search(&self, back: bool) -> Ask
Sourcepub fn ask_pattern(&mut self, op: PatternOp) -> Option<Ask>
pub fn ask_pattern(&mut self, op: PatternOp) -> Option<Ask>
A mark applied to everything matching a pattern. None when it would have to write a read-only mailbox.
Sourcepub fn ask_mark_message(&mut self) -> Option<Ask>
pub fn ask_mark_message(&mut self) -> Option<Ask>
mutt’s mark-message: a hotkey that jumps back to the message
under the cursor. mutt prefixes it with $mark_macro_prefix
('); rmut’s macros are one key, so the stroke is the key.
Sourcepub fn ask_list_action(&mut self) -> Option<Ask>
pub fn ask_list_action(&mut self) -> Option<Ask>
mutt’s list-action: the RFC 2369 actions the message under the cursor offers, as a one-key menu.
Sourcepub fn ask_copy(&mut self, delete: bool, tagged: bool) -> Option<Ask>
pub fn ask_copy(&mut self, delete: bool, tagged: bool) -> Option<Ask>
Where to save or copy. None when there is nothing to copy, or when saving would have to write a read-only mailbox.
Sourcepub fn ask_copy_decode(
&mut self,
delete: bool,
tagged: bool,
decode: bool,
) -> Option<Ask>
pub fn ask_copy_decode( &mut self, delete: bool, tagged: bool, decode: bool, ) -> Option<Ask>
mutt’s decode-save / decode-copy, which are save / copy of the decoded message.
pub fn ask_pipe(&self, tagged: bool) -> Option<Ask>
pub fn ask_bounce(&self, tagged: bool) -> Option<Ask>
Sourcepub fn ask_print(&mut self, tagged: bool) -> Option<Ask>
pub fn ask_print(&mut self, tagged: bool) -> Option<Ask>
mutt’s $print: the question before p does anything. rmut has
always asked with Enter declining, which is mutt’s ask-no
default; the other three answer it for you.
Sourcepub fn ask_alias(&mut self) -> Option<Ask>
pub fn ask_alias(&mut self) -> Option<Ask>
mutt’s create-alias, on the sender of the selected message.
Sourcepub fn ask_edit_label(&self, tagged: bool) -> Option<Ask>
pub fn ask_edit_label(&self, tagged: bool) -> Option<Ask>
mutt’s edit-label: prefilled with the current label when one message is under the cursor.
pub fn ask_sort(&self) -> Ask
Sourcepub fn leave(&mut self) -> Option<Ask>
pub fn leave(&mut self) -> Option<Ask>
Leaving for good: mutt’s $quit decides whether to ask, and what follows is the purge question, or nothing at all.
Sourcepub fn ask_purge(&mut self, quit: bool) -> Option<Ask>
pub fn ask_purge(&mut self, quit: bool) -> Option<Ask>
Purge the deleted messages before leaving this mailbox?
mutt’s $delete decides it without asking when it is set to yes or no; then there is nothing to ask and the work is already done, so this returns None.
Sourcepub fn ask_header(&self, name: &str) -> Option<Ask>
pub fn ask_header(&self, name: &str) -> Option<Ask>
A header of the draft in hand (To, Cc, Bcc, Subject).
Sourcepub fn ask_fcc(&self) -> Option<Ask>
pub fn ask_fcc(&self) -> Option<Ask>
Where the sent copy goes, prefilled with where it would go.
pub fn ask_attach_file(&self) -> Option<Ask>
Sourcepub fn ask_attach_field(&mut self, sel: usize, is_type: bool) -> Option<Ask>
pub fn ask_attach_field(&mut self, sel: usize, is_type: bool) -> Option<Ask>
The description (or content-type) of the attachment the menu’s
sel-th row stands for.
Sourcepub fn ask_rename_attachment(&mut self, sel: usize) -> Option<Ask>
pub fn ask_rename_attachment(&mut self, sel: usize) -> Option<Ask>
mutt’s rename-attachment (Ctrl+O): “Send attachment with name: “, the current name prefilled; empty takes the override off.
Sourcepub fn ask_new_mime(&self) -> Option<Ask>
pub fn ask_new_mime(&self) -> Option<Ask>
mutt’s new-mime (n): a file to make and attach, then its type.
Sourcepub fn ask_write_fcc(&self) -> Option<Ask>
pub fn ask_write_fcc(&self) -> Option<Ask>
mutt’s write-fcc (w): the message as it stands, into a mailbox, without sending it. The open mailbox is the offer.
pub fn ask_security(&self) -> Option<Ask>
pub fn ask_postpone(&mut self) -> Option<Ask>
Sourcepub fn request_suspend(&mut self)
pub fn request_suspend(&mut self)
Ctrl+Z: ask to be put in the background. A front end that cannot be suspended simply does not honour it.
Sourcepub fn answer(&mut self, what: AskKind, answer: Answer<'_>) -> Option<Ask>
pub fn answer(&mut self, what: AskKind, answer: Answer<'_>) -> Option<Ask>
Hand back an answer. The next question, when there is one.
Sourcepub fn take_request(&mut self) -> Option<Request>
pub fn take_request(&mut self) -> Option<Request>
Anything the session wants the front end to do, oldest first.
Source§impl Session
impl Session
Sourcepub fn run_command_line(&mut self, line: &str) -> CommandRun
pub fn run_command_line(&mut self, line: &str) -> CommandRun
Run a config command line (mutt’s enter-command, and every hook’s payload).
Everything the session owns is applied here; whatever belongs
to the keys goes back as Request::Command, and the front
end is told the config moved with Request::ConfigChanged.
Sourcepub fn run_folder_hooks(&mut self)
pub fn run_folder_hooks(&mut self)
mutt’s folder-hook: the lines matching the mailbox that is now open.
Sourcepub fn sync_message_hooks(&mut self)
pub fn sync_message_hooks(&mut self)
mutt’s message-hook: the lines matching the selected message are in force while it is selected, and the config goes back to what it was as soon as the match set changes. Cheap when nothing matches, so a draw loop can call it every frame.
Sourcepub fn clear_message_hooks(&mut self)
pub fn clear_message_hooks(&mut self)
Leaving the message (or the mailbox): whatever the message-hooks changed goes back.
Sourcepub fn apply_reply_hooks(
&mut self,
base: Option<&ComposeBase>,
kind: ComposeKind,
) -> Option<Box<Config>>
pub fn apply_reply_hooks( &mut self, base: Option<&ComposeBase>, kind: ComposeKind, ) -> Option<Box<Config>>
mutt’s reply-hook: the lines matching the message being replied
to, in force while this reply’s draft is built, so set from,
edit_headers and my_hdr all see them. Hands back the config to
put back afterwards.
Sourcepub fn restore_after_reply_hooks(&mut self, saved: Option<Box<Config>>)
pub fn restore_after_reply_hooks(&mut self, saved: Option<Box<Config>>)
Source§impl Session
impl Session
Sourcepub fn start_compose(&mut self, kind: ComposeKind) -> Option<Ask>
pub fn start_compose(&mut self, kind: ComposeKind) -> Option<Ask>
Start a draft: new, a reply, or a forward. The first question comes back, or none when nothing needs asking.
Sourcepub fn start_list_reply(&mut self) -> Option<Ask>
pub fn start_list_reply(&mut self) -> Option<Ask>
L: reply to the mailing list. Refuses when the message names
no list rmut knows of, rather than quietly replying to the
author, which is the mistake list-reply exists to prevent.
Sourcepub fn cancel_setup(&mut self)
pub fn cancel_setup(&mut self)
Give up on the draft that was being set up.
Source§impl Session
impl Session
Sourcepub fn run_function(
&mut self,
function: Function,
tagged: bool,
page: usize,
) -> Outcome
pub fn run_function( &mut self, function: Function, tagged: bool, page: usize, ) -> Outcome
Do one thing, whatever asked for it: a key, a macro replay, a
:exec, a menu item.
tagged is mutt’s tag-prefix, and is only ever true for a
function that takes it; page is how
many messages the front end is showing at once, which is all
the geometry the session needs to know.
Source§impl Session
impl Session
Sourcepub fn open(dir: &Path, config: Config) -> Result<(Session, Vec<String>)>
pub fn open(dir: &Path, config: Config) -> Result<(Session, Vec<String>)>
Open a maildir.
Warnings come back rather than going out as notices: at this point no front end has installed a sink, and they are its to show together with whatever its own setup had to say.
Sourcepub fn open_spec(
spec: &str,
config: Config,
progress: Progress,
) -> Result<(Session, Vec<String>)>
pub fn open_spec( spec: &str, config: Config, progress: Progress, ) -> Result<(Session, Vec<String>)>
Open a mailbox by spec: an imap:account[/folder] string (the
folder is mirrored into a cache maildir) or a local path.
progress is how the front end shows slow network work; a
library caller that has nothing to show passes a closure that
throws the lines away.
Sourcepub fn open_mbox(path: &Path, config: Config) -> Result<(Session, Vec<String>)>
pub fn open_mbox(path: &Path, config: Config) -> Result<(Session, Vec<String>)>
Open an mbox file (e.g. /var/mail/$USER) through its cache
mirror; $ sync writes changes back into the file.
Sourcepub fn recompile(&mut self) -> Vec<String>
pub fn recompile(&mut self) -> Vec<String>
Recompile what the session derives from the config, after a command changed it.
Sourcepub fn switch_to(&mut self, spec: &str, read_only: bool)
pub fn switch_to(&mut self, spec: &str, read_only: bool)
Open another mailbox in place: the same session, pointed somewhere else.
The config, the -R flag and the notice sink stay; everything
about the old mailbox goes. A local mailbox opens on the spot.
One on the server opens in the background while this one stays
on screen: another folder of the open account reuses the live
connection (a SELECT) instead of a fresh connect and login, and
anything else, or a SELECT that fails, connects on a thread of
its own. Keys typed meanwhile wait (Session::holding), and
Ctrl+G gives up. Either way the front end hears
Request::Opened with the warnings to show, or an error.
read_only is mutt’s Alt+c: the mailbox opens, and refuses to
be written to.
Sourcepub fn holding(&self) -> bool
pub fn holding(&self) -> bool
Whether a mailbox is being opened: the keys typed meanwhile are for the mailbox that is coming, so a front end holds them until this is false. Ctrl+G still goes through, to give up.
Sourcepub fn install_notices(&mut self, sink: Box<dyn NoticeSink>)
pub fn install_notices(&mut self, sink: Box<dyn NoticeSink>)
Hand the session the front end’s notice sink. Until this is called nothing said is kept.
Sourcepub fn clear_notice(&mut self)
pub fn clear_notice(&mut self)
Forget the last notice: the front end has shown it, or the user has moved on.
pub fn new_count(&self) -> usize
pub fn deleted_count(&self) -> usize
pub fn pending_count(&self) -> usize
Sourcepub fn thread_info(&self, mi: usize) -> (usize, Option<usize>)
pub fn thread_info(&self, mi: usize) -> (usize, Option<usize>)
(depth, hidden-count-if-collapsed-root) for the index display.
pub fn select(&mut self, index: usize)
pub fn cur_mut(&mut self) -> Option<&mut Msg>
pub fn selected_path(&self) -> Option<PathBuf>
Sourcepub fn deny_readonly(&mut self) -> bool
pub fn deny_readonly(&mut self) -> bool
True (with a status note) when a mutating operation must be
refused because of rmut -R.
pub fn mark_read(&mut self)
Sourcepub fn scope(&self, position: Position) -> Scope<'_>
pub fn scope(&self, position: Position) -> Scope<'_>
What the pattern engine needs beyond one message: my addresses, the configured mailing lists, and the place in the list.
Sourcepub fn scope_at(&self, position: Position, mi: usize) -> Scope<'_>
pub fn scope_at(&self, position: Position, mi: usize) -> Scope<'_>
The scope with the message’s place in its thread filled in, for
the thread terms. Only a threaded index has threads; elsewhere
~(P) reads as P and the rest are false, as documented.
Sourcepub fn rescan(&mut self)
pub fn rescan(&mut self)
Re-read the maildir, keeping unsynced flag changes and deletion marks for messages that are still there.
Sourcepub fn check_new_mail(&mut self)
pub fn check_new_mail(&mut self)
Look for new mail: the server first, then the mbox file, the other configured mailboxes, and this one’s own maildir.
The server’s part goes off to the connection’s thread and the rest follows when it answers, so a poll tick never stops the screen. Everything local happens straight away.
Sourcepub fn poll_network(&mut self)
pub fn poll_network(&mut self)
Collect whatever the connection has finished, and carry on the operation that was waiting for it. A front end calls this every time round its loop; it costs nothing when nothing is running.
Sourcepub fn busy(&self) -> Option<&'static str>
pub fn busy(&self) -> Option<&'static str>
What the connection is doing, for a front end that says so.
Sourcepub fn abort_network(&mut self)
pub fn abort_network(&mut self)
mutt’s Ctrl+G: give up on whatever the connection is doing. The operation waiting for it says it was aborted; the next one gets a fresh connection.
Sourcepub fn idle_kick(&self) -> bool
pub fn idle_kick(&self) -> bool
Whether the open IMAP folder’s IDLE watcher has seen a change since it was last asked.
Sourcepub fn maybe_backfill(&mut self)
pub fn maybe_backfill(&mut self)
Spawn (or finish) the background mirror for a huge folder’s leftover headers; the poll rescan integrates them as they land.
Sourcepub fn error_history(&self) -> Vec<String>
pub fn error_history(&self) -> Vec<String>
Apply f to every tagged message, marking them dirty.
mutt’s error-history: what has gone wrong lately, oldest
first. Empty when $error_history is 0.
Sourcepub fn next_unread_mailbox(&self) -> Option<String>
pub fn next_unread_mailbox(&self) -> Option<String>
mutt’s next-unread-mailbox: the next configured mailbox after the open one that holds new mail (a local new/ with files, an IMAP folder with an unseen count), wrapping round. None when no mailbox has any, which mutt reports as an error.
Sourcepub fn delete_rules(&self) -> DeleteRules
pub fn delete_rules(&self) -> DeleteRules
What a deletion has to respect: mutt’s $flag_safe (a flagged message stays) and $delete_untag (the mark takes the tag off).
pub fn each_tagged(&mut self, what: &str, f: impl Fn(&mut Msg))
Sourcepub fn op_targets(&self, tagged: bool) -> Vec<usize>
pub fn op_targets(&self, tagged: bool) -> Vec<usize>
The selected message’s raw bytes, completing a header-only IMAP
cache file first. Failures land in the status line.
The messages an operation applies to: the tagged set when ;
asked for it, otherwise the one under the cursor. Tagged means
tagged anywhere, limit or no limit, like the other tagged ops.
What an operation applies to: the tagged set when ; asked
for it, otherwise the message under the cursor.
Sourcepub fn push_undo(&mut self, what: &str, indices: &[usize])
pub fn push_undo(&mut self, what: &str, indices: &[usize])
Remember indices as they stand, so z can put them back.
Steps with nothing in them are not worth a slot.
pub fn push_undo_step(&mut self, step: UndoStep)
pub fn mark(&self, i: usize) -> MsgMark
Sourcepub fn undo_last(&mut self)
pub fn undo_last(&mut self)
Walk back the last step: the marks it saved go back onto the messages that still carry those paths, and any file it created is removed. Writing the mailbox drops the stack, so a step here is always one that has not reached disk. Walk back the last step on the stack.
Sourcepub fn message_bytes(&mut self, i: usize) -> Option<Vec<u8>>
pub fn message_bytes(&mut self, i: usize) -> Option<Vec<u8>>
The raw message on disk, fetched first when the IMAP cache holds headers only.
pub fn full_message_bytes(&mut self) -> Option<Vec<u8>>
Sourcepub fn op_bytes(&mut self, tagged: bool) -> Option<Vec<u8>>
pub fn op_bytes(&mut self, tagged: bool) -> Option<Vec<u8>>
Every message the operation applies to, back to back.
Sourcepub fn rebuild_visible(&mut self, keep: Option<PathBuf>)
pub fn rebuild_visible(&mut self, keep: Option<PathBuf>)
Rebuild visible from the limit and collapsed threads, keeping
the selection on the message at keep when still visible.
pub fn apply_sort(&mut self)
pub fn toggle_collapse(&mut self, all: bool)
Sourcepub fn step_message(&self, forward: bool, skip_deleted: bool) -> Option<usize>
pub fn step_message(&self, forward: bool, skip_deleted: bool) -> Option<usize>
The next/previous visible position from the selection; mutt’s next-/previous-undeleted skips messages flagged for deletion.
Sourcepub fn thread_mark(&mut self, sub: bool, op: ThreadOp)
pub fn thread_mark(&mut self, sub: bool, op: ThreadOp)
mutt’s delete-thread / undelete-thread / tag-thread and their subthread halves: one keystroke, one undo step, however many messages hang off it.
Sourcepub fn jump_parent(&mut self, root: bool)
pub fn jump_parent(&mut self, root: bool)
mutt’s parent-message / root-message. A parent folded away under its root is reached as the root, which is what is on screen.
Sourcepub fn break_thread(&mut self)
pub fn break_thread(&mut self)
mutt’s break-thread: the selected message forgets its In-Reply-To and References, so the subthread under it becomes a thread of its own. The message is rewritten on disk, as mutt’s mutt_break_thread has it rewritten on sync.
Sourcepub fn link_threads(&mut self)
pub fn link_threads(&mut self)
mutt’s link-threads: the tagged messages become replies to the selected one. As in mutt’s link_threads, each child’s headers are replaced by an In-Reply-To naming the parent, and the child is untagged.
Sourcepub fn edit_label(&mut self, value: &str, tagged: bool)
pub fn edit_label(&mut self, value: &str, tagged: bool)
mutt’s edit-label: write X-Label on every target, one undo step, and re-sort (sort=label, %y and ~y all read it). Local maildirs only, like the thread rewrites. An empty value clears the header.
Sourcepub fn subject_threaded(&self, mi: usize) -> bool
pub fn subject_threaded(&self, mi: usize) -> bool
True when the subject fallback, not a References chain, put this message under its parent: mutt draws a star in the tree where the arrow would be, and so does rmut.
mutt’s $hide_thread_subject: true when this message is a thread reply whose subject repeats its parent’s, so the index blanks it. Off by default, where mutt has it on, so rmut keeps its look until asked.
Sourcepub fn toggle_write(&mut self)
pub fn toggle_write(&mut self)
mutt’s toggle-write (%): flip the mailbox’s writable state for the session. The -R session flag cannot be turned off this way, as mutt refuses too.
Sourcepub fn show_limit(&mut self)
pub fn show_limit(&mut self)
mutt’s show-limit: the active limit pattern, or that there is none.
Sourcepub fn reply_subject(&self, orig: &str) -> String
pub fn reply_subject(&self, orig: &str) -> String
The subject a reply carries, under $reply_regexp.
Sourcepub fn jump_thread(&mut self, forward: bool)
pub fn jump_thread(&mut self, forward: bool)
mutt’s next-thread / previous-thread: the first message of the thread either side of this one.
pub fn jump_new(&mut self, forward: bool)
Sourcepub fn compile_search(&self, input: &str) -> Result<Vec<Pattern>, String>
pub fn compile_search(&self, input: &str) -> Result<Vec<Pattern>, String>
Apply f to every message matching input, within the active
limit (members of folded threads included; folding is display
only), and report the count.
mutt’s $simple_search: a bare one-word search (no ~) expands
through the template before parsing; anything with a ~ or
more than one word is a pattern already and parses as typed.
The config parse sites (color rules) do not go through here.
pub fn apply_pattern(&mut self, input: &str, op: PatternOp)
pub fn search_next(&mut self)
Sourcepub fn sync(&mut self, purge: bool)
pub fn sync(&mut self, purge: bool)
purge expunges deleted messages; without it they stay marked
and only flag changes are written.
Sourcepub fn create_folder(&mut self, spec: &str) -> Result<String, String>
pub fn create_folder(&mut self, spec: &str) -> Result<String, String>
An error status: rendered in the error color with a bell,
unlike informational notes (mutt’s mutt_error vs mutt_message).
Mailbox specs for the folder browser and for Tab completion at
a mailbox prompt: the configured mailboxes, the open account’s
folders (IMAP LIST), and maildirs discovered next to the open
one.
mutt’s folder management from the browser. A spec names an
imap:account/folder of the open account, or a local path; a
remote verb goes to the connection, a local one touches the
filesystem. Returns what to say on success.
pub fn delete_folder(&mut self, spec: &str) -> Result<String, String>
pub fn set_subscribed(&mut self, spec: &str, on: bool) -> Result<String, String>
Sourcepub fn rename_folder(&mut self, spec: &str, new: &str) -> Result<String, String>
pub fn rename_folder(&mut self, spec: &str, new: &str) -> Result<String, String>
Rename a mailbox to new (a bare folder name for an imap spec,
or a path for a local maildir).
Sourcepub fn folder_candidates(&mut self) -> Vec<(String, usize)>
pub fn folder_candidates(&mut self) -> Vec<(String, usize)>
The mailboxes a folder browser or mailbox completion offers: the configured ones, and the open account’s folders (or the maildirs beside a local one).
The server’s folders are its last listing, so this never
waits: with none yet a LIST goes off, and
Request::FoldersChanged says when to ask again.
Sourcepub fn refresh_folders(&mut self)
pub fn refresh_folders(&mut self)
Ask the server for its folders again, for a browser that is
opening: it shows the last list at once, and the fresh one
follows with Request::FoldersChanged.
Sourcepub fn unseen_count(&self, spec: &str) -> usize
pub fn unseen_count(&self, spec: &str) -> usize
How many unread messages a configured mailbox holds, for a front end drawing a sidebar.
A local maildir is counted on the spot. A folder on the server
costs a STATUS, so the number is the last one the connection
gave: Session::refresh_unseen asks for a fresh set in the
background, and says so when they land. Other accounts show 0
rather than costing a connection of their own.
Sourcepub fn store_edited(&mut self, path: &Path, edited: &[u8])
pub fn store_edited(&mut self, path: &Path, edited: &[u8])
Put an edited message back: on IMAP the edited copy is appended and the original marked deleted (mutt does the same, since a message on a server cannot be rewritten in place), locally the file is written over and the mailbox rescanned.
Sourcepub fn mark_all_read(&mut self)
pub fn mark_all_read(&mut self)
mutt’s $mark_old (on by default): when leaving the mailbox, unread new mail ages to old: moved out of new/ without the seen flag, shown as O and no longer counted as new. mark-all-read (Alt+a): every unread message in the mailbox marked seen, one undo step. mutt spells this as tag-pattern gymnastics; here it is a function of its own.
Sourcepub fn tag_span(&mut self, a: usize, b: usize)
pub fn tag_span(&mut self, a: usize, b: usize)
Tag every visible message between the two positions (inclusive, either order): the pointer’s range gesture (shift+click in the window). One undo step, like any sweep.
pub fn mark_old_unread(&mut self)
Sourcepub fn ready_to_leave(&mut self) -> bool
pub fn ready_to_leave(&mut self) -> bool
Leaving the mailbox (c, sidebar open, folder browser): flag changes are written silently like q; only pending deletions block the switch. True when it is safe to go.
Sourcepub fn smtp_account(&self) -> Option<Account>
pub fn smtp_account(&self) -> Option<Account>
Which account to submit outgoing mail through. Explicit sendmail configuration ($RMUT_SENDMAIL or mail.sendmail) wins; otherwise the open mailbox’s account, or the first one with an smtp_host.
Sourcepub fn copy_message(
&mut self,
input: &str,
delete: bool,
tagged: bool,
decode: bool,
)
pub fn copy_message( &mut self, input: &str, delete: bool, tagged: bool, decode: bool, )
Copy the message to a mailbox (local maildir path or a folder
of the open IMAP account); with delete the original is marked
deleted afterwards, mutt’s s versus C.
Sourcepub fn create_alias(&mut self, nick: &str, addr: &str)
pub fn create_alias(&mut self, nick: &str, addr: &str)
mutt’s create-alias: one line appended to the alias file.
Sourcepub fn pipe_message(&mut self, command: &str, tagged: bool)
pub fn pipe_message(&mut self, command: &str, tagged: bool)
Pipe the raw message to a shell command, like mutt’s |. With
; the tagged messages are concatenated into one run of the
command, which is what mutt does with $pipe_split unset.
Sourcepub fn bounce_current(&mut self, to: &str, tagged: bool)
pub fn bounce_current(&mut self, to: &str, tagged: bool)
Resend the message as-is to new recipients: Resent-* headers on top, the rest untouched.
Sourcepub fn open_message(&mut self)
pub fn open_message(&mut self)
Open the selected message: the body if it is not here yet, then the view, which the front end is asked to show.
Sourcepub fn load_view(&mut self, path: &Path) -> Result<MessageView>
pub fn load_view(&mut self, path: &Path) -> Result<MessageView>
Fetch (IMAP), parse, and PGP-process a message the way the pager shows it.
Sourcepub fn print_current(&mut self, tagged: bool)
pub fn print_current(&mut self, tagged: bool)
Pipe the message to the print command (lpr by default). mutt’s $print_decode (on) prints the decoded form; $print_split runs the command once per message.
Sourcepub fn current_identity(&self, rcpts: &[String]) -> Identity
pub fn current_identity(&self, rcpts: &[String]) -> Identity
The identity in effect for this mailbox (and, when known, the draft’s recipients).
Sourcepub fn matching_message_hooks(&self) -> Vec<usize>
pub fn matching_message_hooks(&self) -> Vec<usize>
Indices of the message-hooks the selected message matches.
Sourcepub fn reply_hook_lines(&self, path: &Path) -> Vec<String>
pub fn reply_hook_lines(&self, path: &Path) -> Vec<String>
mutt’s reply-hook: the command lines whose pattern matches the message being replied to. Running them is the front end’s, and so is putting the config back afterwards.
Sourcepub fn fcc_hook_target(&self, draft: &str, path: &Path) -> Option<String>
pub fn fcc_hook_target(&self, draft: &str, path: &Path) -> Option<String>
mutt’s fcc-hook: the mailbox the first matching entry names for this outgoing draft, or None when nothing matches.
Sourcepub fn crypt_key_for(&self, address: &str) -> Option<String>
pub fn crypt_key_for(&self, address: &str) -> Option<String>
mutt’s crypt-hook: a recipient with a hook of its own is encrypted to that key id instead of to its address.
Sourcepub fn notmuch_mirror(&mut self, query: &str) -> Option<(PathBuf, usize)>
pub fn notmuch_mirror(&mut self, query: &str) -> Option<(PathBuf, usize)>
X submitted: notmuch search --output=files into a virtual
read-only mailbox: the hits are symlinked into a cache
maildir (the real copies stay where they are), so viewing,
replying, copying, and piping work while flag changes and
deletes stay refused.
Mirror a notmuch query into a maildir of symlinks, ready to be
opened. Returns where it is and how many messages it holds.
pub fn compose_base(&self) -> Option<ComposeBase>
Sourcepub fn list_target(&self, base: &ComposeBase) -> Option<String>
pub fn list_target(&self, base: &ComposeBase) -> Option<String>
The To prompt, prefilled for replies with Reply-To (the question’s yes) or the plain From (its no). Where a list reply goes: the list’s own List-Post address when it published one, else the first To/Cc address that matches a configured list.
Sourcepub fn followup_header(
&self,
to: &str,
cc: Option<&str>,
from: &str,
) -> Option<String>
pub fn followup_header( &self, to: &str, cc: Option<&str>, from: &str, ) -> Option<String>
mutt’s $followup_to: mail going to a known list carries a Mail-Followup-To, so replies land on the list. Being subscribed leaves my own address out, since the list copy is the one I get.
Sourcepub fn edit_headers(&self) -> bool
pub fn edit_headers(&self) -> bool
mutt’s edit_headers (default false, like mutt): whether the header block is part of the editor buffer.
Sourcepub fn stage_draft(&self, text: &str) -> Result<(PathBuf, Option<String>)>
pub fn stage_draft(&self, text: &str) -> Result<(PathBuf, Option<String>)>
Write a fresh draft file for the editor: the whole text (with
any my_hdr merged in), or (with edit_headers = false) only
the body, the header block withheld for draft_full to rejoin.
Sourcepub fn compose_from(
&self,
base: Option<&ComposeBase>,
to: &str,
) -> Option<String>
pub fn compose_from( &self, base: Option<&ComposeBase>, to: &str, ) -> Option<String>
From line for a new draft: reverse_name picks the address the replied-to message came to; otherwise the layered identity (global, account, matching [[identities]] rules).
pub fn forward_attaches(&self) -> bool
Sourcepub fn default_fcc(&self, draft: Option<&Compose>) -> String
pub fn default_fcc(&self, draft: Option<&Compose>) -> String
The sent copy’s default target, as the Fcc line shows it. An
fcc-hook matching the draft on screen wins, so the menu shows
where the copy is really going.
Where the sent copy goes by default, as the Fcc line shows it.
An fcc-hook matching draft wins, so the menu shows where the
copy is really going; delivery passes None, having resolved
the hook when the message was sent.
Sourcepub fn default_security(&self) -> Security
pub fn default_security(&self) -> Security
Initial security for a fresh draft, from the pgp config.
Sourcepub fn security_for(
&self,
kind: &ComposeKind,
base: Option<&ComposeBase>,
) -> Security
pub fn security_for( &self, kind: &ComposeKind, base: Option<&ComposeBase>, ) -> Security
The security a fresh draft starts with. mutt’s reply-crypto: replying to a signed message can default to signed ($crypt_replysign), to an encrypted one to encrypted ($crypt_replyencrypt), and to signed-and-encrypted mail to signed too ($crypt_replysignencrypted). Detection reads the original’s MIME type only, never decrypting.
Sourcepub fn tick_outbox(&mut self)
pub fn tick_outbox(&mut self)
Anything due in the outbox goes out; whatever still waits owns the status line, counting down.
Sourcepub fn flush_outbox(&mut self) -> Vec<String>
pub fn flush_outbox(&mut self) -> Vec<String>
Send everything still waiting, on the way out: the messages
were confirmed, only z takes one back.
Send everything still waiting, on the way out: the messages
were confirmed, only z takes one back. Trouble comes back as
lines for the front end to print once the terminal is its own
again, since nobody would see a message line by then.
Sourcepub fn hold_send(&mut self, held: Held)
pub fn hold_send(&mut self, held: Held)
Hold a sent message for its $undo_send window. It goes out on the next tick after it falls due, or when the session is flushed on the way out.
Sourcepub fn cancel_send(&mut self) -> bool
pub fn cancel_send(&mut self) -> bool
Take the newest held message back, draft and all. None when nothing was waiting.
Sourcepub fn deliver(&mut self, held: Held)
pub fn deliver(&mut self, held: Held)
Transmit a held message and keep the Fcc copy. Transmit a held message and keep the Fcc copy. A send that fails hands the draft back, for the front end to put on screen again.
Sourcepub fn attachment_forgotten(&self, raw: &str, compose: &Compose) -> bool
pub fn attachment_forgotten(&self, raw: &str, compose: &Compose) -> bool
neomutt’s attachment reminder: does the body mention one when
nothing is attached? Quoted lines and anything below a --
signature do not count, so a reply to “see attached” and a
signature naming one are not false alarms.
Sourcepub fn secure_message(
&self,
security: Security,
text: String,
files: &[Attachment],
original: Option<&[u8]>,
) -> Result<String>
pub fn secure_message( &self, security: Security, text: String, files: &[Attachment], original: Option<&[u8]>, ) -> Result<String>
Assemble the outgoing message from a finalized draft: files
and the forwarded original first turn it into multipart/mixed,
then the chosen PGP treatment wraps whatever entity resulted.
pub fn postponed_dir(&self) -> Option<PathBuf>
pub fn has_postponed(&self) -> bool
Sourcepub fn postpone_draft(&mut self, compose_state: Compose)
pub fn postpone_draft(&mut self, compose_state: Compose)
mutt’s postpone: the draft goes to the postponed maildir, headers and all, ready for a recall.
Sourcepub fn recall_file(&mut self, source: PathBuf) -> Option<Compose>
pub fn recall_file(&mut self, source: PathBuf) -> Option<Compose>
A postponed draft read back into a compose state, for the front end to hand to the editor. None when it cannot be read.
Sourcepub fn draft_head(&self) -> String
pub fn draft_head(&self) -> String
The draft’s header block, wherever it currently lives.
Sourcepub fn edit_draft_head(&mut self, f: impl Fn(&str) -> String)
pub fn edit_draft_head(&mut self, f: impl Fn(&str) -> String)
Rewrite the draft’s header block in place (hidden or in-file).
Sourcepub fn set_draft_header(&mut self, name: &str, value: &str)
pub fn set_draft_header(&mut self, name: &str, value: &str)
Replace (or add, or with an empty value drop) one header.
pub fn draft_header(&self, name: &str) -> String
Sourcepub fn send_draft(&mut self) -> Option<Ask>
pub fn send_draft(&mut self) -> Option<Ask>
Send the draft in hand. It may need a question answered first, and if it cannot go the draft stays in hand with a request to put it back on screen.
pub fn draft_mut(&mut self) -> Option<&mut Compose>
Sourcepub fn take_draft(&mut self) -> Option<Compose>
pub fn take_draft(&mut self) -> Option<Compose>
Take it out of the session’s hands (the front end is about to edit it, postpone it, or throw it away).
Sourcepub fn set_draft(&mut self, draft: Compose)
pub fn set_draft(&mut self, draft: Compose)
Put one back, after an editor has been over it. The editor has come back: the draft is in hand. mutt’s $abort_unmodified drops it instead when the first pass changed nothing, which is what an editor quit with :q looks like from here. A re-edit from the compose menu is not a first pass and is never dropped, so a deliberate second look costs nothing.
Sourcepub fn set_attach_field(&mut self, k: usize, input: &str, is_type: bool)
pub fn set_attach_field(&mut self, k: usize, input: &str, is_type: bool)
The submitted d / ctrl+t edit: rewrite the k-th Attach: line
with the new description or content-type.
The submitted description or content-type for the k-th
Attach: line.
Sourcepub fn attach_index(&mut self, sel: usize) -> Option<usize>
pub fn attach_index(&mut self, sel: usize) -> Option<usize>
D in the compose menu: drop the selected Attach: line (the
body and a forwarded original cannot be detached).
Drop the Attach: line the menu’s sel-th row stands for.
The k of the Attach: file a compose-menu row names, or an
error when the row is the body or the forwarded original.
Sourcepub fn attachments(&self) -> Vec<Attachment>
pub fn attachments(&self) -> Vec<Attachment>
The draft’s Attach: files as they stand.
Sourcepub fn edit_attachment(&mut self, k: usize, f: impl Fn(&mut Attachment))
pub fn edit_attachment(&mut self, k: usize, f: impl Fn(&mut Attachment))
Rewrite the k-th Attach: line through f.
Sourcepub fn toggle_unlink(&mut self, sel: usize)
pub fn toggle_unlink(&mut self, sel: usize)
mutt’s toggle-unlink (u): the file goes once the message has been sent.
Sourcepub fn toggle_disposition(&mut self, sel: usize)
pub fn toggle_disposition(&mut self, sel: usize)
mutt’s toggle-disposition (Ctrl+D): inline or attachment.
Sourcepub fn move_attachment(&mut self, sel: usize, up: bool) -> bool
pub fn move_attachment(&mut self, sel: usize, up: bool) -> bool
mutt’s move-up / move-down: the k-th Attach: line swaps with its neighbour. Whether anything moved.
Sourcepub fn attach_messages(&mut self)
pub fn attach_messages(&mut self)
mutt’s attach-message (A): mutt opens a mailbox and has you tag messages in it; rmut takes the tagged messages of the open mailbox (the one under the cursor when none is tagged), each as a message/rfc822 part, inline as mutt makes them. A header-only IMAP cache file is refused: open it first.
Sourcepub fn new_mime(&mut self, path: &str, mime: &str)
pub fn new_mime(&mut self, path: &str, mime: &str)
mutt’s new-mime, both halves answered: the file exists (made empty when it did not), is attached under the type given, and goes to the editor.
Sourcepub fn ispell_command(&self) -> Option<String>
pub fn ispell_command(&self) -> Option<String>
mutt’s ispell (i): the command that spell-checks the draft on
the real terminal, $ispell -x FILE.
Sourcepub fn write_draft_to(&mut self, mailbox: &str)
pub fn write_draft_to(&mut self, mailbox: &str)
mutt’s write-fcc (w): the message as it stands into a mailbox (a local maildir, or a folder of the open IMAP account), not sent, the draft untouched.
pub fn detach(&mut self, sel: usize)
Sourcepub fn attach_file(&mut self, input: &str)
pub fn attach_file(&mut self, input: &str)
Add an Attach: line to the draft’s header block without a
trip through the editor (send prompt a).
A file added to the draft as an Attach: line.