[client,common] simplify file clipboard API
This commit is contained in:
parent
e129ab749b
commit
7722961fcc
@ -869,9 +869,8 @@ wlf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
||||
ClipboardGetFormatId(clipboard->system, type_FileGroupDescriptorW);
|
||||
dstFormatId = ClipboardGetFormatId(clipboard->system, request->responseMime);
|
||||
|
||||
if (!cliprdr_file_context_update_server_data(clipboard->file, data, size))
|
||||
goto unlock;
|
||||
else if (!cliprdr_file_context_update_base(clipboard->file, clipboard->system))
|
||||
if (!cliprdr_file_context_update_server_data(clipboard->file, clipboard->system,
|
||||
data, size))
|
||||
goto unlock;
|
||||
}
|
||||
else if (strcmp(type_HtmlFormat, name) == 0)
|
||||
|
@ -1888,11 +1888,9 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
||||
|
||||
if (strcmp(clipboard->requestedFormat->formatName, type_FileGroupDescriptorW) == 0)
|
||||
{
|
||||
if (!cliprdr_file_context_update_server_data(clipboard->file, data, size))
|
||||
if (!cliprdr_file_context_update_server_data(clipboard->file, clipboard->system, data,
|
||||
size))
|
||||
WLog_WARN(TAG, "failed to update file descriptors");
|
||||
else if (!cliprdr_file_context_update_base(clipboard->file, clipboard->system))
|
||||
{
|
||||
}
|
||||
|
||||
srcFormatId = ClipboardGetFormatId(clipboard->system, type_FileGroupDescriptorW);
|
||||
const xfCliprdrFormat* dstTargetFormat =
|
||||
|
@ -95,7 +95,7 @@ if (WITH_LIBRARY_VERSIONING)
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
|
||||
endif()
|
||||
|
||||
set(LIBS freerdp winpr)
|
||||
list(APPEND LIBS freerdp winpr)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} PRIVATE ${FREERDP_CHANNELS_CLIENT_LIBS})
|
||||
target_link_libraries(${MODULE_NAME} PUBLIC ${LIBS})
|
||||
|
@ -1781,21 +1781,37 @@ static BOOL cliprdr_file_client_content_changed_and_update(CliprdrFileContext* f
|
||||
sizeof(file->client_data_hash), data, size);
|
||||
}
|
||||
|
||||
BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file, const void* data,
|
||||
size_t size)
|
||||
static BOOL cliprdr_file_context_update_base(CliprdrFileContext* file, wClipboard* clip)
|
||||
{
|
||||
wClipboardDelegate* delegate = ClipboardGetDelegate(clip);
|
||||
if (!delegate)
|
||||
return FALSE;
|
||||
ClipboardLock(clip);
|
||||
HashTable_Lock(file->remote_streams);
|
||||
free(file->exposed_path);
|
||||
file->exposed_path = _strdup(file->current_path);
|
||||
HashTable_Unlock(file->remote_streams);
|
||||
|
||||
delegate->basePath = (file->exposed_path);
|
||||
ClipboardUnlock(clip);
|
||||
return delegate->basePath != NULL;
|
||||
}
|
||||
|
||||
BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file, wClipboard* clip,
|
||||
const void* data, size_t size)
|
||||
{
|
||||
WINPR_ASSERT(file);
|
||||
|
||||
if (cliprdr_file_server_content_changed_and_update(file, data, size))
|
||||
{
|
||||
#if defined(WITH_FUSE2) || defined(WITH_FUSE3)
|
||||
/* Build inode table for FILEDESCRIPTORW*/
|
||||
if (!cliprdr_file_fuse_generate_list(file, data, size, 0))
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
if (!cliprdr_file_server_content_changed_and_update(file, data, size))
|
||||
return TRUE;
|
||||
|
||||
return TRUE;
|
||||
#if defined(WITH_FUSE2) || defined(WITH_FUSE3)
|
||||
/* Build inode table for FILEDESCRIPTORW*/
|
||||
if (!cliprdr_file_fuse_generate_list(file, data, size, 0))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return cliprdr_file_context_update_base(file, clip);
|
||||
}
|
||||
|
||||
void* cliprdr_file_context_get_context(CliprdrFileContext* file)
|
||||
@ -2290,22 +2306,6 @@ UINT32 cliprdr_file_context_remote_get_flags(CliprdrFileContext* file)
|
||||
return file->file_capability_flags;
|
||||
}
|
||||
|
||||
BOOL cliprdr_file_context_update_base(CliprdrFileContext* file, wClipboard* clip)
|
||||
{
|
||||
wClipboardDelegate* delegate = ClipboardGetDelegate(clip);
|
||||
if (!delegate)
|
||||
return FALSE;
|
||||
ClipboardLock(clip);
|
||||
HashTable_Lock(file->remote_streams);
|
||||
free(file->exposed_path);
|
||||
file->exposed_path = _strdup(file->current_path);
|
||||
HashTable_Unlock(file->remote_streams);
|
||||
|
||||
delegate->basePath = (file->exposed_path);
|
||||
ClipboardUnlock(clip);
|
||||
return delegate->basePath != NULL;
|
||||
}
|
||||
|
||||
BOOL cliprdr_file_context_has_local_support(CliprdrFileContext* file)
|
||||
{
|
||||
WINPR_UNUSED(file);
|
||||
|
@ -58,8 +58,6 @@ extern "C"
|
||||
|
||||
FREERDP_API void* cliprdr_file_context_get_context(CliprdrFileContext* file);
|
||||
|
||||
FREERDP_API BOOL cliprdr_file_context_update_base(CliprdrFileContext* file, wClipboard* clip);
|
||||
|
||||
FREERDP_API BOOL cliprdr_file_context_init(CliprdrFileContext* file,
|
||||
CliprdrClientContext* cliprdr);
|
||||
FREERDP_API BOOL cliprdr_file_context_uninit(CliprdrFileContext* file,
|
||||
@ -67,11 +65,27 @@ extern "C"
|
||||
|
||||
FREERDP_API BOOL cliprdr_file_context_clear(CliprdrFileContext* file);
|
||||
|
||||
/** \brief updates the files the client announces to the server
|
||||
*
|
||||
* \param file the file context to update
|
||||
* \param data the file list
|
||||
* \param count the length of the file list
|
||||
*
|
||||
* \return \b TRUE for success, \b FALSE otherwise
|
||||
*/
|
||||
FREERDP_API BOOL cliprdr_file_context_update_client_data(CliprdrFileContext* file,
|
||||
const char* data, size_t count);
|
||||
|
||||
/** \brief updates the files the server announces to the client
|
||||
*
|
||||
* \param file the file context to update
|
||||
* \param data the file list [MS-RDPECLIP] 2.2.5.2.3 Packed File List (CLIPRDR_FILELIST)
|
||||
* \param count the length of the file list
|
||||
*
|
||||
* \return \b TRUE for success, \b FALSE otherwise
|
||||
*/
|
||||
FREERDP_API BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file,
|
||||
const void* data, size_t size);
|
||||
wClipboard* clip, const void* data,
|
||||
size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user