Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions crates/ironrdp-cliprdr/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ pub trait CliprdrBackend: AsAny + core::fmt::Debug + Send {
/// client's clipboard prior to `CLIPRDR` SVC initialization.
fn on_request_format_list(&mut self);

/// Called by [`crate::Cliprdr`] when the remote responds to a `FormatList` we
/// sent (i.e. an outbound advertise of our own clipboard contents).
///
/// `ok = true` means the remote accepted the list (`CB_RESPONSE_OK`);
/// `ok = false` means it rejected it (`CB_RESPONSE_FAIL`), and
/// [`crate::Cliprdr`] has already cleared
/// `local_file_list` / `local_file_list_format_id` per MS-RDPECLIP 3.1.5.2.4.
///
/// Backends can use this to retry on `Fail` (e.g. ride out a transient
/// rejection caused by the remote window being inactive at the instant we
/// advertised) and, equally important, to **stop** re-advertising once an
/// `Ok` is seen — a later blind re-advertise that gets rejected would wipe
/// already-accepted state and silently break a paste that was about to work.
///
/// Default impl is a no-op, so this is non-breaking for existing backends.
fn on_format_list_response(&mut self, _ok: bool) {}

/// Adjusts [crate::Cliprdr] backend capabilities based on capabilities negotiated with a server.
///
/// Called by [crate::Cliprdr] when capability negotiation is finished and server capabilities are
Expand Down
2 changes: 2 additions & 0 deletions crates/ironrdp-cliprdr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ impl<R: Role> Cliprdr<R> {
info!("Remote accepted format list");
}
}
self.backend.on_format_list_response(true);
}
FormatListResponse::Fail => {
// [MS-RDPECLIP] 3.1.5.2.4 - The remote rejected our FormatList but the
Expand All @@ -645,6 +646,7 @@ impl<R: Role> Cliprdr<R> {

self.sent_file_contents_requests.clear();
}
self.backend.on_format_list_response(false);
}
}

Expand Down
Loading