Skip to main content

AppHandle

Struct AppHandle 

Source
pub struct AppHandle { /* private fields */ }

Implementations§

Source§

impl AppHandle

Source

pub async fn start() -> Result<Self>

Source

pub async fn start_with_options( mode: NetworkMode, port: u16, master_key: Option<&[u8; 32]>, ) -> Result<Self>

Source

pub async fn start_with_db(db: Db) -> Result<Self>

Source

pub async fn start_with_db_and_options( db: Db, mode: NetworkMode, port: u16, ) -> Result<Self>

Source

pub fn mode(&self) -> NetworkMode

Source

pub fn subscribe(&self) -> Receiver<AppEvent>

Source

pub fn fingerprint(&self) -> &str

Source

pub fn peer_id(&self) -> PeerId

Source

pub fn discovered_rooms(&self) -> Vec<DiscoveredRoom>

Source

pub fn active_room_ids(&self) -> Vec<String>

Source

pub fn active_room_info(&self, room_id: &str) -> Option<StoredRoom>

Source

pub fn room_members(&self, room_id: &str) -> Vec<String>

Source

pub fn room_messages( &self, room_id: &str, limit: i64, ) -> Result<Vec<StoredRoomMessage>>

Source

pub fn search_room_messages( &self, room_id: &str, query: &str, limit: i64, ) -> Result<Vec<StoredRoomMessage>>

Source

pub async fn start_room( &self, name: &str, encrypted: bool, passphrase: Option<&str>, ) -> Result<String>

Create a new room. Returns its room_id.

Source

pub async fn join_room( &self, room_id: &str, passphrase: Option<&str>, ) -> Result<()>

Join an existing room. The room may come from a live announcement (preferred), our restorable set, or the DB directly — whichever has the freshest copy. For encrypted rooms passphrase is required.

Source

pub async fn leave_room(&self, room_id: &str) -> Result<()>

Source

pub async fn send_room_message(&self, room_id: &str, body: &str) -> Result<()>

Source

pub async fn shutdown(&self)

Source

pub async fn dial(&self, input: &str) -> Result<()>

Dial a peer by a user-entered address. Accepts:

  • 1.2.3.4:9000
  • [fe80::1]:9000
  • /ip4/.../tcp/...[/p2p/<peer>] (raw multiaddr)
Source

pub fn known_peers(&self) -> Vec<KnownPeerStatus>

Source

pub async fn forget_peer(&self, address: &str) -> Result<()>

Source

pub async fn redial(&self, address: &str) -> Result<()>

Re-dial a stored address — used by the lobby’s “reconnect” action.

Source

pub async fn send_file(&self, room_id: &str, path: &Path) -> Result<String>

Send a local file to a room. Reads the file, optionally encrypts it for encrypted rooms, chunks it, broadcasts a FileOffer then each FileChunk. Returns the file_id once all chunks are queued.

Source

pub async fn save_to_downloads( &self, room_id: &str, file_id: &str, ) -> Result<PathBuf>

Save a completed/ready attachment to the user’s Downloads folder. Decrypts encrypted attachments on the way out.

Source

pub async fn cancel_transfer(&self, room_id: &str, file_id: &str) -> Result<()>

Drop any in-flight chunks and remove the attachment row.

Source

pub fn open_saved(&self, room_id: &str, file_id: &str) -> Result<()>

Launch the system’s default opener on a saved file.

Source

pub fn list_room_attachments( &self, room_id: &str, ) -> Result<Vec<StoredAttachment>>

Source

pub fn set_member_verified( &self, room_id: &str, fingerprint: &str, verified: bool, ) -> Result<()>

Mark a peer’s fingerprint as verified in the given room. Used by the ^V verification modal after the user has compared the fingerprint out-of-band.

Source

pub fn verified_fingerprints(&self, room_id: &str) -> Vec<String>

Source

pub fn display_name(&self) -> Option<String>

Source

pub fn set_display_name(&self, name: Option<&str>) -> Result<()>

Source

pub fn lookup_member_display_name(&self, fingerprint: &str) -> Option<String>

Look up the display name we’ve seen for a peer in any room.

Source

pub fn is_room_muted(&self, room_id: &str) -> bool

Source

pub fn set_room_muted(&self, room_id: &str, muted: bool) -> Result<()>

Source

pub async fn broadcast_typing(&self, room_id: &str)

Broadcast a “I’m typing” pulse to the given room. Caller is responsible for debouncing (don’t fire more than every ~500ms).

Source

pub fn typers_in_room(&self, room_id: &str) -> Vec<String>

Returns the fingerprints of peers currently typing in room_id, pruning entries past their TTL.

Source

pub async fn rotate_room( &self, room_id: &str, new_passphrase: &str, ) -> Result<()>

Rotate this room’s outbound Megolm session under a fresh passphrase. Broadcasts RotateRoomKey (so other members know to expect a new passphrase) and a fresh MemberAnnounce with the new wrapped session key. Old inbound sessions stay in storage for decrypting historic messages.

Source

pub async fn accept_rotation( &self, room_id: &str, new_salt: &[u8], new_passphrase: &str, ) -> Result<()>

Used by the TUI when another member rotates a room we’re in. Derives the new key, updates our local state, and re-announces so the rotator can share their fresh outbound session with us.

Trait Implementations§

Source§

impl Clone for AppHandle

Source§

fn clone(&self) -> AppHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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