mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-03 05:44:45 -05:00
Emit an event when a shared file hashing complete
Properly notify when a shared file has been hashed Deprecate event with arbitrary data packed in std::string
This commit is contained in:
parent
58016fff65
commit
34593d1b6f
3 changed files with 50 additions and 14 deletions
|
|
@ -91,8 +91,8 @@ enum class RsEventType : uint32_t
|
|||
/// @see RsGxsPostedEvent
|
||||
GXS_IDENTITY = 12,
|
||||
|
||||
/// @see RsFiles
|
||||
SHARED_DIRECTORIES = 13,
|
||||
/// @see RsFiles @deprecated
|
||||
SHARED_DIRECTORIES = 13,
|
||||
|
||||
/// @see RsFiles
|
||||
FILE_TRANSFER = 14,
|
||||
|
|
@ -100,8 +100,11 @@ enum class RsEventType : uint32_t
|
|||
/// @see RsMsgs
|
||||
CHAT_MESSAGE = 15,
|
||||
|
||||
/// @see rspeers.h
|
||||
NETWORK = 16,
|
||||
/// @see rspeers.h
|
||||
NETWORK = 16,
|
||||
|
||||
/** Emitted to update library clients about file hashing being completed */
|
||||
FILE_HASHING_COMPLETED = 20,
|
||||
|
||||
__MAX /// Used internally, keep last
|
||||
};
|
||||
|
|
|
|||
|
|
@ -194,7 +194,8 @@ enum class RsFileTransferEventCode: uint8_t {
|
|||
COMPLETED_FILES_REMOVED = 0x02, //
|
||||
};
|
||||
|
||||
struct RsSharedDirectoriesEvent: RsEvent
|
||||
struct RS_DEPRECATED_FOR("Packing arbitrary data into an std::string is bad idea")
|
||||
RsSharedDirectoriesEvent: RsEvent
|
||||
{
|
||||
RsSharedDirectoriesEvent() : RsEvent(RsEventType::SHARED_DIRECTORIES), mEventCode(RsSharedDirectoriesEventCode::UNKNOWN) {}
|
||||
~RsSharedDirectoriesEvent() override = default;
|
||||
|
|
@ -212,6 +213,31 @@ struct RsSharedDirectoriesEvent: RsEvent
|
|||
std::string mMessage;
|
||||
};
|
||||
|
||||
struct RsFileHashingCompletedEvent: RsEvent
|
||||
{
|
||||
RsFileHashingCompletedEvent():
|
||||
RsEvent(RsEventType::FILE_HASHING_COMPLETED), mHashingSpeed(0) {}
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx ) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mFilePath);
|
||||
RS_SERIAL_PROCESS(mFileHash);
|
||||
RS_SERIAL_PROCESS(mHashingSpeed);
|
||||
}
|
||||
|
||||
/// Complete path of the file being hashed
|
||||
std::string mFilePath;
|
||||
|
||||
/// File hash, null if error occurred
|
||||
RsFileHash mFileHash;
|
||||
|
||||
/// Hashing speed in MB/s
|
||||
double mHashingSpeed;
|
||||
};
|
||||
|
||||
struct RsFileTransferEvent: RsEvent
|
||||
{
|
||||
RsFileTransferEvent() : RsEvent(RsEventType::FILE_TRANSFER), mFileTransferEventCode(RsFileTransferEventCode::UNKNOWN) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue