mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
move clipboard file service to cm module
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
207
src/clipboard_file.rs
Normal file
207
src/clipboard_file.rs
Normal file
@@ -0,0 +1,207 @@
|
||||
use clipboard::ClipbaordFile;
|
||||
use hbb_common::message_proto::*;
|
||||
|
||||
pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
match clip {
|
||||
ClipbaordFile::ServerFormatList {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
format_list,
|
||||
} => {
|
||||
let mut formats: Vec<CliprdrFormat> = Vec::new();
|
||||
for v in format_list.iter() {
|
||||
formats.push(CliprdrFormat {
|
||||
server_conn_id: 0,
|
||||
remote_conn_id: 0,
|
||||
id: v.0,
|
||||
format: v.1.clone(),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_list(CliprdrServerFormatList {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
formats,
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
ClipbaordFile::ServerFormatListResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_list_response(
|
||||
CliprdrServerFormatListResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
..Default::default()
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::ServerFormatDataRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
requested_format_id,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_data_request(
|
||||
CliprdrServerFormatDataRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
requested_format_id,
|
||||
..Default::default()
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::ServerFormatDataResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::format_data_response(
|
||||
CliprdrServerFormatDataResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
format_data,
|
||||
..Default::default()
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FileContentsRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
n_position_low,
|
||||
n_position_high,
|
||||
cb_requested,
|
||||
have_clip_data_id,
|
||||
clip_data_id,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::file_contents_request(
|
||||
CliprdrFileContentsRequest {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
n_position_low,
|
||||
n_position_high,
|
||||
cb_requested,
|
||||
have_clip_data_id,
|
||||
clip_data_id,
|
||||
..Default::default()
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FileContentsResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
} => Message {
|
||||
union: Some(message::Union::cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::file_contents_response(
|
||||
CliprdrFileContentsResponse {
|
||||
server_conn_id,
|
||||
remote_conn_id,
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
..Default::default()
|
||||
},
|
||||
)),
|
||||
..Default::default()
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn msg_2_clip(msg: Cliprdr) -> Option<ClipbaordFile> {
|
||||
match msg.union {
|
||||
Some(cliprdr::Union::format_list(data)) => {
|
||||
let mut format_list: Vec<(i32, String)> = Vec::new();
|
||||
for v in data.formats.iter() {
|
||||
format_list.push((v.id, v.format.clone()));
|
||||
}
|
||||
Some(ClipbaordFile::ServerFormatList {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
format_list,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::format_list_response(data)) => {
|
||||
Some(ClipbaordFile::ServerFormatListResponse {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
msg_flags: data.msg_flags,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::format_data_request(data)) => {
|
||||
Some(ClipbaordFile::ServerFormatDataRequest {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
requested_format_id: data.requested_format_id,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::format_data_response(data)) => {
|
||||
Some(ClipbaordFile::ServerFormatDataResponse {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
msg_flags: data.msg_flags,
|
||||
format_data: data.format_data,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::file_contents_request(data)) => {
|
||||
Some(ClipbaordFile::FileContentsRequest {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
stream_id: data.stream_id,
|
||||
list_index: data.list_index,
|
||||
dw_flags: data.dw_flags,
|
||||
n_position_low: data.n_position_low,
|
||||
n_position_high: data.n_position_high,
|
||||
cb_requested: data.cb_requested,
|
||||
have_clip_data_id: data.have_clip_data_id,
|
||||
clip_data_id: data.clip_data_id,
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::file_contents_response(data)) => {
|
||||
Some(ClipbaordFile::FileContentsResponse {
|
||||
server_conn_id: data.server_conn_id,
|
||||
remote_conn_id: data.remote_conn_id,
|
||||
msg_flags: data.msg_flags,
|
||||
stream_id: data.stream_id,
|
||||
requested_data: data.requested_data,
|
||||
})
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::rendezvous_mediator::RendezvousMediator;
|
||||
pub use clipboard::ClipbaordFile;
|
||||
use hbb_common::{
|
||||
allow_err, bail, bytes,
|
||||
bytes_codec::BytesCodec,
|
||||
@@ -103,6 +104,7 @@ pub enum Data {
|
||||
to: String,
|
||||
},
|
||||
SyncConfigToUserResp(bool),
|
||||
ClipbaordFile(ClipbaordFile),
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
|
||||
@@ -28,3 +28,6 @@ pub mod cli;
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
mod port_forward;
|
||||
mod lang;
|
||||
|
||||
#[cfg(windows)]
|
||||
pub mod clipboard_file;
|
||||
|
||||
@@ -29,8 +29,6 @@ use std::{
|
||||
|
||||
pub mod audio_service;
|
||||
mod clipboard_service;
|
||||
#[cfg(windows)]
|
||||
pub mod clipboard_file_service;
|
||||
mod connection;
|
||||
pub mod input_service;
|
||||
mod service;
|
||||
@@ -63,8 +61,6 @@ pub fn new() -> ServerPtr {
|
||||
server.add_service(Box::new(audio_service::new()));
|
||||
server.add_service(Box::new(video_service::new()));
|
||||
server.add_service(Box::new(clipboard_service::new()));
|
||||
#[cfg(windows)]
|
||||
server.add_service(Box::new(clipboard_file_service::new()));
|
||||
server.add_service(Box::new(input_service::new_cursor()));
|
||||
server.add_service(Box::new(input_service::new_pos()));
|
||||
Arc::new(RwLock::new(server))
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
use super::*;
|
||||
use clipboard::{create_cliprdr_context, get_rx_client_msg, server_msg, ConnID};
|
||||
use hbb_common::{
|
||||
log,
|
||||
tokio::sync::{
|
||||
mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender},
|
||||
Mutex as TokioMutex,
|
||||
},
|
||||
tokio::time::{self, Duration, Instant},
|
||||
ResultType,
|
||||
};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
pub const NAME: &'static str = "cliprdr";
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref MSG_CHANNEL_SERVER: (UnboundedSender<(ConnID, Cliprdr)>, TokioMutex<UnboundedReceiver<(ConnID, Cliprdr)>>) = {
|
||||
let (tx, rx) = unbounded_channel();
|
||||
(tx, TokioMutex::new(rx))
|
||||
};
|
||||
}
|
||||
|
||||
static RUNNING: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
pub fn new() -> GenericService {
|
||||
let sp = GenericService::new(NAME, true);
|
||||
sp.run::<_>(listen::run);
|
||||
sp
|
||||
}
|
||||
|
||||
pub fn handle_serve_cliprdr_msg(id: i32, msg: Cliprdr) {
|
||||
if RUNNING.load(Ordering::SeqCst) {
|
||||
log::debug!("handle handle_serve_cliprdr_msg");
|
||||
MSG_CHANNEL_SERVER
|
||||
.0
|
||||
.send((
|
||||
ConnID {
|
||||
server_conn_id: id as u32,
|
||||
remote_conn_id: 0,
|
||||
},
|
||||
msg,
|
||||
))
|
||||
.unwrap();
|
||||
} else {
|
||||
// should not reach this branch
|
||||
}
|
||||
}
|
||||
|
||||
mod listen {
|
||||
use super::*;
|
||||
|
||||
static WAIT: Duration = Duration::from_millis(1500);
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn run(sp: GenericService) -> ResultType<()> {
|
||||
let mut cliprdr_context = create_cliprdr_context(true, false)?;
|
||||
|
||||
RUNNING.store(false, Ordering::SeqCst);
|
||||
|
||||
let mut timer = time::interval_at(Instant::now() + WAIT, WAIT);
|
||||
let mut client_rx = get_rx_client_msg().lock().await;
|
||||
let mut server_rx = MSG_CHANNEL_SERVER.1.lock().await;
|
||||
while sp.ok() {
|
||||
RUNNING.store(true, Ordering::SeqCst);
|
||||
|
||||
tokio::select! {
|
||||
msg = client_rx.recv() => {
|
||||
match msg {
|
||||
Some((conn_id, msg)) => {
|
||||
if conn_id.server_conn_id == 0 {
|
||||
sp.send(msg)
|
||||
} else {
|
||||
sp.send_to(msg, conn_id.server_conn_id as i32)
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// unreachable!()
|
||||
}
|
||||
}
|
||||
}
|
||||
msg = server_rx.recv() => {
|
||||
match msg {
|
||||
Some((conn_id, msg)) => {
|
||||
let res = server_msg(&mut cliprdr_context, conn_id, msg);
|
||||
if res != 0 {
|
||||
// log::warn!("failed to process message for {}", id);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// unreachable!()
|
||||
}
|
||||
}
|
||||
}
|
||||
_ = timer.tick() => {},
|
||||
}
|
||||
sp.snapshot(|_| Ok(()))?;
|
||||
}
|
||||
|
||||
RUNNING.store(false, Ordering::SeqCst);
|
||||
log::info!("Clipboard listener stopped!");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
use super::{input_service::*, *};
|
||||
#[cfg(windows)]
|
||||
use crate::{clipboard_file::*, common::update_clipboard, ipc};
|
||||
#[cfg(not(windows))]
|
||||
use crate::{common::update_clipboard, ipc};
|
||||
use hbb_common::{
|
||||
config::Config,
|
||||
@@ -243,17 +246,17 @@ impl Connection {
|
||||
} else if &name == "file" {
|
||||
conn.file = enabled;
|
||||
conn.send_permission(Permission::File, enabled).await;
|
||||
#[cfg(windows)]
|
||||
if let Some(s) = conn.server.upgrade() {
|
||||
s.write().unwrap().subscribe(
|
||||
super::clipboard_file_service::NAME,
|
||||
conn.inner.clone(), conn.file_transfer_enabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
ipc::Data::RawMessage(bytes) => {
|
||||
allow_err!(conn.stream.send_raw(bytes).await);
|
||||
}
|
||||
ipc::Data::ClipbaordFile(_clip) => {
|
||||
if conn.file_transfer_enabled() {
|
||||
#[cfg(windows)]
|
||||
allow_err!(conn.stream.send(&clip_2_msg(_clip)).await);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
},
|
||||
@@ -620,10 +623,6 @@ impl Connection {
|
||||
if !self.audio_enabled() {
|
||||
noperms.push(super::audio_service::NAME);
|
||||
}
|
||||
if !self.file_transfer_enabled() {
|
||||
#[cfg(windows)]
|
||||
noperms.push(super::clipboard_file_service::NAME);
|
||||
}
|
||||
s.write()
|
||||
.unwrap()
|
||||
.add_connection(self.inner.clone(), &noperms);
|
||||
@@ -849,9 +848,13 @@ impl Connection {
|
||||
update_clipboard(cb, None);
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
Some(message::Union::cliprdr(clip)) => {
|
||||
clipboard_file_service::handle_serve_cliprdr_msg(self.inner.id, clip)
|
||||
Some(message::Union::cliprdr(_clip)) => {
|
||||
if self.file_transfer_enabled() {
|
||||
#[cfg(windows)]
|
||||
if let Some(clip) = msg_2_clip(_clip) {
|
||||
self.send_to_cm(ipc::Data::ClipbaordFile(clip))
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(message::Union::file_action(fa)) => {
|
||||
if self.file_transfer.is_some() {
|
||||
@@ -1017,13 +1020,6 @@ impl Connection {
|
||||
if let Ok(q) = o.enable_file_transfer.enum_value() {
|
||||
if q != BoolOption::NotSet {
|
||||
self.enable_file_transfer = q == BoolOption::Yes;
|
||||
if let Some(s) = self.server.upgrade() {
|
||||
s.write().unwrap().subscribe(
|
||||
super::clipboard_file_service::NAME,
|
||||
self.inner.clone(),
|
||||
self.file_transfer_enabled(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Ok(q) = o.disable_clipboard.enum_value() {
|
||||
|
||||
81
src/ui/cm.rs
81
src/ui/cm.rs
@@ -1,4 +1,6 @@
|
||||
use crate::ipc::{self, new_listener, Connection, Data};
|
||||
#[cfg(windows)]
|
||||
use clipboard::{create_cliprdr_context, get_rx_clip_client, server_clip_file, ConnID};
|
||||
use hbb_common::{
|
||||
allow_err,
|
||||
config::{Config, ICON},
|
||||
@@ -106,6 +108,7 @@ impl ConnectionManager {
|
||||
&self,
|
||||
id: i32,
|
||||
data: Data,
|
||||
_tx_clip_file: &mpsc::UnboundedSender<(i32, ipc::ClipbaordFile)>,
|
||||
write_jobs: &mut Vec<fs::TransferJob>,
|
||||
conn: &mut Connection,
|
||||
) {
|
||||
@@ -186,6 +189,10 @@ impl ConnectionManager {
|
||||
}
|
||||
}
|
||||
},
|
||||
Data::ClipbaordFile(_clip) => {
|
||||
#[cfg(windows)]
|
||||
allow_err!(_tx_clip_file.send((id, _clip)));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -326,6 +333,12 @@ impl sciter::EventHandler for ConnectionManager {
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn start_ipc(cm: ConnectionManager) {
|
||||
let (tx_file, _rx_file) = mpsc::unbounded_channel::<(i32, ipc::ClipbaordFile)>();
|
||||
#[cfg(windows)]
|
||||
let cm_clip = cm.clone();
|
||||
#[cfg(windows)]
|
||||
std::thread::spawn(move || start_clipboard_file(cm_clip, _rx_file));
|
||||
|
||||
match new_listener("_cm").await {
|
||||
Ok(mut incoming) => {
|
||||
while let Some(result) = incoming.next().await {
|
||||
@@ -333,6 +346,7 @@ async fn start_ipc(cm: ConnectionManager) {
|
||||
Ok(stream) => {
|
||||
let mut stream = Connection::new(stream);
|
||||
let cm = cm.clone();
|
||||
let tx_file = tx_file.clone();
|
||||
tokio::spawn(async move {
|
||||
let mut conn_id: i32 = 0;
|
||||
let (tx, mut rx) = mpsc::unbounded_channel::<Data>();
|
||||
@@ -356,7 +370,7 @@ async fn start_ipc(cm: ConnectionManager) {
|
||||
break;
|
||||
}
|
||||
_ => {
|
||||
cm.handle_data(conn_id, data, &mut write_jobs, &mut stream).await;
|
||||
cm.handle_data(conn_id, data, &tx_file, &mut write_jobs, &mut stream).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -465,3 +479,68 @@ async fn start_pa() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn start_clipboard_file(
|
||||
cm: ConnectionManager,
|
||||
mut rx: mpsc::UnboundedReceiver<(i32, ipc::ClipbaordFile)>,
|
||||
) {
|
||||
let mut cliprdr_context = match create_cliprdr_context(true, false) {
|
||||
Ok(context) => {
|
||||
log::info!("clipboard context for file transfer created.");
|
||||
context
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!(
|
||||
"Create clipboard context for file transfer: {}",
|
||||
err.to_string()
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let mut rx_clip_client = get_rx_clip_client().lock().await;
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
clip_file = rx_clip_client.recv() => match clip_file {
|
||||
Some((conn_id, clip)) => {
|
||||
cmd_inner_send(
|
||||
&cm,
|
||||
conn_id.server_conn_id as i32,
|
||||
Data::ClipbaordFile(clip)
|
||||
);
|
||||
}
|
||||
None => {
|
||||
//
|
||||
}
|
||||
},
|
||||
server_msg = rx.recv() => match server_msg {
|
||||
Some((server_conn_id, clip)) => {
|
||||
let conn_id = ConnID {
|
||||
server_conn_id: server_conn_id as u32,
|
||||
remote_conn_id: 0,
|
||||
};
|
||||
server_clip_file(&mut cliprdr_context, conn_id, clip);
|
||||
}
|
||||
None => {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn cmd_inner_send<'a>(cm: &'a ConnectionManager, id: i32, data: Data) {
|
||||
let lock = cm.read().unwrap();
|
||||
if id != 0 {
|
||||
if let Some(s) = lock.senders.get(&id) {
|
||||
allow_err!(s.send(data));
|
||||
}
|
||||
} else {
|
||||
for s in lock.senders.values() {
|
||||
allow_err!(s.send(data.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
use crate::client::*;
|
||||
use crate::common::{
|
||||
self, check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL,
|
||||
#[cfg(windows)]
|
||||
use crate::{
|
||||
client::*,
|
||||
clipboard_file::*,
|
||||
common::{self, check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL},
|
||||
};
|
||||
#[cfg(not(windows))]
|
||||
use crate::{
|
||||
client::*,
|
||||
common::{self, check_clipboard, update_clipboard, ClipboardContext, CLIPBOARD_INTERVAL},
|
||||
};
|
||||
#[cfg(windows)]
|
||||
use clipboard::{
|
||||
cliprdr::CliprdrClientContext, create_cliprdr_context as create_clipboard_file_context,
|
||||
get_rx_client_msg as get_clipboard_file_rx_client_msg, server_msg as clipboard_file_msg,
|
||||
ConnID as ClipboardFileConnID,
|
||||
get_rx_clip_client, server_clip_file, ConnID as ClipboardFileConnID,
|
||||
};
|
||||
use enigo::{self, Enigo, KeyboardControllable};
|
||||
use hbb_common::{
|
||||
@@ -1313,9 +1319,9 @@ impl Remote {
|
||||
|
||||
// just build for now
|
||||
#[cfg(not(windows))]
|
||||
let (_, mut clipboard_file_client_rx) = mpsc::unbounded_channel::<i32>();
|
||||
let (_, mut rx_clip_client) = mpsc::unbounded_channel::<i32>();
|
||||
#[cfg(windows)]
|
||||
let mut clipboard_file_client_rx = get_clipboard_file_rx_client_msg().lock().await;
|
||||
let mut rx_clip_client = get_rx_clip_client().lock().await;
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
@@ -1347,12 +1353,12 @@ impl Remote {
|
||||
}
|
||||
}
|
||||
}
|
||||
_msg = clipboard_file_client_rx.recv() => {
|
||||
_msg = rx_clip_client.recv() => {
|
||||
#[cfg(windows)]
|
||||
match _msg {
|
||||
Some((conn_id, msg)) => {
|
||||
Some((conn_id, clip)) => {
|
||||
if conn_id.remote_conn_id == 0 || conn_id.remote_conn_id == self.pid {
|
||||
allow_err!(peer.send(&msg).await);
|
||||
allow_err!(peer.send(&clip_2_msg(clip)).await);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
@@ -1740,14 +1746,16 @@ impl Remote {
|
||||
Some(message::Union::cliprdr(clip)) => {
|
||||
if !self.handler.lc.read().unwrap().disable_clipboard {
|
||||
if let Some(context) = &mut self.clipboard_file_context {
|
||||
clipboard_file_msg(
|
||||
context,
|
||||
ClipboardFileConnID {
|
||||
server_conn_id: 0,
|
||||
remote_conn_id: self.pid,
|
||||
},
|
||||
clip,
|
||||
);
|
||||
if let Some(clip) = msg_2_clip(clip) {
|
||||
server_clip_file(
|
||||
context,
|
||||
ClipboardFileConnID {
|
||||
server_conn_id: 0,
|
||||
remote_conn_id: self.pid,
|
||||
},
|
||||
clip,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user