From 5c4c397f6c114190065f7f65bd7803ab41b66689 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 2 Oct 2023 17:03:00 +0200 Subject: [PATCH] update plug and add chat debugging --- external/solanaceae_plugin | 2 +- src/chat_gui4.cpp | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/external/solanaceae_plugin b/external/solanaceae_plugin index d41efdd..3bcb504 160000 --- a/external/solanaceae_plugin +++ b/external/solanaceae_plugin @@ -1 +1 @@ -Subproject commit d41efddf56f710c99a8a86041cdc2d861322ebb0 +Subproject commit 3bcb504a71db7be063df8f2490f5dc183d34aa65 diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index fcc1289..594c43f 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -14,7 +14,6 @@ #include "./media_meta_info_loader.hpp" #include "./sdl_clipboard_utils.hpp" -#include "solanaceae/message3/registry_message_model.hpp" #include #include @@ -158,6 +157,25 @@ void ChatGui4::render(void) { auto* msg_reg_ptr = _rmm.get(*_selected_contact); + if (msg_reg_ptr != nullptr) { + const auto& mm = *msg_reg_ptr; + //const auto& unread_storage = mm.storage(); + if (const auto* unread_storage = mm.storage(); unread_storage != nullptr && !unread_storage->empty()) { + //assert(unread_storage->size() == 0); + //assert(unread_storage.cbegin() == unread_storage.cend()); + std::cout << "UNREAD "; + Message3 prev_ent = entt::null; + for (const Message3 e : mm.view()) { + std::cout << entt::to_integral(e) << " "; + if (prev_ent == e) { + assert(false && "dup"); + } + prev_ent = e; + } + std::cout << "\n"; + } + } + constexpr ImGuiTableFlags table_flags = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_RowBg | @@ -653,6 +671,15 @@ bool ChatGui4::renderContactListContactBig(const Contact3 c, const bool selected bool has_unread = false; if (const auto* mm = _rmm.get(c); mm != nullptr) { if (const auto* unread_storage = mm->storage(); unread_storage != nullptr && !unread_storage->empty()) { +#if 0 + assert(unread_storage.size() == 0); + assert(unread_storage.cbegin() == unread_storage.cend()); + std::cout << "UNREAD "; + for (const auto e : mm->view()) { + std::cout << entt::to_integral(e) << " "; + } + std::cout << "\n"; +#endif has_unread = true; } }