diff --git a/external/solanaceae_contact b/external/solanaceae_contact index e4027167..7710da6c 160000 --- a/external/solanaceae_contact +++ b/external/solanaceae_contact @@ -1 +1 @@ -Subproject commit e40271670b4df96a8d02f32a1ba61a838419db48 +Subproject commit 7710da6c89f975d7bf34efae340232fdb9a705a5 diff --git a/external/solanaceae_tox b/external/solanaceae_tox index 25857b8a..1d724ef9 160000 --- a/external/solanaceae_tox +++ b/external/solanaceae_tox @@ -1 +1 @@ -Subproject commit 25857b8aa781391ea0a1ce64bcf73a63304fd696 +Subproject commit 1d724ef95146f2588de4bd34ffacff2244c4d68f diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 1fc847be..311f3a5e 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -197,9 +197,10 @@ float ChatGui4::render(float time_delta) { sub_contacts = &_cr.get(*_selected_contact).subs; } + const bool highlight_private {!_cr.all_of(*_selected_contact)}; + if (ImGui::BeginChild(chat_label.c_str(), {0, 0}, true)) { - //if (_cr.all_of(*_selected_contact)) { - if (sub_contacts != nullptr) { + if (sub_contacts != nullptr && !_cr.all_of(*_selected_contact) && _cr.all_of(*_selected_contact)) { if (!sub_contacts->empty()) { if (ImGui::BeginChild("subcontacts", {150, -100}, true)) { ImGui::Text("subs: %zu", sub_contacts->size()); @@ -417,7 +418,7 @@ float ChatGui4::render(float time_delta) { std::optional row_bg; // private group message - if (_cr.any_of(c_to.c)) { + if (highlight_private && _cr.any_of(c_to.c)) { const ImVec4 priv_msg_hi_col = ImVec4(0.5f, 0.2f, 0.5f, 0.35f); ImU32 row_bg_color = ImGui::GetColorU32(priv_msg_hi_col); ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg1, row_bg_color); @@ -456,7 +457,10 @@ float ChatGui4::render(float time_delta) { if (ImGui::TableNextColumn()) { // TODO: theming for hardcoded values - if (msg_reg.all_of(e)) { + if (!msg_reg.all_of(e)) { + // TODO: dedup? + ImGui::TextDisabled("_"); + } else { const auto list = msg_reg.get(e).ts; // wrongly assumes contacts never get removed from a group if (sub_contacts != nullptr && list.size() < sub_contacts->size()) { @@ -471,6 +475,7 @@ float ChatGui4::render(float time_delta) { std::string synced_by_text {"delivery confirmed by:"}; const int64_t now_ts_s = int64_t(Message::getTimeMS() / 1000u); + size_t other_contacts {0}; for (const auto& [c, syned_ts] : list) { if (_cr.all_of(c)) { //synced_by_text += "\n sself(!)"; // makes no sense @@ -480,16 +485,19 @@ float ChatGui4::render(float time_delta) { } else { synced_by_text += "\n >" + (_cr.all_of(c) ? _cr.get(c).name : ""); } + other_contacts += 1; const int64_t seconds_ago = (int64_t(syned_ts / 1000u) - now_ts_s) * -1; synced_by_text += " (" + std::to_string(seconds_ago) + "sec ago)"; } - ImGui::Text("%s", synced_by_text.c_str()); + if (other_contacts > 0) { + ImGui::Text("%s", synced_by_text.c_str()); + } else { + ImGui::TextUnformatted("no delivery confirmation"); + } ImGui::EndTooltip(); } - } else { - ImGui::TextDisabled("_"); } ImGui::SameLine(); @@ -1051,7 +1059,7 @@ void ChatGui4::renderMessageExtra(Message3Registry& reg, const Message3 e) { for (const auto& [c, syned_ts] : reg.get(e).ts) { if (_cr.all_of(c)) { - synced_by_text += "\n sself(!)"; // makes no sense + synced_by_text += "\n sself"; // required (except when synced externally) } else if (_cr.all_of(c)) { synced_by_text += "\n wself"; } else { diff --git a/src/tox_friend_faux_offline_messaging.cpp b/src/tox_friend_faux_offline_messaging.cpp index 4397bf7d..1ca5b181 100644 --- a/src/tox_friend_faux_offline_messaging.cpp +++ b/src/tox_friend_faux_offline_messaging.cpp @@ -107,6 +107,12 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM const uint64_t ts_now = Message::getTimeMS(); + if (!_cr.all_of(c)) { + return dfmc_Ret::NO_MSG; // error + } + + const auto self_c = _cr.get(c).self; + // filter for unconfirmed messages // we assume sorted @@ -127,9 +133,8 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM continue; // skip } - // exclude - if (mr->any_of< - Message::Components::Remote::TimestampReceived // this acts like a tag, which is wrong in groups + if (!mr->any_of< + Message::Components::Remote::TimestampReceived >(msg) ) { continue; // skip @@ -139,6 +144,16 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM continue; // not outbound (in private) } + const auto& ts_received = mr->get(msg).ts; + // not target + if (ts_received.contains(c)) { + continue; + } + // needs to contain self + if (!ts_received.contains(self_c)) { + continue; + } + valid_unsent = true; uint64_t msg_ts = msg_view.get(msg).ts;