Skip to content

Commit

Permalink
feat: added newly_created bool to threads (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 authored Jan 29, 2024
1 parent 71263e8 commit 12df0ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/dpp/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ class DPP_EXPORT thread : public channel, public json_interface<thread> {
*/
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
*
Expand Down
2 changes: 2 additions & 0 deletions src/dpp/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 12df0ab

Please sign in to comment.