1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:27:45 +00:00

SpiceAgent: Handle file transfer requests properly :^)

Now, we write the data recieved to a file when the user drags a file
onto the Spice Viewer window. Once complete, the FileExplorer will open
with the copied file highlighted.
This commit is contained in:
Caoimhe 2023-05-19 23:32:16 +01:00 committed by Andreas Kling
parent d87f823a68
commit 0f3f190a5a
6 changed files with 215 additions and 2 deletions

View file

@ -8,6 +8,7 @@
#pragma once
#include "ChunkHeader.h"
#include "FileTransferOperation.h"
#include "Message.h"
#include "MessageHeader.h"
#include <AK/MemoryStream.h>
@ -22,6 +23,9 @@ namespace SpiceAgent {
// If the buffer's length is equal to this, then the next data recieved will be more data from the same buffer.
constexpr u32 message_buffer_threshold = 2048;
// The maximum amount of data that can be received in one file transfer message
constexpr u32 file_transfer_buffer_threshold = 65536;
class SpiceAgent {
public:
static ErrorOr<NonnullOwnPtr<SpiceAgent>> create(StringView device_path);
@ -61,6 +65,7 @@ public:
private:
NonnullOwnPtr<Core::File> m_spice_device;
Vector<Capability> m_capabilities;
HashMap<u32, NonnullRefPtr<FileTransferOperation>> m_file_transfer_operations;
RefPtr<Core::Notifier> m_notifier;