Skip to main content

Session

Struct Session 

Source
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: PathBuf

The maildir on disk: the mailbox itself, or the cache mirror of an IMAP folder or an mbox file.

§title: String

What 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: usize

Selection, as an index into visible.

§sort: SortKey§sort_rev: bool§limit: Option<(String, Vec<Pattern>)>§last_search: Option<Vec<Pattern>>§search_rev: bool

Which 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: bool

rmut -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: Display

ignore/unignore/hdr_order and the [filters] table: how a message’s parts turn into the text a reader sees.

§quote_re: Regex

Compiled $quote_regexp classifying quoted body lines: a pager colours by it, and the attachment reminder skips them.

§reply_re: Regex

Compiled $reply_regexp, for the subject a reply carries.

Implementations§

Source§

impl Session

Source

pub fn ask_limit(&self) -> Ask

mutt’s limit prompt.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn ask_pipe(&self, tagged: bool) -> Option<Ask>

Source

pub fn ask_bounce(&self, tagged: bool) -> Option<Ask>

Source

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.

Source

pub fn ask_alias(&mut self) -> Option<Ask>

mutt’s create-alias, on the sender of the selected message.

Source

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.

Source

pub fn ask_sort(&self) -> Ask

Source

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.

Source

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.

Source

pub fn ask_header(&self, name: &str) -> Option<Ask>

A header of the draft in hand (To, Cc, Bcc, Subject).

Source

pub fn ask_fcc(&self) -> Option<Ask>

Where the sent copy goes, prefilled with where it would go.

Source

pub fn ask_attach_file(&self) -> Option<Ask>

Source

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.

Source

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.

Source

pub fn ask_new_mime(&self) -> Option<Ask>

mutt’s new-mime (n): a file to make and attach, then its type.

Source

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.

Source

pub fn ask_security(&self) -> Option<Ask>

Source

pub fn ask_postpone(&mut self) -> Option<Ask>

Source

pub fn ask_shell(&self) -> Ask

mutt’s !: run something with the display out of the way.

Source

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.

Source

pub fn answer(&mut self, what: AskKind, answer: Answer<'_>) -> Option<Ask>

Hand back an answer. The next question, when there is one.

Source

pub fn take_request(&mut self) -> Option<Request>

Anything the session wants the front end to do, oldest first.

Source§

impl Session

Source

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.

Source

pub fn run_folder_hooks(&mut self)

mutt’s folder-hook: the lines matching the mailbox that is now open.

Source

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.

Source

pub fn clear_message_hooks(&mut self)

Leaving the message (or the mailbox): whatever the message-hooks changed goes back.

Source

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.

Source

pub fn restore_after_reply_hooks(&mut self, saved: Option<Box<Config>>)

Source§

impl Session

Source

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.

Source

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.

Source

pub fn start_forward_part(&mut self, index: usize) -> Option<Ask>

mutt’s forward-message in the attachment menu, for the part at index of the selected message: a part that reads as text is quoted the way a forward quotes a body, and one that does not is attached, as mutt’s $mime_forward_rest has it. With that off, such a part is refused rather than sent as an empty forward. forward = “attach” (mutt’s $mime_forward) attaches the part whatever it is.

Source

pub fn cancel_setup(&mut self)

Give up on the draft that was being set up.

Source§

impl Session

Source

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

Source

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.

Source

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.

Source

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.

Source

pub fn recompile(&mut self) -> Vec<String>

Recompile what the session derives from the config, after a command changed it.

Source

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.

Source

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.

Source

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.

Source

pub fn clear_notice(&mut self)

Forget the last notice: the front end has shown it, or the user has moved on.

Source

pub fn new_count(&self) -> usize

Source

pub fn deleted_count(&self) -> usize

Source

pub fn pending_count(&self) -> usize

Source

pub fn thread_info(&self, mi: usize) -> (usize, Option<usize>)

(depth, hidden-count-if-collapsed-root) for the index display.

Source

pub fn select(&mut self, index: usize)

Source

pub fn cur_mut(&mut self) -> Option<&mut Msg>

Source

pub fn selected_path(&self) -> Option<PathBuf>

Source

pub fn deny_readonly(&mut self) -> bool

True (with a status note) when a mutating operation must be refused because of rmut -R.

Source

pub fn mark_read(&mut self)

Source

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.

Source

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.

Source

pub fn me(&self) -> Me<'_>

Which addresses are mine: the identity ones plus alternates.

Source

pub fn rescan(&mut self)

Re-read the maildir, keeping unsynced flag changes and deletion marks for messages that are still there.

Source

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.

Source

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.

Source

pub fn busy(&self) -> Option<&'static str>

What the connection is doing, for a front end that says so.

Source

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.

Source

pub fn idle_kick(&self) -> bool

Whether the open IMAP folder’s IDLE watcher has seen a change since it was last asked.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn each_tagged(&mut self, what: &str, f: impl Fn(&mut Msg))

Source

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.

Source

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.

Source

pub fn push_undo_step(&mut self, step: UndoStep)

Source

pub fn mark(&self, i: usize) -> MsgMark

Source

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.

Source

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.

Source

pub fn full_message_bytes(&mut self) -> Option<Vec<u8>>

Source

pub fn op_bytes(&mut self, tagged: bool) -> Option<Vec<u8>>

Every message the operation applies to, back to back.

Source

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.

Source

pub fn apply_sort(&mut self)

Source

pub fn toggle_collapse(&mut self, all: bool)

Source

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.

Source

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.

Source

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.

Source

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.

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.

Source

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.

Source

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.

Source

pub fn subject_hidden(&self, mi: usize) -> bool

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.

Source

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.

Source

pub fn show_limit(&mut self)

mutt’s show-limit: the active limit pattern, or that there is none.

Source

pub fn reply_subject(&self, orig: &str) -> String

The subject a reply carries, under $reply_regexp.

Source

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.

Source

pub fn jump_new(&mut self, forward: bool)

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.

Source

pub fn apply_pattern(&mut self, input: &str, op: PatternOp)

Source

pub fn search_next(&mut self)

Source

pub fn sync(&mut self, purge: bool)

purge expunges deleted messages; without it they stay marked and only flag changes are written.

Source

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.

Source

pub fn delete_folder(&mut self, spec: &str) -> Result<String, String>

Source

pub fn set_subscribed(&mut self, spec: &str, on: bool) -> Result<String, String>

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn mark_old_unread(&mut self)

Source

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.

Source

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.

Source

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.

Source

pub fn create_alias(&mut self, nick: &str, addr: &str)

mutt’s create-alias: one line appended to the alias file.

Source

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.

Source

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.

Source

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.

Source

pub fn load_view(&mut self, path: &Path) -> Result<MessageView>

Fetch (IMAP), parse, and PGP-process a message the way the pager shows it.

Source

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.

Source

pub fn current_identity(&self, rcpts: &[String]) -> Identity

The identity in effect for this mailbox (and, when known, the draft’s recipients).

Source

pub fn matching_message_hooks(&self) -> Vec<usize>

Indices of the message-hooks the selected message matches.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn compose_base(&self) -> Option<ComposeBase>

Source

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.

Source

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.

Source

pub fn edit_headers(&self) -> bool

mutt’s edit_headers (default false, like mutt): whether the header block is part of the editor buffer.

Source

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.

Source

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).

Source

pub fn forward_attaches(&self) -> bool

Source

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.

Source

pub fn default_security(&self) -> Security

Initial security for a fresh draft, from the pgp config.

Source

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.

Source

pub fn tick_outbox(&mut self)

Anything due in the outbox goes out; whatever still waits owns the status line, counting down.

Source

pub fn flush_on_exit(&mut self) -> Vec<String>

Everything still owed on the way out. The messages held for $undo_send go (they were confirmed; only z takes one back), then whatever the server has yet to hear: see Session::wind_down. 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.

Source

pub fn wind_down(&mut self)

Before this session goes, on quit or with another mailbox taking its place: what is in flight is waited for, and the jobs queued behind it go out too (a sync q asked for behind a new-mail check, the copies kept in the background), which were dropped with the session. A read, a switch or a poll queued for a screen that is going away is not. The screen waits; the session is leaving anyway, and each wait has the network timeout.

Source

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.

Source

pub fn cancel_send(&mut self) -> bool

Take the newest held message back, draft and all. None when nothing was waiting.

Source

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.

Source

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.

Source

pub fn secure_message( &self, security: Security, text: String, files: &[Attachment], original: Option<&[u8]>, markdown: bool, ) -> 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.

Source

pub fn postponed_dir(&self) -> Option<PathBuf>

Source

pub fn has_postponed(&self) -> bool

Source

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.

Source

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.

Source

pub fn draft_head(&self) -> String

The draft’s header block, wherever it currently lives.

Source

pub fn edit_draft_head(&mut self, f: impl Fn(&str) -> String)

Rewrite the draft’s header block in place (hidden or in-file).

Source

pub fn set_draft_header(&mut self, name: &str, value: &str)

Replace (or add, or with an empty value drop) one header.

Source

pub fn draft_header(&self, name: &str) -> String

Source

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.

Source

pub fn draft_markdown(&self) -> bool

Whether the draft in hand goes out as markdown, as the compose menu shows it.

Source

pub fn toggle_draft_markdown(&mut self)

The compose menu’s M: markdown on or off for this draft.

Source

pub fn draft(&self) -> Option<&Compose>

The draft in hand, for a front end showing it.

Source

pub fn draft_mut(&mut self) -> Option<&mut Compose>

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub fn attachments(&self) -> Vec<Attachment>

The draft’s Attach: files as they stand.

Source

pub fn edit_attachment(&mut self, k: usize, f: impl Fn(&mut Attachment))

Rewrite the k-th Attach: line through f.

mutt’s toggle-unlink (u): the file goes once the message has been sent.

Source

pub fn toggle_disposition(&mut self, sel: usize)

mutt’s toggle-disposition (Ctrl+D): inline or attachment.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn detach(&mut self, sel: usize)

Source

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.

Source

pub fn error(&mut self, msg: impl Into<String>)

Source

pub fn note(&mut self, msg: impl Into<String>)

Something worth saying that is not a complaint.

Source

pub fn notice(&self) -> Option<&Notice>

The last thing said, for the message line and for the callers that only speak up when nothing else has.

Source§

impl Session

Source

pub fn open_url(&mut self, url: &str)

Open a URL with [ui] url_command (xdg-open, or open on macOS), the URL its last argument or in place of a %s. No shell, so nothing in the URL is ever run; the opener is left to itself and reaped on a thread of its own.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.