From 12df0ab196865fe5b68d0f2ce38574751f50168e Mon Sep 17 00:00:00 2001 From: Archie Jaskowicz Date: Mon, 29 Jan 2024 16:37:27 +0000 Subject: [PATCH] feat: added newly_created bool to threads (#1069) --- include/dpp/thread.h | 6 ++++++ src/dpp/thread.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/dpp/thread.h b/include/dpp/thread.h index 2dee940be0..893ef04a28 100644 --- a/include/dpp/thread.h +++ b/include/dpp/thread.h @@ -165,6 +165,12 @@ class DPP_EXPORT thread : public channel, public json_interface { */ uint8_t member_count = 0; + /** + * @brief Was this thread newly created? + * @note This will only show in dpp::cluster::on_thread_create if the thread was just made. + */ + bool newly_created{false}; + /** * @brief Returns true if the thread is within an announcement channel * diff --git a/src/dpp/thread.cpp b/src/dpp/thread.cpp index 9c95954c23..8cfe5d618a 100644 --- a/src/dpp/thread.cpp +++ b/src/dpp/thread.cpp @@ -44,6 +44,8 @@ thread& thread::fill_from_json_impl(json* j) { set_int32_not_null(j, "total_message_sent", this->total_messages_sent); set_int8_not_null(j, "message_count", this->message_count); set_int8_not_null(j, "member_count", this->member_count); + set_bool_not_null(j, "newly_created", this->newly_created); + auto json_metadata = (*j)["thread_metadata"]; metadata.archived = bool_not_null(&json_metadata, "archived"); metadata.archive_timestamp = ts_not_null(&json_metadata, "archive_timestamp");