Compare commits
3 Commits
sdl_image
...
dev-29fd1b
Author | SHA1 | Date | |
---|---|---|---|
29fd1bfb62 | |||
998000aa3a | |||
e66f4651d0 |
2
external/solanaceae_contact
vendored
2
external/solanaceae_contact
vendored
Submodule external/solanaceae_contact updated: e40271670b...7710da6c89
2
external/solanaceae_message3
vendored
2
external/solanaceae_message3
vendored
Submodule external/solanaceae_message3 updated: f9f70a05b1...96b76dc67f
2
external/solanaceae_message_serializer
vendored
2
external/solanaceae_message_serializer
vendored
Submodule external/solanaceae_message_serializer updated: 1409485ef1...1a3fcc6757
2
external/solanaceae_tox
vendored
2
external/solanaceae_tox
vendored
Submodule external/solanaceae_tox updated: 25857b8aa7...560eab1f6c
@ -197,9 +197,10 @@ float ChatGui4::render(float time_delta) {
|
||||
sub_contacts = &_cr.get<Contact::Components::ParentOf>(*_selected_contact).subs;
|
||||
}
|
||||
|
||||
const bool highlight_private {!_cr.all_of<Contact::Components::TagPrivate>(*_selected_contact)};
|
||||
|
||||
if (ImGui::BeginChild(chat_label.c_str(), {0, 0}, true)) {
|
||||
//if (_cr.all_of<Contact::Components::ParentOf>(*_selected_contact)) {
|
||||
if (sub_contacts != nullptr) {
|
||||
if (sub_contacts != nullptr && !_cr.all_of<Contact::Components::TagPrivate>(*_selected_contact) && _cr.all_of<Contact::Components::TagGroup>(*_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<ImVec4> row_bg;
|
||||
|
||||
// private group message
|
||||
if (_cr.any_of<Contact::Components::TagSelfWeak, Contact::Components::TagSelfStrong>(c_to.c)) {
|
||||
if (highlight_private && _cr.any_of<Contact::Components::TagSelfWeak, Contact::Components::TagSelfStrong>(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,8 +457,11 @@ float ChatGui4::render(float time_delta) {
|
||||
if (ImGui::TableNextColumn()) {
|
||||
// TODO: theming for hardcoded values
|
||||
|
||||
if (msg_reg.all_of<Message::Components::Remote::TimestampReceived>(e)) {
|
||||
const auto list = msg_reg.get<Message::Components::Remote::TimestampReceived>(e).ts;
|
||||
if (!msg_reg.all_of<Message::Components::ReceivedBy>(e)) {
|
||||
// TODO: dedup?
|
||||
ImGui::TextDisabled("_");
|
||||
} else {
|
||||
const auto list = msg_reg.get<Message::Components::ReceivedBy>(e).ts;
|
||||
// wrongly assumes contacts never get removed from a group
|
||||
if (sub_contacts != nullptr && list.size() < sub_contacts->size()) {
|
||||
// if partically delivered
|
||||
@ -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<Contact::Components::TagSelfStrong>(c)) {
|
||||
//synced_by_text += "\n sself(!)"; // makes no sense
|
||||
@ -480,23 +485,26 @@ float ChatGui4::render(float time_delta) {
|
||||
} else {
|
||||
synced_by_text += "\n >" + (_cr.all_of<Contact::Components::Name>(c) ? _cr.get<Contact::Components::Name>(c).name : "<unk>");
|
||||
}
|
||||
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();
|
||||
|
||||
// TODO: dedup
|
||||
if (msg_reg.all_of<Message::Components::Remote::TimestampRead>(e)) {
|
||||
const auto list = msg_reg.get<Message::Components::Remote::TimestampRead>(e).ts;
|
||||
if (msg_reg.all_of<Message::Components::ReadBy>(e)) {
|
||||
const auto list = msg_reg.get<Message::Components::ReadBy>(e).ts;
|
||||
// wrongly assumes contacts never get removed from a group
|
||||
if (sub_contacts != nullptr && list.size() < sub_contacts->size()) {
|
||||
// if partially read
|
||||
@ -1045,13 +1053,13 @@ void ChatGui4::renderMessageExtra(Message3Registry& reg, const Message3 e) {
|
||||
}
|
||||
|
||||
// TODO: remove?
|
||||
if (reg.all_of<Message::Components::Remote::TimestampReceived>(e)) {
|
||||
if (reg.all_of<Message::Components::ReceivedBy>(e)) {
|
||||
std::string synced_by_text {"receivedBy:"};
|
||||
const int64_t now_ts_s = int64_t(Message::getTimeMS() / 1000u);
|
||||
|
||||
for (const auto& [c, syned_ts] : reg.get<Message::Components::Remote::TimestampReceived>(e).ts) {
|
||||
for (const auto& [c, syned_ts] : reg.get<Message::Components::ReceivedBy>(e).ts) {
|
||||
if (_cr.all_of<Contact::Components::TagSelfStrong>(c)) {
|
||||
synced_by_text += "\n sself(!)"; // makes no sense
|
||||
synced_by_text += "\n sself"; // required (except when synced externally)
|
||||
} else if (_cr.all_of<Contact::Components::TagSelfWeak>(c)) {
|
||||
synced_by_text += "\n wself";
|
||||
} else {
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "./image_loader_webp.hpp"
|
||||
#include "./image_loader_sdl_bmp.hpp"
|
||||
#include "./image_loader_qoi.hpp"
|
||||
#include "./image_loader_stb.hpp"
|
||||
#include "./image_loader_sdl_image.hpp"
|
||||
|
||||
#include <solanaceae/message3/components.hpp>
|
||||
@ -81,7 +80,6 @@ MediaMetaInfoLoader::MediaMetaInfoLoader(RegistryMessageModel& rmm) : _rmm(rmm)
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSDLBMP>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderQOI>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSDLImage>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSTB>());
|
||||
|
||||
_rmm.subscribe(this, RegistryMessageModel_Event::message_construct);
|
||||
_rmm.subscribe(this, RegistryMessageModel_Event::message_updated);
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "./image_loader_sdl_bmp.hpp"
|
||||
#include "./image_loader_qoi.hpp"
|
||||
#include "./image_loader_stb.hpp"
|
||||
#include "./image_loader_webp.hpp"
|
||||
#include "./image_loader_sdl_image.hpp"
|
||||
#include "./media_meta_info_loader.hpp"
|
||||
@ -24,7 +23,6 @@ MessageImageLoader::MessageImageLoader(void) {
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderQOI>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderWebP>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSDLImage>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSTB>());
|
||||
}
|
||||
|
||||
std::optional<TextureEntry> MessageImageLoader::load(TextureUploaderI& tu, Message3Handle m) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "./image_loader_stb.hpp"
|
||||
#include "./image_loader_webp.hpp"
|
||||
#include "./image_loader_qoi.hpp"
|
||||
#include "./image_loader_sdl_image.hpp"
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
@ -16,7 +17,7 @@ SendImagePopup::SendImagePopup(TextureUploaderI& tu) : _tu(tu) {
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSDLBMP>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderQOI>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderWebP>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSTB>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSDLImage>());
|
||||
}
|
||||
|
||||
void SendImagePopup::reset(void) {
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "./image_loader_sdl_bmp.hpp"
|
||||
#include "./image_loader_qoi.hpp"
|
||||
#include "./image_loader_stb.hpp"
|
||||
#include "./image_loader_webp.hpp"
|
||||
#include "./image_loader_sdl_image.hpp"
|
||||
|
||||
@ -26,7 +25,6 @@ ToxAvatarLoader::ToxAvatarLoader(Contact3Registry& cr) : _cr(cr) {
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderQOI>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderWebP>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSDLImage>());
|
||||
_image_loaders.push_back(std::make_unique<ImageLoaderSTB>());
|
||||
}
|
||||
|
||||
static float getHue_6bytes(const uint8_t* data) {
|
||||
|
@ -107,6 +107,12 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM
|
||||
|
||||
const uint64_t ts_now = Message::getTimeMS();
|
||||
|
||||
if (!_cr.all_of<Contact::Components::Self>(c)) {
|
||||
return dfmc_Ret::NO_MSG; // error
|
||||
}
|
||||
|
||||
const auto self_c = _cr.get<Contact::Components::Self>(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::ReceivedBy
|
||||
>(msg)
|
||||
) {
|
||||
continue; // skip
|
||||
@ -139,6 +144,16 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM
|
||||
continue; // not outbound (in private)
|
||||
}
|
||||
|
||||
const auto& ts_received = mr->get<Message::Components::ReceivedBy>(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<Message::Components::Timestamp>(msg).ts;
|
||||
|
Reference in New Issue
Block a user