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
impl Session
pub fn new( entry: Entry, cols: usize, rows: usize, config: SessionConfig, ) -> Session
Sourcepub fn connect<F>(&self, sink: F)
pub fn connect<F>(&self, sink: F)
Start connecting in the background; events arrive through sink and
must be passed to Session::handle.
pub fn handle(&mut self, ev: NetEvent)
Sourcepub fn pacing(&self) -> bool
pub fn pacing(&self) -> bool
Whether received data is waiting for baud rate emulation: call
Session::pump often (every frame) while it is.
Sourcepub fn pump(&mut self)
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.
Sourcepub fn rip_press(&mut self, x: usize, y: usize) -> bool
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).
Sourcepub fn answer_rip(&mut self, answer: Option<String>)
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.
Sourcepub fn send_login(&mut self) -> bool
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.
pub fn take_events(&mut self) -> Vec<SessionEvent>
pub fn transfer(&self) -> Option<&Transfer>
Sourcepub fn auth_prompt(&self) -> Option<&AuthPrompt>
pub fn auth_prompt(&self) -> Option<&AuthPrompt>
The login question waiting for an answer, if any.
Sourcepub fn answer_prompt(&mut self, answer: Option<String>)
pub fn answer_prompt(&mut self, answer: Option<String>)
Answer the waiting login question; None cancels the login.
Sourcepub fn upload_requested(&self) -> bool
pub fn upload_requested(&self) -> bool
Whether the BBS is waiting for the user to choose files to upload.
Sourcepub fn start_upload(&mut self, paths: Vec<PathBuf>) -> Result<()>
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.
Sourcepub fn start_xy_upload(
&mut self,
proto: XyProtocol,
paths: Vec<PathBuf>,
) -> Result<()>
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.
Sourcepub fn start_xy_download(
&mut self,
proto: XyProtocol,
name: Option<String>,
) -> Result<()>
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).
Sourcepub fn start_kermit_upload(&mut self, paths: Vec<PathBuf>) -> Result<()>
pub fn start_kermit_upload(&mut self, paths: Vec<PathBuf>) -> Result<()>
Send files with Kermit to the BBS’s Kermit, once it is receiving.
Sourcepub fn start_kermit_download(&mut self) -> Result<()>
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).
Sourcepub fn decline_upload(&mut self)
pub fn decline_upload(&mut self)
The user chose not to upload: make the BBS’s receiver give up.
pub fn cancel_transfer(&mut self)
Sourcepub fn next_tick(&self) -> Option<Instant>
pub fn next_tick(&self) -> Option<Instant>
When Session::tick next has something to do for the terminal.
Sourcepub fn send(&mut self, data: &[u8])
pub fn send(&mut self, data: &[u8])
Send application data (keystrokes, paste, transfer data) to the remote.
pub fn hang_up(&mut self)
Sourcepub fn should_redial(&self) -> bool
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.
Sourcepub fn was_connected(&self) -> bool
pub fn was_connected(&self) -> bool
Whether the call got through (it may have ended since).
Sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Time since connecting (or since dialing, while still connecting).
pub fn download_dir(&self) -> &Path
pub fn capture_path(&self) -> Option<&Path>
Sourcepub fn start_capture(&mut self, path: PathBuf) -> Result<()>
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).