Compare commits

...

101 Commits

Author SHA1 Message Date
8c24234126 Merge pull request #8 from Green-Sky/fragment_store
ObjectStore backed MessageFragments
2024-04-14 14:38:49 +02:00
e0d873d41c Merge branch 'master' into fragment_store 2024-04-14 14:32:31 +02:00
5728432b76 everything put into their respective repos 2024-04-14 14:30:42 +02:00
0030487613 move converter tool and pics out 2024-04-14 14:16:53 +02:00
f932f5ffb4 mfs and ms moved to their own repo, now only a few files left to clean up 2024-04-14 13:58:31 +02:00
da83065024 make sure we have the right json version in the flake 2024-04-14 12:03:58 +02:00
a6614e76ce move cursers to public api 2024-04-14 11:13:05 +02:00
a845609660 actually allow loading v2 and enable in converter 2024-04-14 10:23:13 +02:00
de3b8f059e import os and zstdfile2 bugfixes 2024-04-13 21:06:51 +02:00
7b4af58544 prep convert tool for msgpack transition 2024-04-13 19:47:28 +02:00
f287348550 introduce message fragments version 2 (msgpack)
more smaller refactors
2024-04-13 19:13:18 +02:00
498b4435c7 refactor message contexts 2024-04-13 11:38:13 +02:00
a5e67d0ee8 move uuid gen to util 2024-04-12 19:44:24 +02:00
9e30983b22 Merge branch 'master' into fragment_store 2024-04-12 19:24:20 +02:00
dfbb1dea68 move os and backend to sub 2024-04-12 13:42:08 +02:00
2597edd579 new messages objcomp names 2024-04-12 13:42:08 +02:00
85a29372f4 adding message frag object version and conversion work, but comp name changes incoming 2024-04-12 13:42:07 +02:00
a9f6a5d763 move mfs to os, works, convert tool still incomplete 2024-04-12 13:42:07 +02:00
73180195fe some more backend interface changes i realized i had to do 2024-04-12 13:42:07 +02:00
10b689ca95 refactor the serializer again 2024-04-12 13:42:07 +02:00
3796841961 conversion improvements 2024-04-12 13:42:07 +02:00
854ed851b4 fixes missing comps and conversion tool is almost working (most of meta is transfered) 2024-04-12 13:42:07 +02:00
5c3b797a99 new object (os + fsb mostly done) 2024-04-12 13:42:06 +02:00
8a580e2fbb backend fs read 2024-04-12 13:42:06 +02:00
3cede91aa0 more work on backend and moving frags to objs 2024-04-12 13:42:06 +02:00
0610a6a64a continue os refactor, start with fs backend 2024-04-12 13:42:06 +02:00
26d07b06db start refactoring in the name of object store 2024-04-12 13:42:06 +02:00
fd0b210bbb fragment store fully file2 zstd. no more zstd.h in fragment store 2024-04-12 13:42:06 +02:00
268cbe137e move file stack creation to separate file, removing some scope 2024-04-12 13:42:05 +02:00
31bb0d3e61 refactor meta data decompression using file2 and mem 2024-04-12 13:42:05 +02:00
248f68f6a2 minimal stack creation refactor (wip) 2024-04-12 13:42:05 +02:00
3b010bd16f catch write errors (eg unsanitzed strings) 2024-04-12 13:42:05 +02:00
7e285290fe test in memory comp 2024-04-12 13:42:05 +02:00
5767834f71 since its working, remove old commented code 2024-04-12 13:42:05 +02:00
53ce292e82 fix stack overflow (i am stupid) and some file stack error handling 2024-04-12 13:42:04 +02:00
84bd24807d small change to flush work space. writing new frags is broken rn 2024-04-12 13:42:04 +02:00
8d0518c2e3 harden against some parsing exceptions
(by disabling them, since the error case is already handled)
2024-04-12 13:42:04 +02:00
6d150ba441 roll back meta comp (did it wrong) and enable data comp 2024-04-12 13:42:04 +02:00
c737715c66 more refactor and transition meta write 2024-04-12 13:42:04 +02:00
b640b5a06b variant to span helper 2024-04-12 13:42:04 +02:00
1b9363e7b5 tested and works, cleaning up commented code 2024-04-12 13:42:03 +02:00
16d2238f35 fixes for ci 2024-04-12 13:42:03 +02:00
19844a9423 use file2 zstd wrapper to read frag data (untested) 2024-04-12 13:42:03 +02:00
19fd99f713 refactor out uuidgenerator 2024-04-12 13:42:03 +02:00
f22f523774 minor frag store refactor 2024-04-12 13:42:03 +02:00
8b17ed195f more testing and file2 zstd now passes tests with varying frame sizes
and 1.5gig files
2024-04-12 13:42:03 +02:00
def7fc1959 add file2 impl for zstd (lightly tested and not integrated yet) 2024-04-12 13:42:02 +02:00
318be9cd62 throw update 2024-04-12 13:42:02 +02:00
2772c8ee69 reduce excessive message frag saving (queue dedup + waiting 10sec)
prepare for frag updates
2024-04-12 13:42:02 +02:00
eac2927379 try to tame log spam 2024-04-12 13:42:02 +02:00
77a0ae6acd fix accel structure being wrong and mark empty frags and dont count them 2024-04-12 13:42:02 +02:00
7879a0927b combat memory leaks with smart pointers 2024-04-12 13:42:02 +02:00
88ea3e177d refactor saving and save on exit 2024-04-12 13:42:01 +02:00
bc22451524 dirty frag on message updates (if still open) 2024-04-12 13:42:01 +02:00
7b8e93eec3 refactor message fuid -> fid
save alot of memory by using fid instead of fuid
2024-04-12 13:42:01 +02:00
71be5c3c6e reduce log spam 2024-04-12 13:42:01 +02:00
2b8cee6a29 remove old code 2024-04-12 13:42:01 +02:00
5bf4640d61 forgot to throw update on read 2024-04-12 13:42:01 +02:00
0e0e81720b dont sync messages we dont know enough about 2024-04-12 13:42:00 +02:00
592a4cb9cf make adjacency loading work, extend range and use loops 2024-04-12 13:42:00 +02:00
93f60bd073 replace old bad prev/next code with way better code 2024-04-12 13:42:00 +02:00
6a6de77ae9 smaller contact frag fixes 2024-04-12 13:42:00 +02:00
89f065a610 impl new acceleration structure for components, not exploited yet
disable funky load at first msg
2024-04-12 13:42:00 +02:00
52e95ca654 forgot to check contact 2024-04-12 13:41:59 +02:00
eaa316a2aa rework cursers for cg, keep views between switching. will be refactored later 2024-04-12 13:41:59 +02:00
bdf4e60f2f fix one inverted comparator 2024-04-12 13:41:59 +02:00
2e3c779bec stop ignoring mfs interval and sort after 2024-04-12 13:41:59 +02:00
461a4f1aa7 make inital curser a range 2024-04-12 13:41:59 +02:00
78488daa9b loading logic implemented but broken (very funky and sometimes even out of contact) 2024-04-12 13:41:59 +02:00
22f2c8f514 load based on view cursers (untested and not used yet) 2024-04-12 13:41:58 +02:00
e442191aad msg frag before and after helper 2024-04-12 13:41:58 +02:00
795ab2d4e1 fix potential tsrange errors and deduplicate state 2024-04-12 13:41:58 +02:00
0896038dd6 make writing safe (by using a tmp file and moving to actual location) 2024-04-12 13:41:58 +02:00
67c6f9adb0 make empty contacts from ids on message load 2024-04-12 13:41:58 +02:00
6aac44cda9 change binary meta format and add zstd to metadata 2024-04-12 13:41:58 +02:00
4fb2b51b7d switch to streaming compressor for data to drastically improve ratio.
would still benefit from a abstract file refactor
2024-04-12 13:41:57 +02:00
182d844e32 update fs readme a little 2024-04-12 13:41:57 +02:00
6f511016bc save msg json zstd compressed (3x compression) 2024-04-12 13:41:57 +02:00
fb885b5c21 simplify array cast a little 2024-04-12 13:41:57 +02:00
527a7c63f6 add zstd dep 2024-04-12 13:41:57 +02:00
d21dbb43e2 comp refactor and make groups work 2024-04-12 13:41:57 +02:00
7ac62274f4 move json around and disable files for now 2024-04-12 13:41:56 +02:00
4ec87337c8 reverse message write order 2024-04-12 13:41:56 +02:00
20f7c6d011 add dup check, would work for ngc if we saved tox group msg id yet 2024-04-12 13:41:56 +02:00
24dc5a03f3 fix dup on write 2024-04-12 13:41:56 +02:00
3d0863ff9a basically working, but some dup glitch is still there 2024-04-12 13:41:56 +02:00
97aedca844 scan laters 2024-04-12 13:41:56 +02:00
2e7d5538d1 fragment events + 256bit uuids 2024-04-12 13:41:55 +02:00
1bfd04680e refactor message serializer to allow access to eg contacts 2024-04-12 13:41:55 +02:00
73d1d65142 further serializer refactoring 2024-04-12 13:41:55 +02:00
f6e55851cc improve deserialization and provide message comp deserl 2024-04-12 13:41:55 +02:00
0b0245d844 loading fragments mostly working (not notifying anyone yet) 2024-04-12 13:41:55 +02:00
d278391528 add contact id to meta 2024-04-12 13:41:55 +02:00
aa7a5d6013 more comps 2024-04-12 13:41:54 +02:00
84987216cb handle empty type 2024-04-12 13:41:54 +02:00
58e9fd5514 dump messages to data (some comps) 2024-04-12 13:41:54 +02:00
3d41eedf48 message fragment meta is saved, but still empty data 2024-04-12 13:41:54 +02:00
2bc30ffcdc start with messages (no fragments get created yet) 2024-04-12 13:41:54 +02:00
e67d7d37b5 refactoring, add to mainscreen 2024-04-12 13:41:54 +02:00
98ab974515 random ids 2024-04-12 13:41:53 +02:00
267f8dffc1 working prototpying code 2024-04-12 13:41:53 +02:00
17 changed files with 179 additions and 117 deletions

3
.gitmodules vendored
View File

@ -23,3 +23,6 @@
[submodule "external/solanaceae_object_store"]
path = external/solanaceae_object_store
url = https://github.com/Green-Sky/solanaceae_object_store.git
[submodule "external/solanaceae_message_serializer"]
path = external/solanaceae_message_serializer
url = https://github.com/Green-Sky/solanaceae_message_serializer.git

View File

@ -23,8 +23,8 @@ option(TOMATO_ASAN "Build tomato with asan (gcc/clang/msvc)" OFF)
if (TOMATO_ASAN)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
if (NOT WIN32) # exclude mingw
link_libraries(-fsanitize=address)
#link_libraries(-fsanitize=address,undefined)
#link_libraries(-fsanitize=address)
link_libraries(-fsanitize=address,undefined)
#link_libraries(-fsanitize=undefined)
message("II enabled ASAN")
else()

View File

@ -1,10 +1,11 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR)
add_subdirectory(./entt)
add_subdirectory(./solanaceae_util)
add_subdirectory(./solanaceae_contact)
add_subdirectory(./solanaceae_message3)
add_subdirectory(./solanaceae_message_serializer)
add_subdirectory(./solanaceae_plugin)

20
flake.lock generated
View File

@ -34,10 +34,28 @@
"type": "github"
}
},
"nlohmann-json": {
"flake": false,
"locked": {
"lastModified": 1701207391,
"narHash": "sha256-7F0Jon+1oWL7uqet5i1IgHX0fUw/+z0QwEcA3zs5xHg=",
"owner": "nlohmann",
"repo": "json",
"rev": "9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03",
"type": "github"
},
"original": {
"owner": "nlohmann",
"ref": "v3.11.3",
"repo": "json",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"nlohmann-json": "nlohmann-json"
}
},
"systems": {

View File

@ -6,19 +6,25 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
flake-utils.url = "github:numtide/flake-utils";
nlohmann-json = {
url = "github:nlohmann/json/v3.11.3"; # TODO: read version from file
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, nlohmann-json }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
stdenv = (pkgs.stdenvAdapters.keepDebugInfo pkgs.stdenv);
in {
packages.default = pkgs.stdenv.mkDerivation {
#packages.default = pkgs.stdenv.mkDerivation {
packages.default = stdenv.mkDerivation {
pname = "tomato";
version = "0.0.0";
src = ./.;
submodules = 1;
submodules = 1; # does nothing
nativeBuildInputs = with pkgs; [
cmake
@ -58,9 +64,10 @@
cmakeFlags = [
"-DTOMATO_ASAN=OFF"
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"
"-DFETCHCONTENT_SOURCE_DIR_JSON=${pkgs.nlohmann_json.src}" # we care less about version here
# do we really care less about the version? do we need a stable abi?
"-DFETCHCONTENT_SOURCE_DIR_ZSTD=${pkgs.zstd.src}" # TODO: use package instead
"-DFETCHCONTENT_SOURCE_DIR_JSON=${nlohmann-json}" # we care about the version
# TODO: use package instead
"-DFETCHCONTENT_SOURCE_DIR_ZSTD=${pkgs.zstd.src}" # we dont care about the version (we use 1.4.x features)
];
# TODO: replace with install command
@ -69,7 +76,7 @@
mv bin/tomato $out/bin
'';
dontStrip = true;
dontStrip = true; # does nothing
# copied from nixpkgs's SDL2 default.nix
# SDL is weird in that instead of just dynamically linking with
@ -96,6 +103,8 @@
'';
};
#packages.debug = pkgs.enableDebugging self.packages.${system}.default;
devShells.${system}.default = pkgs.mkShell {
#inputsFrom = with pkgs; [ SDL2 ];
buildInputs = [ self.packages.${system}.default ]; # this makes a prebuild tomato available in the shell, do we want this?

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
########################################
add_executable(tomato
./main.cpp
./icon.rc
@ -75,6 +77,7 @@ target_link_libraries(tomato PUBLIC
solanaceae_util
solanaceae_contact
solanaceae_message3
solanaceae_message_serializer
solanaceae_plugin

View File

@ -47,6 +47,18 @@ namespace Components {
} // Components
namespace Context {
// TODO: move back to chat log window and keep per window instead of per contact
struct CGView {
// set to the ts of the newest rendered msg
Message3Handle begin{};
// set to the ts of the oldest rendered msg
Message3Handle end{};
};
} // Context
static constexpr float lerp(float a, float b, float t) {
return a + t * (b - a);
}
@ -269,28 +281,6 @@ float ChatGui4::render(float time_delta) {
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<Message::Components::TagUnread>();
if (const auto* unread_storage = mm.storage<Message::Components::TagUnread>(); unread_storage != nullptr && !unread_storage->empty()) {
//assert(unread_storage->size() == 0);
//assert(unread_storage.cbegin() == unread_storage.cend());
#if 0
std::cout << "UNREAD ";
Message3 prev_ent = entt::null;
for (const Message3 e : mm.view<Message::Components::TagUnread>()) {
std::cout << entt::to_integral(e) << " ";
if (prev_ent == e) {
assert(false && "dup");
}
prev_ent = e;
}
std::cout << "\n";
#endif
}
}
constexpr ImGuiTableFlags table_flags =
ImGuiTableFlags_BordersInnerV |
ImGuiTableFlags_RowBg |
@ -303,6 +293,9 @@ float ChatGui4::render(float time_delta) {
ImGui::TableSetupColumn("timestamp");
ImGui::TableSetupColumn("extra_info", _show_chat_extra_info ? ImGuiTableColumnFlags_None : ImGuiTableColumnFlags_Disabled);
Message3Handle message_view_oldest; // oldest visible message
Message3Handle message_view_newest; // last visible message
// very hacky, and we have variable hight entries
//ImGuiListClipper clipper;
@ -389,12 +382,26 @@ float ChatGui4::render(float time_delta) {
}
// use username as visibility test
if (ImGui::IsItemVisible() && msg_reg.all_of<Message::Components::TagUnread>(e)) {
// get time now
const uint64_t ts_now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
msg_reg.emplace_or_replace<Message::Components::Read>(e, ts_now);
msg_reg.remove<Message::Components::TagUnread>(e);
msg_reg.emplace_or_replace<Components::UnreadFade>(e, 1.f);
if (ImGui::IsItemVisible()) {
if (msg_reg.all_of<Message::Components::TagUnread>(e)) {
// get time now
const uint64_t ts_now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
msg_reg.emplace_or_replace<Message::Components::Read>(e, ts_now);
msg_reg.remove<Message::Components::TagUnread>(e);
msg_reg.emplace_or_replace<Components::UnreadFade>(e, 1.f);
// we remove the unread tag here
_rmm.throwEventUpdate(msg_reg, e);
}
// track view
if (!static_cast<bool>(message_view_oldest)) {
message_view_oldest = {msg_reg, e};
message_view_newest = {msg_reg, e};
} else if (static_cast<bool>(message_view_newest)) {
// update to latest
message_view_newest = {msg_reg, e};
}
}
// highlight self
@ -559,9 +566,90 @@ float ChatGui4::render(float time_delta) {
//ImGui::TableNextRow(0, TEXT_BASE_HEIGHT);
//ImGui::TableNextRow(0, TEXT_BASE_HEIGHT);
{ // update view cursers
if (!msg_reg.ctx().contains<Context::CGView>()) {
msg_reg.ctx().emplace<Context::CGView>();
}
auto& cg_view = msg_reg.ctx().get<Context::CGView>();
// any message in view
if (!static_cast<bool>(message_view_oldest)) {
// no message in view, we setup a view at current time, so the next frags are loaded
if (!static_cast<bool>(cg_view.begin) || !static_cast<bool>(cg_view.end)) {
// fix invalid state
if (static_cast<bool>(cg_view.begin)) {
cg_view.begin.destroy();
_rmm.throwEventDestroy(cg_view.begin);
}
if (static_cast<bool>(cg_view.end)) {
cg_view.end.destroy();
_rmm.throwEventDestroy(cg_view.end);
}
// create new
cg_view.begin = {msg_reg, msg_reg.create()};
cg_view.end = {msg_reg, msg_reg.create()};
cg_view.begin.emplace_or_replace<Message::Components::ViewCurserBegin>(cg_view.end);
cg_view.end.emplace_or_replace<Message::Components::ViewCurserEnd>(cg_view.begin);
cg_view.begin.get_or_emplace<Message::Components::Timestamp>().ts = Message::getTimeMS();
cg_view.end.get_or_emplace<Message::Components::Timestamp>().ts = Message::getTimeMS();
std::cout << "CG: created view FRONT begin ts\n";
_rmm.throwEventConstruct(cg_view.begin);
std::cout << "CG: created view FRONT end ts\n";
_rmm.throwEventConstruct(cg_view.end);
} // else? we do nothing?
} else {
bool begin_created {false};
if (!static_cast<bool>(cg_view.begin)) {
cg_view.begin = {msg_reg, msg_reg.create()};
begin_created = true;
}
bool end_created {false};
if (!static_cast<bool>(cg_view.end)) {
cg_view.end = {msg_reg, msg_reg.create()};
end_created = true;
}
cg_view.begin.emplace_or_replace<Message::Components::ViewCurserBegin>(cg_view.end);
cg_view.end.emplace_or_replace<Message::Components::ViewCurserEnd>(cg_view.begin);
{
auto& old_begin_ts = cg_view.begin.get_or_emplace<Message::Components::Timestamp>().ts;
if (old_begin_ts != message_view_newest.get<Message::Components::Timestamp>().ts) {
old_begin_ts = message_view_newest.get<Message::Components::Timestamp>().ts;
if (begin_created) {
std::cout << "CG: created view begin ts with " << old_begin_ts << "\n";
_rmm.throwEventConstruct(cg_view.begin);
} else {
//std::cout << "CG: updated view begin ts to " << old_begin_ts << "\n";
_rmm.throwEventUpdate(cg_view.begin);
}
}
}
{
auto& old_end_ts = cg_view.end.get_or_emplace<Message::Components::Timestamp>().ts;
if (old_end_ts != message_view_oldest.get<Message::Components::Timestamp>().ts) {
old_end_ts = message_view_oldest.get<Message::Components::Timestamp>().ts;
if (end_created) {
std::cout << "CG: created view end ts with " << old_end_ts << "\n";
_rmm.throwEventConstruct(cg_view.end);
} else {
//std::cout << "CG: updated view end ts to " << old_end_ts << "\n";
_rmm.throwEventUpdate(cg_view.end);
}
}
}
}
}
ImGui::EndTable();
}
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) {
ImGui::SetScrollHereY(1.f);
}

View File

@ -32,6 +32,7 @@ class ChatGui4 {
FileSelector _fss;
SendImagePopup _sip;
// TODO: refactor this to allow multiple open contacts
std::optional<Contact3> _selected_contact;
// TODO: per contact

View File

@ -1,72 +0,0 @@
# Fragment Store
Fragments are are pieces of information split into Metadata and Data.
They can be stored seperated or together.
They can be used as a Transport protocol/logic too.
# Store types
### Object Store
Fragment files are stored with the first 2 hex chars as sub folders:
eg:
`objects/` (object store root)
- `5f/` (first 2hex subfolder)
- `4fffffff` (the fragment file without the first 2 hexchars)
### Split Object Store
Same as Object Store, but medadata and data stored in seperate files.
Metadata files have the `.meta` suffix. They also have a filetype specific suffix, like `.json`, `.msgpack` etc.
### Memory Store
Just keeps the Fragments in memory.
# File formats
Files can be compressed and encrypted. Since compression needs the data structure to funcion, it is applied before it is encrypted.
### Text Json
Text json only makes sense for metadata if it's neither compressed nor encrypted. (otherwise its binary on disk anyway, so why waste bytes).
Since the content of data is not looked at, nothing stops you from using text json and ecrypt it, but atleast basic compression is advised.
A Metadata json object has the following keys:
- `enc` (uint) Encryption type of the data, if any
- `comp` (uint) Compression type of the data, if any
- `metadata` (obj) the
## Binary file headers
### Split Metadata
file magic bytes `SOLMET` (6 bytes)
1 byte encryption type (`0x00` is none)
1 byte compression type (`0x00` is none)
...metadata here...
note that the encryption and compression are for the metadata only.
The metadata itself contains encryption and compression info about the data.
### Split Data
(none) all the data is in the metadata file.
This is mostly to allow direct storage for files in the Fragment store without excessive duplication.
Keep in mind to not use the actual file name as the data/meta file name.
### Single fragment
file magic bytes `SOLFIL` (6 bytes)
1 byte encryption type (`0x00` is none)
1 byte compression type (`0x00` is none)
...metadata here...
...data here...

View File

@ -1,5 +1,8 @@
#include "./main_screen.hpp"
#include <solanaceae/message3/nj/message_components_serializer.hpp>
#include <solanaceae/tox_messages/nj/tox_message_components_serializer.hpp>
#include <solanaceae/contact/components.hpp>
#include <imgui/imgui.h>
@ -12,6 +15,7 @@
MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::string save_password, std::vector<std::string> plugins) :
renderer(renderer_),
rmm(cr),
msnj{cr, {}, {}},
mts(rmm),
tc(save_path, save_password),
tpi(tc.getTox()),
@ -34,6 +38,9 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::stri
{
tel.subscribeAll(tc);
registerMessageComponents(msnj);
registerToxMessageComponents(msnj);
conf.set("tox", "save_file_path", save_path);
{ // name stuff
@ -54,6 +61,7 @@ MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::stri
g_provideInstance<ConfigModelI>("ConfigModelI", "host", &conf);
g_provideInstance<Contact3Registry>("Contact3Registry", "1", "host", &cr);
g_provideInstance<RegistryMessageModel>("RegistryMessageModel", "host", &rmm);
g_provideInstance<MessageSerializerNJ>("MessageSerializerNJ", "host", &msnj);
g_provideInstance<ToxI>("ToxI", "host", &tc);
g_provideInstance<ToxPrivateI>("ToxPrivateI", "host", &tpi);
@ -417,7 +425,7 @@ Screen* MainScreen::tick(float time_delta, bool& quit) {
tdch.tick(time_delta); // compute
mts.iterate(); // compute
mts.iterate(); // compute (after mfs)
_min_tick_interval = std::min<float>(
// HACK: pow by 1.6 to increase 50 -> ~500 (~522)

View File

@ -7,6 +7,7 @@
#include <solanaceae/contact/contact_model3.hpp>
#include <solanaceae/message3/registry_message_model.hpp>
#include <solanaceae/message3/message_time_sort.hpp>
#include <solanaceae/message3/message_serializer.hpp>
#include <solanaceae/plugin/plugin_manager.hpp>
#include <solanaceae/toxcore/tox_event_logger.hpp>
#include "./tox_private_impl.hpp"
@ -49,6 +50,7 @@ struct MainScreen final : public Screen {
SimpleConfigModel conf;
Contact3Registry cr;
RegistryMessageModel rmm;
MessageSerializerNJ msnj;
MessageTimeSort mts;
ToxEventLogger tel{std::cout};

View File

@ -48,4 +48,3 @@ class ToxClient : public ToxDefaultImpl, public ToxEventProviderBase {
void saveToxProfile(void);
};

View File

@ -120,7 +120,8 @@ ToxFriendFauxOfflineMessaging::dfmc_Ret ToxFriendFauxOfflineMessaging::doFriendM
// require
if (!mr->all_of<
Message::Components::MessageText, // text only for now
Message::Components::ContactTo
Message::Components::ContactTo,
Message::Components::ToxFriendMessageID // yes, needs fake ids
>(msg)
) {
continue; // skip