Compare commits
92 Commits
bc46deb600
...
master
Author | SHA1 | Date | |
---|---|---|---|
66b5d94e00 | |||
5649a2ad9c | |||
ba4f0e0e3e | |||
3160e57f4d | |||
4538651608 | |||
c6b98f9be9 | |||
8ab43626ae | |||
5f53901274 | |||
be186bc025 | |||
87b9a7d089 | |||
e913ed87e9 | |||
bfb2d8d8e5 | |||
9496b94752 | |||
a4e4a5bc7e | |||
19d5b1078a | |||
44d0f07975 | |||
80813a067d | |||
7e42c559ab | |||
115f067b29 | |||
dd660b26ed | |||
b3b9a9b231 | |||
65d8b4a573 | |||
05db3104f9 | |||
8128d923f3 | |||
9bd8bf25e3 | |||
335929d3e3 | |||
c78f500cef | |||
96da8a6115 | |||
a46d31c414 | |||
16f4e7879a | |||
4db16f9b35 | |||
be680927be | |||
ba22e77321 | |||
28a2c99c75 | |||
c1c85ee0c9 | |||
04276369fe | |||
93e19ea087 | |||
448df20d61 | |||
f38c39343e | |||
2fac28d6a7 | |||
94b54be25f | |||
6d438dc401 | |||
c5d3b3b8f6 | |||
90a6243432 | |||
c267b05b58 | |||
1afc875bd5 | |||
0ec4d5964c | |||
ac54d5c5a8 | |||
38b54d09df | |||
f3d4d2150b | |||
b160d58494 | |||
ab341802b8 | |||
29b506f927 | |||
762378e85d | |||
ae1f5cf18d | |||
9851771b87 | |||
1eea006778 | |||
4ae7ebd98d | |||
4b41375e0d | |||
c54542a841 | |||
a5b5ab97df | |||
c88aa92a8d | |||
b51414f049 | |||
3d9cdf581e | |||
1efab248ca | |||
e497941b18 | |||
85d8b0dcd6 | |||
54f49a9bec | |||
b25831734b | |||
9a8c7dc4fc | |||
0705580ce8 | |||
e83b75cdd8 | |||
c648958468 | |||
848c176596 | |||
8490dbe32a | |||
85514ccbb1 | |||
0d6e21bf2a | |||
0039a5091a | |||
3e86448074 | |||
ad56fa9e3d | |||
ed29651394 | |||
36b25b2dd4 | |||
894a2b60a6 | |||
999a34de88 | |||
a82eb08c0d | |||
762c104779 | |||
9eb49b55fa | |||
ccc92763ef | |||
d66b41513c | |||
415bdf0e15 | |||
c67600aa14 | |||
1b55a7dd70 |
35
.github/workflows/cd.yml
vendored
35
.github/workflows/cd.yml
vendored
@ -7,14 +7,14 @@ on:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
|
||||
jobs:
|
||||
linux-ubuntu:
|
||||
timeout-minutes: 10
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -25,7 +25,7 @@ jobs:
|
||||
run: sudo apt update && sudo apt -y install libsodium-dev
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-gz -DCMAKE_CXX_FLAGS=-gz
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
|
||||
@ -46,15 +46,15 @@ jobs:
|
||||
- name: Compress artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# TODO: simpler name?
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64.tar.gz
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu22.04-x86_64.tar.gz
|
||||
|
||||
|
||||
windows:
|
||||
@ -67,14 +67,17 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: update vcpkg
|
||||
shell: bash
|
||||
run: |
|
||||
cd C:/vcpkg
|
||||
git pull
|
||||
- name: Export GitHub Actions cache environment variables
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
|
||||
- name: Install Dependencies
|
||||
run: vcpkg install libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
|
||||
# setup vs env
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
@ -82,7 +85,7 @@ jobs:
|
||||
arch: amd64
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
@ -100,6 +103,12 @@ jobs:
|
||||
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Clean temporary artifacts
|
||||
# msvc sometimes produces .ilk files, which are used for linking only
|
||||
shell: powershell
|
||||
run: |
|
||||
Remove-Item "${{github.workspace}}/build/bin/*.ilk"
|
||||
|
||||
- name: Compress artifacts
|
||||
shell: powershell
|
||||
run: |
|
||||
|
56
.github/workflows/ci.yml
vendored
56
.github/workflows/ci.yml
vendored
@ -39,11 +39,26 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- vcpkg_toolkit: arm-neon-android-23
|
||||
ndk_abi: armeabi-v7a
|
||||
- vcpkg_toolkit: arm64-android-23
|
||||
ndk_abi: arm64-v8a
|
||||
- vcpkg_toolkit: x64-android-23
|
||||
ndk_abi: x86_64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'Green-Sky/vcpkg_android_triplets'
|
||||
path: 'vcpkg_android_triplets'
|
||||
|
||||
- uses: nttld/setup-ndk@v1
|
||||
id: setup_ndk
|
||||
with:
|
||||
@ -55,23 +70,27 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: update vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg.git
|
||||
|
||||
- name: Install Dependencies (host)
|
||||
run: sudo apt update && sudo apt -y install cmake pkg-config nasm
|
||||
|
||||
- name: Export GitHub Actions cache environment variables
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
|
||||
- name: Install Dependencies (target)
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
|
||||
run: vcpkg install --triplet arm64-android --overlay-ports=vcpkg/ports libsodium openssl
|
||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||
run: vcpkg install --overlay-triplets=vcpkg_android_triplets --triplet ${{matrix.platform.vcpkg_toolkit}} libsodium openssl
|
||||
|
||||
# vcpkg scripts root /usr/local/share/vcpkg/scripts
|
||||
- name: Configure CMake
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-android -DANDROID=1 -DANDROID_PLATFORM=23 -DANDROID_ABI=arm64-v8a -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{steps.setup_ndk.outputs.ndk-path}}/build/cmake/android.toolchain.cmake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{matrix.platform.vcpkg_toolkit}} -DANDROID=1 -DANDROID_PLATFORM=23 -DANDROID_ABI=${{matrix.platform.ndk_abi}} -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{steps.setup_ndk.outputs.ndk-path}}/build/cmake/android.toolchain.cmake
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
|
||||
@ -79,14 +98,14 @@ jobs:
|
||||
- name: Compress artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
tar -czvf ${{ github.event.repository.name }}-android-arm64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
tar -czvf ${{ github.event.repository.name }}-${{matrix.platform.vcpkg_toolkit}}.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-android-arm64
|
||||
name: ${{ github.event.repository.name }}-${{matrix.platform.vcpkg_toolkit}}
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{github.event.repository.name}}-android-arm64.tar.gz
|
||||
${{github.workspace}}/${{github.event.repository.name}}-${{matrix.platform.vcpkg_toolkit}}.tar.gz
|
||||
|
||||
macos:
|
||||
timeout-minutes: 10
|
||||
@ -112,7 +131,7 @@ jobs:
|
||||
run: ctest -C ${{env.BUILD_TYPE}}
|
||||
|
||||
windows:
|
||||
timeout-minutes: 10
|
||||
timeout-minutes: 15
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
@ -121,14 +140,17 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: update vcpkg
|
||||
shell: bash
|
||||
run: |
|
||||
cd C:/vcpkg
|
||||
git pull
|
||||
- name: Export GitHub Actions cache environment variables
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
|
||||
- name: Install Dependencies
|
||||
run: vcpkg install libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
|
||||
# setup vs env
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
@ -136,7 +158,7 @@ jobs:
|
||||
arch: amd64
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSOLANACEAE_ECOSYSTEM_BUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSOLANACEAE_ECOSYSTEM_BUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 3
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -59,3 +59,6 @@
|
||||
[submodule "external/solanaceae_message_fragment_store"]
|
||||
path = external/solanaceae_message_fragment_store
|
||||
url = https://github.com/Green-Sky/solanaceae_message_fragment_store.git
|
||||
[submodule "external/solanaceae_tox_p2prng"]
|
||||
path = external/solanaceae_tox_p2prng
|
||||
url = https://github.com/Green-Sky/solanaceae_tox_p2prng.git
|
||||
|
@ -48,6 +48,9 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL
|
||||
-Wshadow # Warn if a variable declaration shadows one from a parent context
|
||||
)
|
||||
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
add_link_options(-fno-omit-frame-pointer)
|
||||
|
||||
if (NOT WIN32)
|
||||
#link_libraries(-fsanitize=address,undefined)
|
||||
#link_libraries(-fsanitize=undefined)
|
||||
@ -58,6 +61,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
endif()
|
||||
|
||||
# remove unreferenced objects, reducing binary and debugsymbol sizes
|
||||
# does not work !!! (it actually slightly increased the file size by <1%)
|
||||
# add_link_options("/OPT:REF")
|
||||
endif()
|
||||
|
||||
# cmake setup end
|
||||
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Erik Scholz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
31
external/CMakeLists.txt
vendored
31
external/CMakeLists.txt
vendored
@ -1,45 +1,52 @@
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR)
|
||||
|
||||
set(SOLANACEAE_UTIL_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING})
|
||||
add_subdirectory(./solanaceae_util)
|
||||
add_subdirectory(./solanaceae_plugin)
|
||||
|
||||
add_subdirectory(./entt)
|
||||
|
||||
set(SOLANACEAE_OBJECT_STORE_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_object_store)
|
||||
|
||||
add_subdirectory(./solanaceae_contact)
|
||||
add_subdirectory(./solanaceae_message3)
|
||||
|
||||
set(SOLANACEAE_BRIDGE_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_BRIDGE_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_bridge)
|
||||
|
||||
set(SOLANACEAE_OBJECT_STORE_BUILD_TESTING ON)
|
||||
add_subdirectory(./solanaceae_object_store)
|
||||
|
||||
add_subdirectory(./solanaceae_message_serializer)
|
||||
set(SOLANACEAE_MESSAGE_FRAGMENT_STORE_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_MESSAGE_FRAGMENT_STORE_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_message_fragment_store)
|
||||
|
||||
add_subdirectory(./toxcore)
|
||||
add_subdirectory(./solanaceae_toxcore)
|
||||
add_subdirectory(./solanaceae_tox)
|
||||
|
||||
set(SOLANACEAE_TOX_UPNP_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_TOX_UPNP_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_tox_upnp)
|
||||
|
||||
set(SOLANACEAE_TOX_P2PRNG_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_tox_p2prng)
|
||||
|
||||
set(SOLANACEAE_NGCFT1_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
set(SOLANACEAE_NGCFT1_SHA1_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "")
|
||||
set(SOLANACEAE_NGCHS2_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_ngc_ft1)
|
||||
|
||||
set(SOLANACEAE_ZOX_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_ZOX_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_zox)
|
||||
|
||||
set(SOLANACEAE_TOXIC_GAMES_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_TOXIC_GAMES_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_toxic_games)
|
||||
|
||||
set(SOLANACEAE_IRCCLIENT_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_IRCCLIENT_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_ircclient)
|
||||
|
||||
set(SOLANACEAE_CRDTNOTES_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_CRDTNOTES_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_crdtnotes)
|
||||
|
||||
set(SOLANACEAE_LLAMA-CPP-WEB_BUILD_PLUGINS ON)
|
||||
set(SOLANACEAE_LLAMA-CPP-WEB_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_llama-cpp-web)
|
||||
|
||||
add_subdirectory(./totato)
|
||||
|
2
external/solanaceae_bridge
vendored
2
external/solanaceae_bridge
vendored
Submodule external/solanaceae_bridge updated: b21acd4c99...dd462b450e
2
external/solanaceae_contact
vendored
2
external/solanaceae_contact
vendored
Submodule external/solanaceae_contact updated: 2401079c1d...5adf5bf9da
2
external/solanaceae_crdtnotes
vendored
2
external/solanaceae_crdtnotes
vendored
Submodule external/solanaceae_crdtnotes updated: a0d122540b...e7096ee20f
2
external/solanaceae_ircclient
vendored
2
external/solanaceae_ircclient
vendored
Submodule external/solanaceae_ircclient updated: d7280771ce...4fea965521
2
external/solanaceae_llama-cpp-web
vendored
2
external/solanaceae_llama-cpp-web
vendored
Submodule external/solanaceae_llama-cpp-web updated: f38da08334...7e1b424adb
2
external/solanaceae_message3
vendored
2
external/solanaceae_message3
vendored
Submodule external/solanaceae_message3 updated: f03c4b1210...7f1a5ea1d4
2
external/solanaceae_message_fragment_store
vendored
2
external/solanaceae_message_fragment_store
vendored
Submodule external/solanaceae_message_fragment_store updated: d333927ec3...c8507c3054
2
external/solanaceae_message_serializer
vendored
2
external/solanaceae_message_serializer
vendored
Submodule external/solanaceae_message_serializer updated: e574c4f779...c284e0779e
2
external/solanaceae_ngc_ft1
vendored
2
external/solanaceae_ngc_ft1
vendored
Submodule external/solanaceae_ngc_ft1 updated: 0eb30246a8...0ad4c4997c
2
external/solanaceae_object_store
vendored
2
external/solanaceae_object_store
vendored
Submodule external/solanaceae_object_store updated: be24b3815b...889761f538
2
external/solanaceae_plugin
vendored
2
external/solanaceae_plugin
vendored
Submodule external/solanaceae_plugin updated: ade1b4ea74...d03d2dae67
2
external/solanaceae_tox
vendored
2
external/solanaceae_tox
vendored
Submodule external/solanaceae_tox updated: 676e50c61a...ec926dcb95
1
external/solanaceae_tox_p2prng
vendored
Submodule
1
external/solanaceae_tox_p2prng
vendored
Submodule
Submodule external/solanaceae_tox_p2prng added at 7397a0d02b
2
external/solanaceae_tox_upnp
vendored
2
external/solanaceae_tox_upnp
vendored
Submodule external/solanaceae_tox_upnp updated: 30a22fd933...4df49c5be9
2
external/solanaceae_toxcore
vendored
2
external/solanaceae_toxcore
vendored
Submodule external/solanaceae_toxcore updated: 7cd6a2b0de...ebd6bcc483
2
external/solanaceae_toxic_games
vendored
2
external/solanaceae_toxic_games
vendored
Submodule external/solanaceae_toxic_games updated: 599094c8e4...7b7b3f4a94
2
external/solanaceae_util
vendored
2
external/solanaceae_util
vendored
Submodule external/solanaceae_util updated: 4bda751f76...6cbcc9463c
2
external/solanaceae_zox
vendored
2
external/solanaceae_zox
vendored
Submodule external/solanaceae_zox updated: 88cfc8638e...399c27cc2b
2
external/totato
vendored
2
external/totato
vendored
Submodule external/totato updated: 4a59a83eca...9e42508428
265
external/toxcore/CMakeLists.txt
vendored
265
external/toxcore/CMakeLists.txt
vendored
@ -1,215 +1,80 @@
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.13...3.16 FATAL_ERROR)
|
||||
|
||||
set(EXPERIMENTAL_API ON CACHE BOOL "" FORCE)
|
||||
set(UNITTEST OFF CACHE BOOL "" FORCE)
|
||||
set(BOOTSTRAP_DAEMON OFF CACHE BOOL "" FORCE)
|
||||
#if (TOMATO_TOX_AV)
|
||||
# set(BUILD_TOXAV ON CACHE BOOL "" FORCE)
|
||||
# set(MUST_BUILD_TOXAV ON CACHE BOOL "" FORCE)
|
||||
#endif()
|
||||
|
||||
add_subdirectory(./c-toxcore)
|
||||
|
||||
#message("II BUILD_TOXAV: ${BUILD_TOXAV}")
|
||||
|
||||
# the sad case
|
||||
add_library(toxcore INTERFACE)
|
||||
|
||||
if (TARGET toxcore_static)
|
||||
target_link_libraries(toxcore INTERFACE toxcore_static)
|
||||
|
||||
# the ideal case
|
||||
#add_library(toxcore ALIAS toxcore_static)
|
||||
else()
|
||||
target_link_libraries(toxcore INTERFACE toxcore_shared)
|
||||
|
||||
# the ideal case
|
||||
#add_library(toxcore ALIAS toxcore_shared)
|
||||
endif()
|
||||
|
||||
# HACK: "install" api headers into binary dir
|
||||
configure_file(
|
||||
./c-toxcore/toxcore/tox.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox.h
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
./c-toxcore/toxcore/tox_events.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox_events.h
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
./c-toxcore/toxcore/tox_private.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/tox/tox_private.h
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
./c-toxcore/toxencryptsave/toxencryptsave.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/tox/toxencryptsave.h
|
||||
@ONLY
|
||||
)
|
||||
#configure_file(
|
||||
# ./c-toxcore/toxav/toxav.h
|
||||
# ${CMAKE_CURRENT_BINARY_DIR}/include/tox/toxav.h
|
||||
# @ONLY
|
||||
#)
|
||||
|
||||
target_include_directories(toxcore INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||
|
||||
# HACK: support old libsodium find
|
||||
# libs should handle this case themselfs
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
set(TOX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/c-toxcore/")
|
||||
|
||||
# TODO: shared
|
||||
add_library(toxcore STATIC
|
||||
${TOX_DIR}third_party/cmp/cmp.c
|
||||
${TOX_DIR}third_party/cmp/cmp.h
|
||||
|
||||
${TOX_DIR}toxcore/announce.c
|
||||
${TOX_DIR}toxcore/announce.h
|
||||
${TOX_DIR}toxcore/bin_pack.c
|
||||
${TOX_DIR}toxcore/bin_pack.h
|
||||
${TOX_DIR}toxcore/bin_unpack.c
|
||||
${TOX_DIR}toxcore/bin_unpack.h
|
||||
${TOX_DIR}toxcore/ccompat.c
|
||||
${TOX_DIR}toxcore/ccompat.h
|
||||
${TOX_DIR}toxcore/crypto_core.c
|
||||
${TOX_DIR}toxcore/crypto_core.h
|
||||
${TOX_DIR}toxcore/crypto_core_pack.c
|
||||
${TOX_DIR}toxcore/crypto_core_pack.h
|
||||
${TOX_DIR}toxcore/DHT.c
|
||||
${TOX_DIR}toxcore/DHT.h
|
||||
${TOX_DIR}toxcore/events/conference_connected.c
|
||||
${TOX_DIR}toxcore/events/conference_invite.c
|
||||
${TOX_DIR}toxcore/events/conference_message.c
|
||||
${TOX_DIR}toxcore/events/conference_peer_list_changed.c
|
||||
${TOX_DIR}toxcore/events/conference_peer_name.c
|
||||
${TOX_DIR}toxcore/events/conference_title.c
|
||||
${TOX_DIR}toxcore/events/dht_get_nodes_response.c
|
||||
${TOX_DIR}toxcore/events/events_alloc.c
|
||||
${TOX_DIR}toxcore/events/events_alloc.h
|
||||
${TOX_DIR}toxcore/events/file_chunk_request.c
|
||||
${TOX_DIR}toxcore/events/file_recv.c
|
||||
${TOX_DIR}toxcore/events/file_recv_chunk.c
|
||||
${TOX_DIR}toxcore/events/file_recv_control.c
|
||||
${TOX_DIR}toxcore/events/friend_connection_status.c
|
||||
${TOX_DIR}toxcore/events/friend_lossless_packet.c
|
||||
${TOX_DIR}toxcore/events/friend_lossy_packet.c
|
||||
${TOX_DIR}toxcore/events/friend_message.c
|
||||
${TOX_DIR}toxcore/events/friend_name.c
|
||||
${TOX_DIR}toxcore/events/friend_read_receipt.c
|
||||
${TOX_DIR}toxcore/events/friend_request.c
|
||||
${TOX_DIR}toxcore/events/friend_status.c
|
||||
${TOX_DIR}toxcore/events/friend_status_message.c
|
||||
${TOX_DIR}toxcore/events/friend_typing.c
|
||||
${TOX_DIR}toxcore/events/self_connection_status.c
|
||||
${TOX_DIR}toxcore/events/group_custom_packet.c
|
||||
${TOX_DIR}toxcore/events/group_custom_private_packet.c
|
||||
${TOX_DIR}toxcore/events/group_invite.c
|
||||
${TOX_DIR}toxcore/events/group_join_fail.c
|
||||
${TOX_DIR}toxcore/events/group_message.c
|
||||
${TOX_DIR}toxcore/events/group_moderation.c
|
||||
${TOX_DIR}toxcore/events/group_password.c
|
||||
${TOX_DIR}toxcore/events/group_peer_exit.c
|
||||
${TOX_DIR}toxcore/events/group_peer_join.c
|
||||
${TOX_DIR}toxcore/events/group_peer_limit.c
|
||||
${TOX_DIR}toxcore/events/group_peer_name.c
|
||||
${TOX_DIR}toxcore/events/group_peer_status.c
|
||||
${TOX_DIR}toxcore/events/group_privacy_state.c
|
||||
${TOX_DIR}toxcore/events/group_private_message.c
|
||||
${TOX_DIR}toxcore/events/group_self_join.c
|
||||
${TOX_DIR}toxcore/events/group_topic.c
|
||||
${TOX_DIR}toxcore/events/group_topic_lock.c
|
||||
${TOX_DIR}toxcore/events/group_voice_state.c
|
||||
${TOX_DIR}toxcore/forwarding.c
|
||||
${TOX_DIR}toxcore/forwarding.h
|
||||
${TOX_DIR}toxcore/friend_connection.c
|
||||
${TOX_DIR}toxcore/friend_connection.h
|
||||
${TOX_DIR}toxcore/friend_requests.c
|
||||
${TOX_DIR}toxcore/friend_requests.h
|
||||
${TOX_DIR}toxcore/group.c
|
||||
${TOX_DIR}toxcore/group.h
|
||||
${TOX_DIR}toxcore/group_announce.c
|
||||
${TOX_DIR}toxcore/group_announce.h
|
||||
${TOX_DIR}toxcore/group_moderation.c
|
||||
${TOX_DIR}toxcore/group_moderation.h
|
||||
${TOX_DIR}toxcore/group_chats.c
|
||||
${TOX_DIR}toxcore/group_chats.h
|
||||
${TOX_DIR}toxcore/group_common.h
|
||||
${TOX_DIR}toxcore/group_connection.c
|
||||
${TOX_DIR}toxcore/group_connection.h
|
||||
${TOX_DIR}toxcore/group_onion_announce.c
|
||||
${TOX_DIR}toxcore/group_onion_announce.h
|
||||
${TOX_DIR}toxcore/group_pack.c
|
||||
${TOX_DIR}toxcore/group_pack.h
|
||||
${TOX_DIR}toxcore/LAN_discovery.c
|
||||
${TOX_DIR}toxcore/LAN_discovery.h
|
||||
${TOX_DIR}toxcore/list.c
|
||||
${TOX_DIR}toxcore/list.h
|
||||
${TOX_DIR}toxcore/logger.c
|
||||
${TOX_DIR}toxcore/logger.h
|
||||
${TOX_DIR}toxcore/Messenger.c
|
||||
${TOX_DIR}toxcore/Messenger.h
|
||||
${TOX_DIR}toxcore/mem.c
|
||||
${TOX_DIR}toxcore/mem.h
|
||||
${TOX_DIR}toxcore/mono_time.c
|
||||
${TOX_DIR}toxcore/mono_time.h
|
||||
${TOX_DIR}toxcore/net_crypto.c
|
||||
${TOX_DIR}toxcore/net_crypto.h
|
||||
${TOX_DIR}toxcore/network.c
|
||||
${TOX_DIR}toxcore/network.h
|
||||
${TOX_DIR}toxcore/onion_announce.c
|
||||
${TOX_DIR}toxcore/onion_announce.h
|
||||
${TOX_DIR}toxcore/onion.c
|
||||
${TOX_DIR}toxcore/onion_client.c
|
||||
${TOX_DIR}toxcore/onion_client.h
|
||||
${TOX_DIR}toxcore/onion.h
|
||||
${TOX_DIR}toxcore/ping_array.c
|
||||
${TOX_DIR}toxcore/ping_array.h
|
||||
${TOX_DIR}toxcore/ping.c
|
||||
${TOX_DIR}toxcore/ping.h
|
||||
${TOX_DIR}toxcore/shared_key_cache.c
|
||||
${TOX_DIR}toxcore/shared_key_cache.h
|
||||
${TOX_DIR}toxcore/state.c
|
||||
${TOX_DIR}toxcore/state.h
|
||||
${TOX_DIR}toxcore/TCP_client.c
|
||||
${TOX_DIR}toxcore/TCP_client.h
|
||||
${TOX_DIR}toxcore/TCP_common.c
|
||||
${TOX_DIR}toxcore/TCP_common.h
|
||||
${TOX_DIR}toxcore/TCP_connection.c
|
||||
${TOX_DIR}toxcore/TCP_connection.h
|
||||
${TOX_DIR}toxcore/TCP_server.c
|
||||
${TOX_DIR}toxcore/TCP_server.h
|
||||
${TOX_DIR}toxcore/timed_auth.c
|
||||
${TOX_DIR}toxcore/timed_auth.h
|
||||
${TOX_DIR}toxcore/tox_api.c
|
||||
${TOX_DIR}toxcore/tox.c
|
||||
${TOX_DIR}toxcore/tox_dispatch.c
|
||||
${TOX_DIR}toxcore/tox_dispatch.h
|
||||
${TOX_DIR}toxcore/tox_event.c
|
||||
${TOX_DIR}toxcore/tox_event.h
|
||||
${TOX_DIR}toxcore/tox_events.c
|
||||
${TOX_DIR}toxcore/tox_events.h
|
||||
${TOX_DIR}toxcore/tox.h
|
||||
${TOX_DIR}toxcore/tox_private.c
|
||||
${TOX_DIR}toxcore/tox_private.h
|
||||
${TOX_DIR}toxcore/tox_pack.c
|
||||
${TOX_DIR}toxcore/tox_pack.h
|
||||
${TOX_DIR}toxcore/tox_unpack.c
|
||||
${TOX_DIR}toxcore/tox_unpack.h
|
||||
${TOX_DIR}toxcore/util.c
|
||||
${TOX_DIR}toxcore/util.h
|
||||
|
||||
${TOX_DIR}toxencryptsave/defines.h
|
||||
${TOX_DIR}toxencryptsave/toxencryptsave.c
|
||||
${TOX_DIR}toxencryptsave/toxencryptsave.h
|
||||
)
|
||||
|
||||
# HACK: "install" api headers into self
|
||||
# this is dirty, should be binary dir
|
||||
# TODO: add the others
|
||||
configure_file(
|
||||
${TOX_DIR}toxcore/tox.h
|
||||
${TOX_DIR}tox/tox.h
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
${TOX_DIR}toxcore/tox_events.h
|
||||
${TOX_DIR}tox/tox_events.h
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
${TOX_DIR}toxcore/tox_private.h
|
||||
${TOX_DIR}tox/tox_private.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
target_include_directories(toxcore PRIVATE "${TOX_DIR}toxcore")
|
||||
target_include_directories(toxcore PUBLIC "${TOX_DIR}")
|
||||
|
||||
target_compile_definitions(toxcore PUBLIC USE_IPV6=1)
|
||||
#target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_DEBUG)
|
||||
target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_INFO)
|
||||
|
||||
find_package(unofficial-sodium CONFIG QUIET)
|
||||
find_package(sodium QUIET)
|
||||
if(unofficial-sodium_FOUND) # vcpkg
|
||||
if(TARGET unofficial-sodium::sodium)
|
||||
target_link_libraries(toxcore unofficial-sodium::sodium)
|
||||
target_link_libraries(toxcore INTERFACE unofficial-sodium::sodium)
|
||||
endif()
|
||||
if(TARGET unofficial-sodium::sodium_config_public)
|
||||
target_link_libraries(toxcore unofficial-sodium::sodium_config_public)
|
||||
target_link_libraries(toxcore INTERFACE unofficial-sodium::sodium_config_public)
|
||||
endif()
|
||||
elseif(sodium_FOUND)
|
||||
target_link_libraries(toxcore sodium)
|
||||
target_link_libraries(toxcore INTERFACE sodium)
|
||||
else()
|
||||
message(SEND_ERROR "missing libsodium")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(toxcore ws2_32 iphlpapi)
|
||||
endif()
|
||||
|
||||
find_package(pthreads QUIET)
|
||||
if(TARGET PThreads4W::PThreads4W)
|
||||
target_link_libraries(toxcore PThreads4W::PThreads4W)
|
||||
else()
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(toxcore Threads::Threads)
|
||||
endif()
|
||||
|
||||
add_executable(DHT_Bootstrap EXCLUDE_FROM_ALL
|
||||
${TOX_DIR}other/DHT_bootstrap.c
|
||||
${TOX_DIR}other/bootstrap_node_packets.h
|
||||
${TOX_DIR}other/bootstrap_node_packets.c
|
||||
${TOX_DIR}testing/misc_tools.h
|
||||
${TOX_DIR}testing/misc_tools.c
|
||||
)
|
||||
|
||||
target_link_libraries(DHT_Bootstrap toxcore)
|
||||
#if(BUILD_TOXAV)
|
||||
# set_target_properties(toxcore PROPERTIES TOX_HAS_TOXAV ON)
|
||||
#endif()
|
||||
|
||||
|
2
external/toxcore/c-toxcore
vendored
2
external/toxcore/c-toxcore
vendored
Submodule external/toxcore/c-toxcore updated: da438763d5...d9b8fa6098
@ -1,23 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
|
||||
add_library(plugin_ngcft1 MODULE
|
||||
./plugin_ngcft1.cpp
|
||||
)
|
||||
set_target_properties(plugin_ngcft1 PROPERTIES
|
||||
C_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN ON # do we need this?
|
||||
)
|
||||
target_compile_definitions(plugin_ngcft1 PUBLIC ENTT_API_IMPORT)
|
||||
|
||||
target_link_libraries(plugin_ngcft1 PUBLIC
|
||||
solanaceae_plugin
|
||||
solanaceae_ngcext
|
||||
solanaceae_ngcft1
|
||||
solanaceae_sha1_ngcft1
|
||||
)
|
||||
|
||||
########################################
|
||||
|
||||
add_library(plugin_transfer_auto_accept MODULE
|
||||
./plugin_transfer_auto_accept.cpp
|
||||
./transfer_auto_accept.hpp
|
||||
@ -31,6 +13,25 @@ target_compile_definitions(plugin_transfer_auto_accept PUBLIC ENTT_API_IMPORT)
|
||||
target_link_libraries(plugin_transfer_auto_accept PUBLIC
|
||||
solanaceae_plugin
|
||||
solanaceae_util
|
||||
solanaceae_object_store
|
||||
solanaceae_message3
|
||||
solanaceae_tox_messages # sad, for filekind
|
||||
)
|
||||
|
||||
########################################
|
||||
|
||||
add_library(plugin_dice_tool MODULE
|
||||
./plugin_dice_tool.cpp
|
||||
./dice_tool.hpp
|
||||
./dice_tool.cpp
|
||||
)
|
||||
set_target_properties(plugin_dice_tool PROPERTIES
|
||||
C_VISIBILITY_PRESET hidden
|
||||
)
|
||||
target_compile_definitions(plugin_dice_tool PUBLIC ENTT_API_IMPORT)
|
||||
|
||||
target_link_libraries(plugin_dice_tool PUBLIC
|
||||
solanaceae_plugin
|
||||
solanaceae_tox_p2prng
|
||||
imgui
|
||||
)
|
||||
|
241
plugins/dice_tool.cpp
Normal file
241
plugins/dice_tool.cpp
Normal file
@ -0,0 +1,241 @@
|
||||
#include "./dice_tool.hpp"
|
||||
|
||||
#include <solanaceae/contact/contact_store_i.hpp>
|
||||
#include <solanaceae/contact/components.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <entt/container/dense_set.hpp>
|
||||
#include <entt/entity/registry.hpp>
|
||||
#include <entt/entity/handle.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
DiceTool::DiceTool(P2PRNGI& p2prng, ContactStore4I& cs) : _p2prng(p2prng), _cs(cs) {
|
||||
p2prng.subscribe(this, P2PRNG_Event::init);
|
||||
p2prng.subscribe(this, P2PRNG_Event::hmac);
|
||||
p2prng.subscribe(this, P2PRNG_Event::secret);
|
||||
p2prng.subscribe(this, P2PRNG_Event::done);
|
||||
p2prng.subscribe(this, P2PRNG_Event::val_error);
|
||||
}
|
||||
|
||||
DiceTool::~DiceTool(void) {
|
||||
}
|
||||
|
||||
float DiceTool::render(float) {
|
||||
if (ImGui::Begin("DiceTool")) {
|
||||
// header with values for new roll
|
||||
|
||||
ImGui::TextUnformatted("sides:");
|
||||
ImGui::SameLine();
|
||||
static uint16_t g_sides {6};
|
||||
ImGui::InputScalar("##sides", ImGuiDataType_U16, &g_sides);
|
||||
|
||||
static entt::dense_set<Contact4> peers;
|
||||
|
||||
if (ImGui::CollapsingHeader("peers")) {
|
||||
ImGui::Indent();
|
||||
// list with peers participating
|
||||
|
||||
for (auto it = peers.begin(); it != peers.end();) {
|
||||
ImGui::PushID(entt::to_integral(*it));
|
||||
if (ImGui::SmallButton("-")) {
|
||||
it = peers.erase(it);
|
||||
ImGui::PopID();
|
||||
continue;
|
||||
}
|
||||
|
||||
ContactHandle4 c = _cs.contactHandle(*it);
|
||||
|
||||
const char* str_ptr = "<unk>";
|
||||
if (const auto* name_ptr = c.try_get<Contact::Components::Name>(); name_ptr != nullptr && !name_ptr->name.empty()) {
|
||||
str_ptr = name_ptr->name.c_str();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::TextUnformatted(str_ptr);
|
||||
|
||||
ImGui::PopID();
|
||||
it++;
|
||||
}
|
||||
|
||||
if (ImGui::Button("add")) {
|
||||
ImGui::OpenPopup("peer selector");
|
||||
}
|
||||
if (ImGui::BeginPopup("peer selector")) {
|
||||
for (const auto& [cv] : _cs.registry().view<Contact::Components::TagBig>().each()) {
|
||||
ContactHandle4 c = _cs.contactHandle(cv);
|
||||
|
||||
if (peers.contains(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* str_ptr = "<unk>";
|
||||
if (const auto* name_ptr = c.try_get<Contact::Components::Name>(); name_ptr != nullptr && !name_ptr->name.empty()) {
|
||||
str_ptr = name_ptr->name.c_str();
|
||||
}
|
||||
|
||||
if (c.all_of<Contact::Components::TagGroup, Contact::Components::ParentOf>()) {
|
||||
if (ImGui::BeginMenu(str_ptr)) {
|
||||
for (const Contact4 child_cv : c.get<Contact::Components::ParentOf>().subs) {
|
||||
ContactHandle4 child_c = _cs.contactHandle(child_cv);
|
||||
|
||||
if (peers.contains(child_c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const char* child_str_ptr = "<unk>";
|
||||
if (const auto* name_ptr = child_c.try_get<Contact::Components::Name>(); name_ptr != nullptr && !name_ptr->name.empty()) {
|
||||
child_str_ptr = name_ptr->name.c_str();
|
||||
}
|
||||
|
||||
if (ImGui::MenuItem(child_str_ptr)) {
|
||||
peers.emplace(child_c);
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
} else {
|
||||
if (ImGui::MenuItem(str_ptr)) {
|
||||
peers.emplace(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("clear")) {
|
||||
peers.clear();
|
||||
}
|
||||
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
if (ImGui::Button("roll")) {
|
||||
//std::vector<ContactHandle4> c_vec{peers.cbegin(), peers.cend()};
|
||||
std::vector<ContactHandle4> c_vec;
|
||||
for (const auto cv : peers) {
|
||||
c_vec.emplace_back(_cs.contactHandle(cv));
|
||||
}
|
||||
|
||||
std::vector<uint8_t> is {'D', 'I', 'C', 'E'};
|
||||
is.push_back(reinterpret_cast<uint8_t*>(&g_sides)[0]);
|
||||
is.push_back(reinterpret_cast<uint8_t*>(&g_sides)[1]);
|
||||
static_assert(sizeof(g_sides) == 2);
|
||||
|
||||
auto new_id = _p2prng.newGernationPeers(c_vec, ByteSpan{is});
|
||||
//if (!new_id.empty()) {
|
||||
//}
|
||||
}
|
||||
|
||||
ImGui::SeparatorText("Rolls");
|
||||
|
||||
// list of past rolls and their state
|
||||
for (auto it = _rolls.crbegin(); it != _rolls.crend(); it++) {
|
||||
const auto& roll = *it;
|
||||
|
||||
std::string text{"d"};
|
||||
text += std::to_string(roll.sides);
|
||||
text += " [";
|
||||
if (roll.state == P2PRNG::DONE) {
|
||||
// dice start at 1
|
||||
text += std::to_string(int(roll.final_result)+1);
|
||||
} else {
|
||||
text += "?";
|
||||
}
|
||||
text += "]";
|
||||
|
||||
if (roll.state == P2PRNG::INIT) {
|
||||
text += " INIT";
|
||||
} else if (roll.state == P2PRNG::HMAC) {
|
||||
text += " HMAC ";
|
||||
text += std::to_string(roll.state_number_1);
|
||||
text += "/";
|
||||
text += std::to_string(roll.state_number_2);
|
||||
} else if (roll.state == P2PRNG::SECRET) {
|
||||
text += " SECRET ";
|
||||
text += std::to_string(roll.state_number_1);
|
||||
text += "/";
|
||||
text += std::to_string(roll.state_number_2);
|
||||
}
|
||||
|
||||
ImGui::TextUnformatted(text.c_str());
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
return 10.f;
|
||||
}
|
||||
|
||||
bool DiceTool::onEvent(const P2PRNG::Events::Init& e) {
|
||||
if (e.initial_state.size != 4+2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e.initial_state[0] != 'D' || e.initial_state[1] != 'I' || e.initial_state[2] != 'C' || e.initial_state[3] != 'E') {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& new_roll = _rolls.emplace_back();
|
||||
new_roll.id = {e.id.cbegin(), e.id.cend()};
|
||||
new_roll.state = P2PRNG::State::INIT;
|
||||
reinterpret_cast<uint8_t*>(&new_roll.sides)[0] = e.initial_state[4];
|
||||
reinterpret_cast<uint8_t*>(&new_roll.sides)[1] = e.initial_state[5];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DiceTool::onEvent(const P2PRNG::Events::HMAC& e) {
|
||||
auto roll_it = std::find_if(_rolls.begin(), _rolls.end(), [&e](const auto& a) -> bool { return ByteSpan{a.id} == e.id; });
|
||||
if (roll_it == _rolls.cend()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
roll_it->state = P2PRNG::State::HMAC;
|
||||
roll_it->state_number_1 = e.have;
|
||||
roll_it->state_number_2 = e.out_of;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DiceTool::onEvent(const P2PRNG::Events::Secret& e) {
|
||||
auto roll_it = std::find_if(_rolls.begin(), _rolls.end(), [&e](const auto& a) -> bool { return ByteSpan{a.id} == e.id; });
|
||||
if (roll_it == _rolls.cend()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
roll_it->state = P2PRNG::State::SECRET;
|
||||
roll_it->state_number_1 = e.have;
|
||||
roll_it->state_number_2 = e.out_of;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DiceTool::onEvent(const P2PRNG::Events::Done& e) {
|
||||
auto roll_it = std::find_if(_rolls.begin(), _rolls.end(), [&e](const auto& a) -> bool { return ByteSpan{a.id} == e.id; });
|
||||
if (roll_it == _rolls.cend()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
roll_it->state = P2PRNG::State::DONE;
|
||||
roll_it->state_number_1 = 0;
|
||||
roll_it->state_number_2 = 0;
|
||||
roll_it->final_result = (e.result[0] | (e.result[1] << 8)) % roll_it->sides;
|
||||
|
||||
std::cout << "done die roll " << roll_it->final_result << "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DiceTool::onEvent(const P2PRNG::Events::ValError& e) {
|
||||
auto roll_it = std::find_if(_rolls.cbegin(), _rolls.cend(), [&e](const auto& a) -> bool { return ByteSpan{a.id} == e.id; });
|
||||
if (roll_it == _rolls.cend()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
38
plugins/dice_tool.hpp
Normal file
38
plugins/dice_tool.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <solanaceae/tox_p2prng/p2prng.hpp>
|
||||
#include <solanaceae/contact/fwd.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class DiceTool : public P2PRNGEventI {
|
||||
P2PRNGI& _p2prng;
|
||||
ContactStore4I& _cs;
|
||||
|
||||
struct Rolls {
|
||||
std::vector<uint8_t> id;
|
||||
|
||||
uint16_t sides {};
|
||||
|
||||
P2PRNG::State state {P2PRNG::State::UNKNOWN};
|
||||
uint16_t state_number_1 {};
|
||||
uint16_t state_number_2 {};
|
||||
|
||||
uint16_t final_result{};
|
||||
};
|
||||
std::vector<Rolls> _rolls;
|
||||
|
||||
public:
|
||||
DiceTool(P2PRNGI& p2prng, ContactStore4I& cs);
|
||||
~DiceTool(void);
|
||||
|
||||
float render(float time_delta);
|
||||
|
||||
protected: // p2prng
|
||||
bool onEvent(const P2PRNG::Events::Init&) override;
|
||||
bool onEvent(const P2PRNG::Events::HMAC&) override;
|
||||
bool onEvent(const P2PRNG::Events::Secret&) override;
|
||||
bool onEvent(const P2PRNG::Events::Done&) override;
|
||||
bool onEvent(const P2PRNG::Events::ValError&) override;
|
||||
};
|
||||
|
82
plugins/plugin_dice_tool.cpp
Normal file
82
plugins/plugin_dice_tool.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
#include <solanaceae/plugin/solana_plugin_v1.h>
|
||||
|
||||
#include <solanaceae/contact/contact_store_i.hpp>
|
||||
|
||||
#include "./dice_tool.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <entt/fwd.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
|
||||
static std::unique_ptr<DiceTool> g_dt = nullptr;
|
||||
|
||||
constexpr const char* plugin_name = "DiceTool";
|
||||
|
||||
extern "C" {
|
||||
|
||||
SOLANA_PLUGIN_EXPORT const char* solana_plugin_get_name(void) {
|
||||
return plugin_name;
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_get_version(void) {
|
||||
return SOLANA_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api) {
|
||||
std::cout << "PLUGIN " << plugin_name << " START()\n";
|
||||
|
||||
if (solana_api == nullptr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
auto* p2prng_i = PLUG_RESOLVE_INSTANCE(P2PRNGI);
|
||||
auto* cs = PLUG_RESOLVE_INSTANCE(ContactStore4I);
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_dt = std::make_unique<DiceTool>(*p2prng_i, *cs);
|
||||
|
||||
auto* imguic = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiContext, ImGui::GetVersion());
|
||||
auto* imguimemaf = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiMemAllocFunc, ImGui::GetVersion());
|
||||
auto* imguimemff = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiMemFreeFunc, ImGui::GetVersion());
|
||||
// meh
|
||||
auto* imguimemud = plug_resolveInstanceOptional<void*>(solana_api, "ImGuiMemUserData", ImGui::GetVersion());
|
||||
|
||||
ImGui::SetCurrentContext(imguic);
|
||||
ImGui::SetAllocatorFunctions(imguimemaf, imguimemff, imguimemud);
|
||||
|
||||
// register types
|
||||
PLUG_PROVIDE_INSTANCE(DiceTool, plugin_name, g_dt.get());
|
||||
} catch (const ResolveException& e) {
|
||||
std::cerr << "PLUGIN " << plugin_name << " " << e.what << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT void solana_plugin_stop(void) {
|
||||
std::cout << "PLUGIN " << plugin_name << " STOP()\n";
|
||||
|
||||
g_dt.reset();
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT float solana_plugin_tick(float delta) {
|
||||
(void)delta;
|
||||
//g_dt->iterate();
|
||||
|
||||
return std::numeric_limits<float>::max();
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT float solana_plugin_render(float delta) {
|
||||
return g_dt->render(delta);
|
||||
}
|
||||
|
||||
} // extern C
|
||||
|
@ -1,81 +0,0 @@
|
||||
#include <solanaceae/plugin/solana_plugin_v1.h>
|
||||
|
||||
#include <solanaceae/ngc_ext/ngcext.hpp>
|
||||
#include <solanaceae/ngc_ft1/ngcft1.hpp>
|
||||
#include <solanaceae/ngc_ft1_sha1/sha1_ngcft1.hpp>
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <entt/fwd.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
static std::unique_ptr<NGCEXTEventProvider> g_ngcextep = nullptr;
|
||||
// TODO: make sep plug
|
||||
static std::unique_ptr<NGCFT1> g_ngcft1 = nullptr;
|
||||
static std::unique_ptr<SHA1_NGCFT1> g_sha1_ngcft1 = nullptr;
|
||||
|
||||
constexpr const char* plugin_name = "NGCEXT";
|
||||
|
||||
extern "C" {
|
||||
|
||||
SOLANA_PLUGIN_EXPORT const char* solana_plugin_get_name(void) {
|
||||
return plugin_name;
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_get_version(void) {
|
||||
return SOLANA_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api) {
|
||||
std::cout << "PLUGIN " << plugin_name << " START()\n";
|
||||
|
||||
if (solana_api == nullptr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
auto* os = PLUG_RESOLVE_INSTANCE(ObjectStore2);
|
||||
auto* tox_i = PLUG_RESOLVE_INSTANCE(ToxI);
|
||||
auto* tox_event_provider_i = PLUG_RESOLVE_INSTANCE(ToxEventProviderI);
|
||||
auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
|
||||
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModel);
|
||||
auto* tcm = PLUG_RESOLVE_INSTANCE(ToxContactModel2);
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_ngcextep = std::make_unique<NGCEXTEventProvider>(*tox_event_provider_i);
|
||||
g_ngcft1 = std::make_unique<NGCFT1>(*tox_i, *tox_event_provider_i, *g_ngcextep.get());
|
||||
g_sha1_ngcft1 = std::make_unique<SHA1_NGCFT1>(*os, *cr, *rmm, *g_ngcft1.get(), *tcm);
|
||||
|
||||
// register types
|
||||
PLUG_PROVIDE_INSTANCE(NGCEXTEventProviderI, plugin_name, g_ngcextep.get());
|
||||
|
||||
PLUG_PROVIDE_INSTANCE(NGCFT1EventProviderI, plugin_name, g_ngcft1.get());
|
||||
PLUG_PROVIDE_INSTANCE(NGCFT1, plugin_name, g_ngcft1.get());
|
||||
|
||||
PLUG_PROVIDE_INSTANCE(SHA1_NGCFT1, plugin_name, g_sha1_ngcft1.get());
|
||||
} catch (const ResolveException& e) {
|
||||
std::cerr << "PLUGIN " << plugin_name << " " << e.what << "\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT void solana_plugin_stop(void) {
|
||||
std::cout << "PLUGIN " << plugin_name << " STOP()\n";
|
||||
|
||||
g_sha1_ngcft1.reset();
|
||||
g_ngcft1.reset();
|
||||
g_ngcextep.reset();
|
||||
}
|
||||
|
||||
SOLANA_PLUGIN_EXPORT float solana_plugin_tick(float delta) {
|
||||
const float ft_interval = g_ngcft1->iterate(delta);
|
||||
g_sha1_ngcft1->iterate(delta);
|
||||
return ft_interval;
|
||||
}
|
||||
|
||||
} // extern C
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include <solanaceae/plugin/solana_plugin_v1.h>
|
||||
|
||||
#include "./transfer_auto_accept.hpp"
|
||||
#include <solanaceae/util/config_model.hpp>
|
||||
|
||||
#include "./transfer_auto_accept.hpp"
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <entt/fwd.hpp>
|
||||
|
||||
@ -32,12 +33,13 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
}
|
||||
|
||||
try {
|
||||
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModel);
|
||||
auto* os = PLUG_RESOLVE_INSTANCE(ObjectStore2);
|
||||
auto* rmm = PLUG_RESOLVE_INSTANCE(RegistryMessageModelI);
|
||||
auto* conf = PLUG_RESOLVE_INSTANCE(ConfigModelI);
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_taa = std::make_unique<TransferAutoAccept>(*rmm, *conf);
|
||||
g_taa = std::make_unique<TransferAutoAccept>(*os, *rmm, *conf);
|
||||
|
||||
// register types
|
||||
PLUG_PROVIDE_INSTANCE(TransferAutoAccept, plugin_name, g_taa.get());
|
||||
|
@ -1,14 +1,18 @@
|
||||
#include "./transfer_auto_accept.hpp"
|
||||
|
||||
#include <solanaceae/object_store/meta_components_file.hpp>
|
||||
|
||||
#include <solanaceae/message3/components.hpp>
|
||||
// for comp transfer tox filekind (TODO: generalize -> content system?)
|
||||
#include <solanaceae/tox_messages/components.hpp>
|
||||
#include <solanaceae/tox_messages/obj_components.hpp>
|
||||
|
||||
#include <solanaceae/util/config_model.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
TransferAutoAccept::TransferAutoAccept(RegistryMessageModel& rmm, ConfigModelI& conf) : _rmm(rmm), _conf(conf) {
|
||||
TransferAutoAccept::TransferAutoAccept(ObjectStore2& os, RegistryMessageModelI& rmm, ConfigModelI& conf) : _os(os), _rmm(rmm), _conf(conf) {
|
||||
//_os.subscribe(this, ObjectStore_Event::object_update);
|
||||
|
||||
_rmm.subscribe(this, RegistryMessageModel_Event::message_construct);
|
||||
_rmm.subscribe(this, RegistryMessageModel_Event::message_updated);
|
||||
|
||||
@ -28,59 +32,94 @@ TransferAutoAccept::TransferAutoAccept(RegistryMessageModel& rmm, ConfigModelI&
|
||||
|
||||
void TransferAutoAccept::iterate(void) {
|
||||
for (auto& it : _accept_queue) {
|
||||
if (it.all_of<Message::Components::Transfer::ActionAccept>()) {
|
||||
if (it.all_of<ObjComp::Ephemeral::File::ActionTransferAccept>()) {
|
||||
continue; // already accepted
|
||||
}
|
||||
|
||||
it.emplace<Message::Components::Transfer::ActionAccept>(
|
||||
it.emplace<ObjComp::Ephemeral::File::ActionTransferAccept>(
|
||||
// TODO: contact to entry
|
||||
_conf.get_string("TransferAutoAccept", "save_path").value_or("tmp_save_dir"),
|
||||
false
|
||||
);
|
||||
std::cout << "TAA: auto accepted transfer\n";
|
||||
_rmm.throwEventUpdate(it);
|
||||
_os.throwEventUpdate(it);
|
||||
//_rmm.throwEventUpdate(it);
|
||||
}
|
||||
_accept_queue.clear();
|
||||
}
|
||||
|
||||
void TransferAutoAccept::checkMsg(Message3Handle h) {
|
||||
if (h.all_of<Message::Components::Transfer::ActionAccept>()) {
|
||||
void TransferAutoAccept::checkObj(ObjectHandle o) {
|
||||
if (!o) {
|
||||
return; // invalid object
|
||||
}
|
||||
|
||||
if (o.all_of<ObjComp::Ephemeral::File::ActionTransferAccept>()) {
|
||||
return; // already accepted
|
||||
}
|
||||
|
||||
if (!h.all_of<Message::Components::Transfer::TagReceiving, Message::Components::Transfer::TagPaused, Message::Components::Transfer::FileInfo>()) {
|
||||
if (o.all_of<ObjComp::F::TagLocalHaveAll>()) {
|
||||
return; // alreay have
|
||||
}
|
||||
|
||||
//if (!h.all_of<Message::Components::Transfer::TagReceiving, Message::Components::Transfer::TagPaused, Message::Components::Transfer::FileInfo>()) {
|
||||
// TODO: tag receiving ??
|
||||
if (!o.all_of</*Message::Components::Transfer::TagReceiving, */ObjComp::Ephemeral::File::TagTransferPaused>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!o.any_of<ObjComp::F::SingleInfo, ObjComp::F::CollectionInfo>()) {
|
||||
return; // dont know enough
|
||||
}
|
||||
|
||||
// dont touch avatars for now
|
||||
if (h.all_of<Message::Components::Transfer::FileKind>() && h.get<Message::Components::Transfer::FileKind>().kind == 1) {
|
||||
// TODO: more generic file types??
|
||||
if (const auto* fk = o.try_get<ObjComp::Tox::FileKind>(); fk != nullptr && fk->kind != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& file_info = h.get<Message::Components::Transfer::FileInfo>();
|
||||
uint64_t total_size {0u};
|
||||
if (const auto* si = o.try_get<ObjComp::F::SingleInfo>(); si != nullptr) {
|
||||
if (si->file_name.empty()) {
|
||||
return; // bad file
|
||||
}
|
||||
total_size = si->file_size;
|
||||
} else if (const auto* ci = o.try_get<ObjComp::F::CollectionInfo>(); ci != nullptr) {
|
||||
if (ci->file_list.empty() || ci->file_list.front().file_name.empty()) {
|
||||
return; // bad file
|
||||
}
|
||||
total_size = ci->total_size;
|
||||
}
|
||||
|
||||
//const auto& file_info = h.get<Message::Components::Transfer::FileInfo>();
|
||||
// TODO: contact to entry
|
||||
if (file_info.total_size > uint64_t(_conf.get_int("TransferAutoAccept", "autoaccept_limit").value_or(1024*1024))) {
|
||||
if (total_size > uint64_t(_conf.get_int("TransferAutoAccept", "autoaccept_limit").value_or(1024*1024))) {
|
||||
return; // too large
|
||||
}
|
||||
|
||||
if (file_info.file_list.empty() || file_info.file_list.front().file_name.empty()) {
|
||||
return; // bad file
|
||||
_accept_queue.push_back(o);
|
||||
}
|
||||
|
||||
void TransferAutoAccept::checkMsg(Message3Handle h) {
|
||||
if (!h.all_of<Message::Components::MessageFileObject>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
_accept_queue.push_back(h);
|
||||
checkObj(h.get<Message::Components::MessageFileObject>().o);
|
||||
}
|
||||
|
||||
bool TransferAutoAccept::onEvent(const Message::Events::MessageConstruct& e) {
|
||||
//std::cout << "TAA: msg c\n";
|
||||
checkMsg(e.e);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TransferAutoAccept::onEvent(const Message::Events::MessageUpdated& e) {
|
||||
//std::cout << "TAA: msg u\n";
|
||||
checkMsg(e.e);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TransferAutoAccept::onEvent(const ObjectStore::Events::ObjectUpdate&) {
|
||||
// too expensive rn
|
||||
//checkObj(e.e);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <solanaceae/object_store/object_store.hpp>
|
||||
#include <solanaceae/message3/registry_message_model.hpp>
|
||||
|
||||
#include <vector>
|
||||
@ -7,25 +8,29 @@
|
||||
// fwd
|
||||
struct ConfigModelI;
|
||||
|
||||
class TransferAutoAccept : public RegistryMessageModelEventI {
|
||||
RegistryMessageModel& _rmm;
|
||||
class TransferAutoAccept : public RegistryMessageModelEventI, public ObjectStoreEventI {
|
||||
ObjectStore2& _os;
|
||||
RegistryMessageModelI& _rmm;
|
||||
//ContactModelI& _cm;
|
||||
ConfigModelI& _conf;
|
||||
|
||||
std::vector<Message3Handle> _accept_queue;
|
||||
std::vector<ObjectHandle> _accept_queue;
|
||||
|
||||
public:
|
||||
TransferAutoAccept(RegistryMessageModel& rmm, ConfigModelI& conf);
|
||||
TransferAutoAccept(ObjectStore2& os, RegistryMessageModelI& rmm, ConfigModelI& conf);
|
||||
|
||||
// TODO: iterate
|
||||
void iterate(void);
|
||||
|
||||
protected:
|
||||
void checkObj(ObjectHandle h);
|
||||
void checkMsg(Message3Handle h);
|
||||
|
||||
protected: // mm
|
||||
bool onEvent(const Message::Events::MessageConstruct& e) override;
|
||||
bool onEvent(const Message::Events::MessageUpdated& e) override;
|
||||
|
||||
protected: // os
|
||||
bool onEvent(const ObjectStore::Events::ObjectUpdate& e) override;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user