spelling: clipboard
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
parent
380a1670f0
commit
caa557e360
@ -21,7 +21,7 @@ pub use context_send::*;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[serde(tag = "t", content = "c")]
|
||||
pub enum ClipbaordFile {
|
||||
pub enum ClipboardFile {
|
||||
MonitorReady,
|
||||
FormatList {
|
||||
format_list: Vec<(i32, String)>,
|
||||
@ -61,8 +61,8 @@ struct ConnEnabled {
|
||||
struct MsgChannel {
|
||||
peer_id: String,
|
||||
conn_id: i32,
|
||||
sender: UnboundedSender<ClipbaordFile>,
|
||||
receiver: Arc<TokioMutex<UnboundedReceiver<ClipbaordFile>>>,
|
||||
sender: UnboundedSender<ClipboardFile>,
|
||||
receiver: Arc<TokioMutex<UnboundedReceiver<ClipboardFile>>>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
@ -89,7 +89,7 @@ pub fn get_client_conn_id(peer_id: &str) -> Option<i32> {
|
||||
|
||||
pub fn get_rx_cliprdr_client(
|
||||
peer_id: &str,
|
||||
) -> (i32, Arc<TokioMutex<UnboundedReceiver<ClipbaordFile>>>) {
|
||||
) -> (i32, Arc<TokioMutex<UnboundedReceiver<ClipboardFile>>>) {
|
||||
let mut lock = VEC_MSG_CHANNEL.write().unwrap();
|
||||
match lock.iter().find(|x| x.peer_id == peer_id.to_owned()) {
|
||||
Some(msg_channel) => (msg_channel.conn_id, msg_channel.receiver.clone()),
|
||||
@ -110,7 +110,7 @@ pub fn get_rx_cliprdr_client(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_rx_cliprdr_server(conn_id: i32) -> Arc<TokioMutex<UnboundedReceiver<ClipbaordFile>>> {
|
||||
pub fn get_rx_cliprdr_server(conn_id: i32) -> Arc<TokioMutex<UnboundedReceiver<ClipboardFile>>> {
|
||||
let mut lock = VEC_MSG_CHANNEL.write().unwrap();
|
||||
match lock.iter().find(|x| x.conn_id == conn_id) {
|
||||
Some(msg_channel) => msg_channel.receiver.clone(),
|
||||
@ -131,7 +131,7 @@ pub fn get_rx_cliprdr_server(conn_id: i32) -> Arc<TokioMutex<UnboundedReceiver<C
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn send_data(conn_id: i32, data: ClipbaordFile) {
|
||||
fn send_data(conn_id: i32, data: ClipboardFile) {
|
||||
// no need to handle result here
|
||||
if let Some(msg_channel) = VEC_MSG_CHANNEL
|
||||
.read()
|
||||
@ -157,28 +157,28 @@ pub fn empty_clipboard(context: &mut Box<CliprdrClientContext>, conn_id: i32) ->
|
||||
pub fn server_clip_file(
|
||||
context: &mut Box<CliprdrClientContext>,
|
||||
conn_id: i32,
|
||||
msg: ClipbaordFile,
|
||||
msg: ClipboardFile,
|
||||
) -> u32 {
|
||||
match msg {
|
||||
ClipbaordFile::MonitorReady => {
|
||||
ClipboardFile::MonitorReady => {
|
||||
log::debug!("server_monitor_ready called");
|
||||
let ret = server_monitor_ready(context, conn_id);
|
||||
log::debug!("server_monitor_ready called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FormatList { format_list } => {
|
||||
ClipboardFile::FormatList { format_list } => {
|
||||
log::debug!("server_format_list called");
|
||||
let ret = server_format_list(context, conn_id, format_list);
|
||||
log::debug!("server_format_list called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FormatListResponse { msg_flags } => {
|
||||
ClipboardFile::FormatListResponse { msg_flags } => {
|
||||
log::debug!("format_list_response called");
|
||||
let ret = server_format_list_response(context, conn_id, msg_flags);
|
||||
log::debug!("server_format_list_response called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FormatDataRequest {
|
||||
ClipboardFile::FormatDataRequest {
|
||||
requested_format_id,
|
||||
} => {
|
||||
log::debug!("format_data_request called");
|
||||
@ -186,7 +186,7 @@ pub fn server_clip_file(
|
||||
log::debug!("server_format_data_request called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FormatDataResponse {
|
||||
ClipboardFile::FormatDataResponse {
|
||||
msg_flags,
|
||||
format_data,
|
||||
} => {
|
||||
@ -195,7 +195,7 @@ pub fn server_clip_file(
|
||||
log::debug!("server_format_data_response called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FileContentsRequest {
|
||||
ClipboardFile::FileContentsRequest {
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -221,7 +221,7 @@ pub fn server_clip_file(
|
||||
log::debug!("server_file_contents_request called, return {}", ret);
|
||||
ret
|
||||
}
|
||||
ClipbaordFile::FileContentsResponse {
|
||||
ClipboardFile::FileContentsResponse {
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
@ -492,7 +492,7 @@ extern "C" fn client_format_list(
|
||||
}
|
||||
conn_id = (*clip_format_list).connID as i32;
|
||||
}
|
||||
let data = ClipbaordFile::FormatList { format_list };
|
||||
let data = ClipboardFile::FormatList { format_list };
|
||||
// no need to handle result here
|
||||
if conn_id == 0 {
|
||||
VEC_MSG_CHANNEL
|
||||
@ -519,7 +519,7 @@ extern "C" fn client_format_list_response(
|
||||
conn_id = (*format_list_response).connID as i32;
|
||||
msg_flags = (*format_list_response).msgFlags as i32;
|
||||
}
|
||||
let data = ClipbaordFile::FormatListResponse { msg_flags };
|
||||
let data = ClipboardFile::FormatListResponse { msg_flags };
|
||||
send_data(conn_id, data);
|
||||
|
||||
0
|
||||
@ -537,7 +537,7 @@ extern "C" fn client_format_data_request(
|
||||
conn_id = (*format_data_request).connID as i32;
|
||||
requested_format_id = (*format_data_request).requestedFormatId as i32;
|
||||
}
|
||||
let data = ClipbaordFile::FormatDataRequest {
|
||||
let data = ClipboardFile::FormatDataRequest {
|
||||
requested_format_id,
|
||||
};
|
||||
// no need to handle result here
|
||||
@ -568,7 +568,7 @@ extern "C" fn client_format_data_response(
|
||||
.to_vec();
|
||||
}
|
||||
}
|
||||
let data = ClipbaordFile::FormatDataResponse {
|
||||
let data = ClipboardFile::FormatDataResponse {
|
||||
msg_flags,
|
||||
format_data,
|
||||
};
|
||||
@ -614,7 +614,7 @@ extern "C" fn client_file_contents_request(
|
||||
clip_data_id = (*file_contents_request).clipDataId as i32;
|
||||
}
|
||||
|
||||
let data = ClipbaordFile::FileContentsRequest {
|
||||
let data = ClipboardFile::FileContentsRequest {
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -653,7 +653,7 @@ extern "C" fn client_file_contents_response(
|
||||
.to_vec();
|
||||
}
|
||||
}
|
||||
let data = ClipbaordFile::FileContentsResponse {
|
||||
let data = ClipboardFile::FileContentsResponse {
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
|
@ -1,9 +1,9 @@
|
||||
use clipboard::ClipbaordFile;
|
||||
use clipboard::ClipboardFile;
|
||||
use hbb_common::message_proto::*;
|
||||
|
||||
pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
pub fn clip_2_msg(clip: ClipboardFile) -> Message {
|
||||
match clip {
|
||||
ClipbaordFile::MonitorReady => Message {
|
||||
ClipboardFile::MonitorReady => Message {
|
||||
union: Some(message::Union::Cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::Ready(CliprdrMonitorReady {
|
||||
..Default::default()
|
||||
@ -12,7 +12,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FormatList { format_list } => {
|
||||
ClipboardFile::FormatList { format_list } => {
|
||||
let mut formats: Vec<CliprdrFormat> = Vec::new();
|
||||
for v in format_list.iter() {
|
||||
formats.push(CliprdrFormat {
|
||||
@ -32,7 +32,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
ClipbaordFile::FormatListResponse { msg_flags } => Message {
|
||||
ClipboardFile::FormatListResponse { msg_flags } => Message {
|
||||
union: Some(message::Union::Cliprdr(Cliprdr {
|
||||
union: Some(cliprdr::Union::FormatListResponse(
|
||||
CliprdrServerFormatListResponse {
|
||||
@ -44,7 +44,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FormatDataRequest {
|
||||
ClipboardFile::FormatDataRequest {
|
||||
requested_format_id,
|
||||
} => Message {
|
||||
union: Some(message::Union::Cliprdr(Cliprdr {
|
||||
@ -58,7 +58,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FormatDataResponse {
|
||||
ClipboardFile::FormatDataResponse {
|
||||
msg_flags,
|
||||
format_data,
|
||||
} => Message {
|
||||
@ -74,7 +74,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FileContentsRequest {
|
||||
ClipboardFile::FileContentsRequest {
|
||||
stream_id,
|
||||
list_index,
|
||||
dw_flags,
|
||||
@ -102,7 +102,7 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
})),
|
||||
..Default::default()
|
||||
},
|
||||
ClipbaordFile::FileContentsResponse {
|
||||
ClipboardFile::FileContentsResponse {
|
||||
msg_flags,
|
||||
stream_id,
|
||||
requested_data,
|
||||
@ -123,28 +123,28 @@ pub fn clip_2_msg(clip: ClipbaordFile) -> Message {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn msg_2_clip(msg: Cliprdr) -> Option<ClipbaordFile> {
|
||||
pub fn msg_2_clip(msg: Cliprdr) -> Option<ClipboardFile> {
|
||||
match msg.union {
|
||||
Some(cliprdr::Union::Ready(_)) => Some(ClipbaordFile::MonitorReady),
|
||||
Some(cliprdr::Union::Ready(_)) => Some(ClipboardFile::MonitorReady),
|
||||
Some(cliprdr::Union::FormatList(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::FormatList { format_list })
|
||||
Some(ClipboardFile::FormatList { format_list })
|
||||
}
|
||||
Some(cliprdr::Union::FormatListResponse(data)) => Some(ClipbaordFile::FormatListResponse {
|
||||
Some(cliprdr::Union::FormatListResponse(data)) => Some(ClipboardFile::FormatListResponse {
|
||||
msg_flags: data.msg_flags,
|
||||
}),
|
||||
Some(cliprdr::Union::FormatDataRequest(data)) => Some(ClipbaordFile::FormatDataRequest {
|
||||
Some(cliprdr::Union::FormatDataRequest(data)) => Some(ClipboardFile::FormatDataRequest {
|
||||
requested_format_id: data.requested_format_id,
|
||||
}),
|
||||
Some(cliprdr::Union::FormatDataResponse(data)) => Some(ClipbaordFile::FormatDataResponse {
|
||||
Some(cliprdr::Union::FormatDataResponse(data)) => Some(ClipboardFile::FormatDataResponse {
|
||||
msg_flags: data.msg_flags,
|
||||
format_data: data.format_data.into(),
|
||||
}),
|
||||
Some(cliprdr::Union::FileContentsRequest(data)) => {
|
||||
Some(ClipbaordFile::FileContentsRequest {
|
||||
Some(ClipboardFile::FileContentsRequest {
|
||||
stream_id: data.stream_id,
|
||||
list_index: data.list_index,
|
||||
dw_flags: data.dw_flags,
|
||||
@ -156,7 +156,7 @@ pub fn msg_2_clip(msg: Cliprdr) -> Option<ClipbaordFile> {
|
||||
})
|
||||
}
|
||||
Some(cliprdr::Union::FileContentsResponse(data)) => {
|
||||
Some(ClipbaordFile::FileContentsResponse {
|
||||
Some(ClipboardFile::FileContentsResponse {
|
||||
msg_flags: data.msg_flags,
|
||||
stream_id: data.stream_id,
|
||||
requested_data: data.requested_data.into(),
|
||||
|
@ -9,7 +9,7 @@ use parity_tokio_ipc::{
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub use clipboard::ClipbaordFile;
|
||||
pub use clipboard::ClipboardFile;
|
||||
use hbb_common::{
|
||||
allow_err, bail, bytes,
|
||||
bytes_codec::BytesCodec,
|
||||
@ -191,7 +191,7 @@ pub enum Data {
|
||||
Test,
|
||||
SyncConfig(Option<(Config, Config2)>),
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
ClipbaordFile(ClipbaordFile),
|
||||
ClipboardFile(ClipboardFile),
|
||||
ClipboardFileEnabled(bool),
|
||||
PrivacyModeState((i32, PrivacyModeState)),
|
||||
TestRendezvousServer,
|
||||
|
@ -319,7 +319,7 @@ impl Connection {
|
||||
allow_err!(conn.stream.send_raw(bytes).await);
|
||||
}
|
||||
#[cfg(windows)]
|
||||
ipc::Data::ClipbaordFile(_clip) => {
|
||||
ipc::Data::ClipboardFile(_clip) => {
|
||||
if conn.file_transfer_enabled() {
|
||||
allow_err!(conn.stream.send(&clip_2_msg(_clip)).await);
|
||||
}
|
||||
@ -1309,7 +1309,7 @@ impl Connection {
|
||||
if self.file_transfer_enabled() {
|
||||
#[cfg(windows)]
|
||||
if let Some(clip) = msg_2_clip(_clip) {
|
||||
self.send_to_cm(ipc::Data::ClipbaordFile(clip))
|
||||
self.send_to_cm(ipc::Data::ClipboardFile(clip))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
||||
if !pre_enabled && ContextSend::is_enabled() {
|
||||
allow_err!(
|
||||
self.stream
|
||||
.send(&Data::ClipbaordFile(clipboard::ClipbaordFile::MonitorReady))
|
||||
.send(&Data::ClipboardFile(clipboard::ClipboardFile::MonitorReady))
|
||||
.await
|
||||
);
|
||||
}
|
||||
@ -288,7 +288,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
||||
rx_clip = rx_clip1.lock().await;
|
||||
} else {
|
||||
let rx_clip2;
|
||||
(_tx_clip, rx_clip2) = unbounded_channel::<clipboard::ClipbaordFile>();
|
||||
(_tx_clip, rx_clip2) = unbounded_channel::<clipboard::ClipboardFile>();
|
||||
rx_clip1 = Arc::new(TokioMutex::new(rx_clip2));
|
||||
rx_clip = rx_clip1.lock().await;
|
||||
}
|
||||
@ -354,7 +354,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
||||
}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
Data::ClipbaordFile(_clip) => {
|
||||
Data::ClipboardFile(_clip) => {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let conn_id = self.conn_id;
|
||||
@ -394,7 +394,7 @@ impl<T: InvokeUiCM> IpcTaskRunner<T> {
|
||||
clip_file = rx_clip.recv() => match clip_file {
|
||||
Some(_clip) => {
|
||||
#[cfg(windows)]
|
||||
allow_err!(self.tx.send(Data::ClipbaordFile(_clip)));
|
||||
allow_err!(self.tx.send(Data::ClipboardFile(_clip)));
|
||||
}
|
||||
None => {
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user