Compare commits

...

4 Commits

Author SHA1 Message Date
Green Sky
43f6759d42 improve tox add friend/group, creating the contact directly
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / linux-arm (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
and add new group creation
2025-07-31 19:00:00 +02:00
Green Sky
e34a763967 add arm linux runner 2025-07-13 16:16:01 +02:00
Green Sky
cbdb733417 update breakpad to v2024.02.16
and lss to v2024.02.01
2025-07-13 16:00:48 +02:00
Green Sky
231e83da4d update imgui in flake 2025-07-13 16:00:48 +02:00
8 changed files with 114 additions and 16 deletions

View File

@@ -34,6 +34,30 @@ jobs:
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
linux-arm:
timeout-minutes: 10
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Dependencies
run: sudo apt update && sudo apt -y install libsodium-dev cmake libx11-dev libxext-dev libxrandr-dev
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{github.event.repository.name}}-${{github.job}}
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
android:
timeout-minutes: 30
# contains sections copied from sdl repo

View File

@@ -8,13 +8,14 @@ if (NOT TARGET breakpad_client)
if (NOT TARGET lss)
FetchContent_Declare(lss
GIT_REPOSITORY https://chromium.googlesource.com/linux-syscall-support/
GIT_TAG 9719c1e1e676814c456b55f5f070eabad6709d31
#GIT_TAG 9719c1e1e676814c456b55f5f070eabad6709d31 # v2022.10.12
GIT_TAG ed31caa60f20a4f6569883b2d752ef7522de51e0 # v2024.02.01
FIND_PACKAGE_ARGS # for the future
)
FetchContent_GetProperties(lss)
if(NOT lss_POPULATED)
FetchContent_Populate(lss)
FetchContent_MakeAvailable(lss)
# HACK: breakpad expects this at a specific path
configure_file(
@@ -31,13 +32,14 @@ if (NOT TARGET breakpad_client)
FetchContent_Declare(breakpad
GIT_REPOSITORY https://chromium.googlesource.com/breakpad/breakpad
GIT_TAG v2023.06.01
#GIT_TAG 76a3c2013b2ebb0d781a523608102f6c0d22231c # v2023.06.01
GIT_TAG 0f8fea981d0f09174e2cc6289aad9a58239c1780 # v2024.02.16
FIND_PACKAGE_ARGS # for the future
)
FetchContent_GetProperties(breakpad)
if(NOT breakpad_POPULATED)
FetchContent_Populate(breakpad)
FetchContent_MakeAvailable(breakpad)
add_library(breakpad_common STATIC
${breakpad_SOURCE_DIR}/src/common/convert_UTF.h

8
flake.lock generated
View File

@@ -21,17 +21,17 @@
"imgui": {
"flake": false,
"locked": {
"lastModified": 1750870001,
"narHash": "sha256-qiESah4j/yHqkOuL5BYANvZfrSqM04CqKONz1jVnkJ0=",
"lastModified": 1752080038,
"narHash": "sha256-m5h/H8k/CZ5Qwr3L9+Elt8XT/Tgwr3s4HuhVtI4wkwE=",
"owner": "ocornut",
"repo": "imgui",
"rev": "85b2fe8486190fa9326565a2fb5fccb6caea4396",
"rev": "5d4126876bc10396d4c6511853ff10964414c776",
"type": "github"
},
"original": {
"owner": "ocornut",
"repo": "imgui",
"rev": "85b2fe8486190fa9326565a2fb5fccb6caea4396",
"rev": "5d4126876bc10396d4c6511853ff10964414c776",
"type": "github"
}
},

View File

@@ -21,7 +21,7 @@
flake = false;
};
imgui = {
url = "github:ocornut/imgui/85b2fe8486190fa9326565a2fb5fccb6caea4396";
url = "github:ocornut/imgui/5d4126876bc10396d4c6511853ff10964414c776";
flake = false;
};
plutosvg = {

View File

@@ -67,7 +67,7 @@ MainScreen::MainScreen(const SimpleConfigModel& conf_, SDL_Renderer* renderer_,
cg(conf, os, rmm, cs, sdlrtu, contact_tc, msg_tc, theme),
sw(conf),
osui(os),
tuiu(tc, conf, &tpi),
tuiu(tc, tcm, conf, &tpi),
tdch(tpi),
tnui(tpi),
smui(os, sm),

View File

@@ -3,6 +3,7 @@
#include "./tox_client.hpp"
#include <solanaceae/toxcore/tox_private_interface.hpp>
#include <solanaceae/tox_contacts/tox_contact_model2.hpp>
#include <tox/tox.h>
@@ -10,6 +11,9 @@
#include <solanaceae/util/config_model.hpp>
#include <entt/entity/registry.hpp>
#include <entt/entity/handle.hpp>
#include <imgui.h>
#include <misc/cpp/imgui_stdlib.h>
@@ -17,9 +21,10 @@
ToxUIUtils::ToxUIUtils(
ToxClient& tc,
ToxContactModel2& tcm,
ConfigModelI& conf,
ToxPrivateI* tp
) : _tc(tc), _conf(conf), _tp(tp) {
) : _tc(tc), _tcm(tcm), _conf(conf), _tp(tp) {
}
void ToxUIUtils::render(void) {
@@ -29,7 +34,7 @@ void ToxUIUtils::render(void) {
if (ImGui::BeginMenuBar()) {
ImGui::Separator();
if (ImGui::BeginMenu("Tox")) {
ImGui::SeparatorText("Friends/Groups");
ImGui::SeparatorText("Friends");
if (ImGui::MenuItem("add Friend by ID", nullptr, _show_add_friend_window)) {
_show_add_friend_window = !_show_add_friend_window;
@@ -37,6 +42,8 @@ void ToxUIUtils::render(void) {
if (ImGui::MenuItem("copy own ToxID")) {
ImGui::SetClipboardText(_tc.toxSelfGetAddressStr().c_str());
}
ImGui::SeparatorText("Groups");
if (ImGui::MenuItem("join Group by ID (ngc)", nullptr, _show_add_group_window)) {
_show_add_group_window = !_show_add_group_window;
}
@@ -62,6 +69,10 @@ void ToxUIUtils::render(void) {
ImGui::EndMenu();
}
if (ImGui::MenuItem("new Group (ngc)", nullptr, _show_new_group_window)) {
_show_new_group_window = !_show_new_group_window;
}
ImGui::SeparatorText("DHT");
if (ImGui::MenuItem("rerun bootstrap")) {
@@ -111,7 +122,10 @@ void ToxUIUtils::render(void) {
static Tox_Err_Friend_Add err = Tox_Err_Friend_Add::TOX_ERR_FRIEND_ADD_OK;
if (ImGui::Button("add")) {
auto [_, err_r] = _tc.toxFriendAdd(hex2bin(std::string_view{tox_id, std::size(tox_id)-1}), message);
auto [_, err_r] = _tcm.createContactFriend(
std::string_view{tox_id, std::size(tox_id)-1},
message
);
err = err_r;
{ // reset everything
@@ -143,8 +157,8 @@ void ToxUIUtils::render(void) {
static Tox_Err_Group_Join err = Tox_Err_Group_Join::TOX_ERR_GROUP_JOIN_OK;
if (ImGui::Button("join/reconnect")) {
auto [_, err_r] = _tc.toxGroupJoin(
hex2bin(std::string_view{_chat_id, std::size(_chat_id)-1}),
auto [_, err_r] = _tcm.createContactGroupJoin(
std::string_view{_chat_id, std::size(_chat_id)-1},
self_name,
password
);
@@ -168,5 +182,59 @@ void ToxUIUtils::render(void) {
}
ImGui::End();
}
if (_show_new_group_window) {
if (ImGui::Begin("Tox new Group", &_show_new_group_window)) {
ImGui::TextDisabled("NGC refers to the New DHT enabled Group Chats.");
ImGui::TextDisabled("Connecting via ID might take a very long time.");
static int privacy_state{Tox_Group_Privacy_State::TOX_GROUP_PRIVACY_STATE_PUBLIC};
ImGui::Combo("privacy state", &privacy_state, "public\0private\0");
ImGui::SetItemTooltip("Public groups get announced to the DHT.\nAnyone can scrape the DHT and find your group.\n\nPrivate groups can not be joined via ID (DHT lookup).");
static std::string name;
ImGui::InputText("name of the group", &name);
static std::string self_name = _conf.get_string("tox", "name").value_or("default_tomato");
ImGui::InputText("name of yourself", &self_name);
static std::string password;
ImGui::InputText("password for group", &password);
static Tox_Err_Group_New err = Tox_Err_Group_New::TOX_ERR_GROUP_NEW_OK;
static Tox_Err_Group_Set_Password err_pw = Tox_Err_Group_Set_Password::TOX_ERR_GROUP_SET_PASSWORD_OK;
if (ImGui::Button("create")) {
auto [new_c, err_r, err_pw_r] = _tcm.createContactGroupNew(
static_cast<Tox_Group_Privacy_State>(privacy_state),
name,
self_name,
password
);
err = err_r;
err_pw = err_pw_r;
{ // reset everything
for (size_t i = 0; i < name.size(); i++) {
name.at(i) = '\0';
}
name.clear();
self_name = _conf.get_string("tox", "name").value_or("default_tomato");
for (size_t i = 0; i < password.size(); i++) {
password.at(i) = '\0';
}
password.clear();
}
}
if (err != Tox_Err_Group_New::TOX_ERR_GROUP_NEW_OK || err_pw != Tox_Err_Group_Set_Password::TOX_ERR_GROUP_SET_PASSWORD_OK) {
ImGui::SameLine();
ImGui::Text("error creating group!");
ImGui::Text("group: '%s' (%d)", tox_err_group_new_to_string(err), err);
ImGui::Text("pw: '%s' (%d)", tox_err_group_set_password_to_string(err_pw), err_pw);
}
}
ImGui::End();
}
}

View File

@@ -5,12 +5,15 @@
class ToxClient;
struct ConfigModelI;
struct ToxPrivateI;
class ToxContactModel2;
class ToxUIUtils {
bool _show_add_friend_window {false};
bool _show_add_group_window {false};
bool _show_new_group_window {false};
ToxClient& _tc;
ToxContactModel2& _tcm;
ConfigModelI& _conf;
ToxPrivateI* _tp {nullptr};
@@ -19,6 +22,7 @@ class ToxUIUtils {
public:
ToxUIUtils(
ToxClient& tc,
ToxContactModel2& tcm,
ConfigModelI& conf,
ToxPrivateI* tp = nullptr
);