Skip to main content

Session

Struct Session 

Source
pub struct Session {
    pub entry: Entry,
    pub term: Terminal,
    pub state: State,
    pub error: Option<String>,
    pub tap: Option<Vec<u8>>,
    /* private fields */
}

Fields§

§entry: Entry§term: Terminal§state: State§error: Option<String>

Why the session closed, if it failed.

§tap: Option<Vec<u8>>

A copy of what is shown, for a script, while it is Some.

Implementations§

Source§

impl Session

Source

pub fn new( entry: Entry, cols: usize, rows: usize, config: SessionConfig, ) -> Session

Source

pub fn connect<F>(&self, sink: F)
where F: Fn(NetEvent) + Send + 'static,

Start connecting in the background; events arrive through sink and must be passed to Session::handle.

Source

pub fn handle(&mut self, ev: NetEvent)

Source

pub fn pacing(&self) -> bool

Whether received data is waiting for baud rate emulation: call Session::pump often (every frame) while it is.

Source

pub fn pump(&mut self)

Show as much paced data as the emulated baud rate allows by now: ten bits per byte, as with a modem’s start and stop bits.

Source

pub fn rip_press(&mut self, x: usize, y: usize) -> bool

A click on the RIP graphics: send what it sends. False if it sends nothing (now: a question for the user may come first).

Source

pub fn answer_rip(&mut self, answer: Option<String>)

Answer RIPscrip’s question for a text variable (None: cancelled), sending what was waiting for it.

Source

pub fn send_login(&mut self) -> bool

Send the next part of the stored login (Alt-L): the user name, then the password. False when there is nothing (more) to send.

Source

pub fn has_login(&self) -> bool

Whether the entry has a user name or password to log in with.

Source

pub fn take_events(&mut self) -> Vec<SessionEvent>

Source

pub fn transfer(&self) -> Option<&Transfer>

Source

pub fn auth_prompt(&self) -> Option<&AuthPrompt>

The login question waiting for an answer, if any.

Source

pub fn answer_prompt(&mut self, answer: Option<String>)

Answer the waiting login question; None cancels the login.

Source

pub fn upload_requested(&self) -> bool

Whether the BBS is waiting for the user to choose files to upload.

Source

pub fn start_upload(&mut self, paths: Vec<PathBuf>) -> Result<()>

Send files with ZMODEM. If a batch is already being sent, the files are added to it.

Source

pub fn start_xy_upload( &mut self, proto: XyProtocol, paths: Vec<PathBuf>, ) -> Result<()>

Send files with XMODEM or YMODEM, once the BBS’s receiver starts.

Source

pub fn start_xy_download( &mut self, proto: XyProtocol, name: Option<String>, ) -> Result<()>

Receive with XMODEM or YMODEM: asks the BBS’s sender to start. name is what an XMODEM file is saved as (YMODEM sends names).

Source

pub fn start_kermit_upload(&mut self, paths: Vec<PathBuf>) -> Result<()>

Send files with Kermit to the BBS’s Kermit, once it is receiving.

Source

pub fn start_kermit_download(&mut self) -> Result<()>

Receive with Kermit: for a BBS whose Kermit is already sending (one that starts afterwards is picked up by itself).

Source

pub fn decline_upload(&mut self)

The user chose not to upload: make the BBS’s receiver give up.

Source

pub fn cancel_transfer(&mut self)

Source

pub fn tick(&mut self)

Call periodically (a few times a second) to drive transfer timeouts.

Source

pub fn next_tick(&self) -> Option<Instant>

When Session::tick next has something to do for the terminal.

Source

pub fn send(&mut self, data: &[u8])

Send application data (keystrokes, paste, transfer data) to the remote.

Source

pub fn hang_up(&mut self)

Source

pub fn should_redial(&self) -> bool

Whether a call that has ended is worth dialing again: the connection could not be made (refused, timed out), or the BBS hung up soon after answering, saying it is busy. Not for failed logins, changed host keys and the like.

Source

pub fn was_connected(&self) -> bool

Whether the call got through (it may have ended since).

Source

pub fn elapsed(&self) -> Duration

Time since connecting (or since dialing, while still connecting).

Source

pub fn download_dir(&self) -> &Path

Source

pub fn capture_path(&self) -> Option<&Path>

Source

pub fn start_capture(&mut self, path: PathBuf) -> Result<()>

Start recording received data (after telnet decoding) to a file: all of it, or for a .txt file only the text (see CaptureKind).

Source

pub fn stop_capture(&mut self)

Trait Implementations§

Source§

impl Drop for Session

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more