more hs drafting
This commit is contained in:
parent
63de78aaeb
commit
2e6b15e4ad
@ -3,15 +3,26 @@
|
|||||||
#include <solanaceae/tox_contacts/tox_contact_model2.hpp>
|
#include <solanaceae/tox_contacts/tox_contact_model2.hpp>
|
||||||
|
|
||||||
NGCHS2::NGCHS2(
|
NGCHS2::NGCHS2(
|
||||||
|
Contact3Registry& cr,
|
||||||
|
RegistryMessageModelI& rmm,
|
||||||
ToxContactModel2& tcm,
|
ToxContactModel2& tcm,
|
||||||
ToxEventProviderI& tep,
|
ToxEventProviderI& tep,
|
||||||
NGCFT1& nft
|
NGCFT1& nft
|
||||||
) :
|
) :
|
||||||
|
_cr(cr),
|
||||||
|
_rmm(rmm),
|
||||||
|
_rmm_sr(_rmm.newSubRef(this)),
|
||||||
_tcm(tcm),
|
_tcm(tcm),
|
||||||
_tep_sr(tep.newSubRef(this)),
|
_tep_sr(tep.newSubRef(this)),
|
||||||
_nft(nft),
|
_nft(nft),
|
||||||
_nftep_sr(_nft.newSubRef(this))
|
_nftep_sr(_nft.newSubRef(this))
|
||||||
{
|
{
|
||||||
|
_rmm_sr
|
||||||
|
.subscribe(RegistryMessageModel_Event::message_construct)
|
||||||
|
.subscribe(RegistryMessageModel_Event::message_updated)
|
||||||
|
.subscribe(RegistryMessageModel_Event::message_destroy)
|
||||||
|
;
|
||||||
|
|
||||||
_tep_sr
|
_tep_sr
|
||||||
.subscribe(TOX_EVENT_GROUP_PEER_JOIN)
|
.subscribe(TOX_EVENT_GROUP_PEER_JOIN)
|
||||||
.subscribe(TOX_EVENT_GROUP_PEER_EXIT)
|
.subscribe(TOX_EVENT_GROUP_PEER_EXIT)
|
||||||
@ -35,6 +46,18 @@ float NGCHS2::iterate(float delta) {
|
|||||||
return 1000.f;
|
return 1000.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NGCHS2::onEvent(const Message::Events::MessageConstruct&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NGCHS2::onEvent(const Message::Events::MessageUpdated&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NGCHS2::onEvent(const Message::Events::MessageDestory&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool NGCHS2::onEvent(const Events::NGCFT1_recv_request& e) {
|
bool NGCHS2::onEvent(const Events::NGCFT1_recv_request& e) {
|
||||||
if (
|
if (
|
||||||
e.file_kind != NGCFT1_file_kind::HS2_INFO_RANGE_TIME &&
|
e.file_kind != NGCFT1_file_kind::HS2_INFO_RANGE_TIME &&
|
||||||
|
@ -1,25 +1,55 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
//#include <solanaceae/contact/contact_model3.hpp>
|
|
||||||
#include <solanaceae/toxcore/tox_event_interface.hpp>
|
#include <solanaceae/toxcore/tox_event_interface.hpp>
|
||||||
|
|
||||||
//#include <solanaceae/message3/registry_message_model.hpp>
|
#include <solanaceae/contact/contact_model3.hpp>
|
||||||
|
#include <solanaceae/message3/registry_message_model.hpp>
|
||||||
|
|
||||||
#include <solanaceae/ngc_ft1/ngcft1.hpp>
|
#include <solanaceae/ngc_ft1/ngcft1.hpp>
|
||||||
|
|
||||||
|
#include <entt/container/dense_map.hpp>
|
||||||
|
|
||||||
// fwd
|
// fwd
|
||||||
class ToxContactModel2;
|
class ToxContactModel2;
|
||||||
|
|
||||||
class NGCHS2 : public ToxEventI, public NGCFT1EventI {
|
// time ranges
|
||||||
|
// should we just do last x minutes like zngchs?
|
||||||
|
// properly done, we need to use:
|
||||||
|
// - Message::Components::ViewCurserBegin
|
||||||
|
// - Message::Components::ViewCurserEnd
|
||||||
|
//
|
||||||
|
// on startup, manually check all registries for ranges (meh) (do later)
|
||||||
|
// listen on message events, check if range, see if range satisfied recently
|
||||||
|
// deal with a queue, and delay (at least 1sec, 3-10sec after a peer con change)
|
||||||
|
// or we always overrequest (eg 48h), and only fetch messages in, or close to range
|
||||||
|
|
||||||
|
class NGCHS2 : public RegistryMessageModelEventI, public ToxEventI, public NGCFT1EventI {
|
||||||
|
Contact3Registry& _cr;
|
||||||
|
RegistryMessageModelI& _rmm;
|
||||||
|
RegistryMessageModelI::SubscriptionReference _rmm_sr;
|
||||||
ToxContactModel2& _tcm;
|
ToxContactModel2& _tcm;
|
||||||
//Contact3Registry& _cr;
|
|
||||||
//RegistryMessageModelI& _rmm;
|
|
||||||
ToxEventProviderI::SubscriptionReference _tep_sr;
|
ToxEventProviderI::SubscriptionReference _tep_sr;
|
||||||
NGCFT1& _nft;
|
NGCFT1& _nft;
|
||||||
NGCFT1EventProviderI::SubscriptionReference _nftep_sr;
|
NGCFT1EventProviderI::SubscriptionReference _nftep_sr;
|
||||||
|
|
||||||
|
// describes our knowlage of a remote peer
|
||||||
|
struct RemoteInfo {
|
||||||
|
// list of all ppk+mid+ts they sent us (filtered by reqs, like range, ppk...)
|
||||||
|
// with when it last sent a range? hmm
|
||||||
|
};
|
||||||
|
entt::dense_map<Contact3, RemoteInfo> _remote_info;
|
||||||
|
|
||||||
|
// open/running info requests (by c)
|
||||||
|
|
||||||
|
// open/running info responses (by c)
|
||||||
|
|
||||||
|
static const bool _only_send_self_observed {true};
|
||||||
|
static const int64_t _max_time_into_past_default {60}; // s
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NGCHS2(
|
NGCHS2(
|
||||||
|
Contact3Registry& cr,
|
||||||
|
RegistryMessageModelI& rmm,
|
||||||
ToxContactModel2& tcm,
|
ToxContactModel2& tcm,
|
||||||
ToxEventProviderI& tep,
|
ToxEventProviderI& tep,
|
||||||
NGCFT1& nf
|
NGCFT1& nf
|
||||||
@ -29,6 +59,15 @@ class NGCHS2 : public ToxEventI, public NGCFT1EventI {
|
|||||||
|
|
||||||
float iterate(float delta);
|
float iterate(float delta);
|
||||||
|
|
||||||
|
// add to queue with timer
|
||||||
|
// check and updates all existing cursers for giving reg in queue
|
||||||
|
void enqueueWantCurser(Message3Handle m);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool onEvent(const Message::Events::MessageConstruct&) override;
|
||||||
|
bool onEvent(const Message::Events::MessageUpdated&) override;
|
||||||
|
bool onEvent(const Message::Events::MessageDestory&) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool onEvent(const Events::NGCFT1_recv_request&) override;
|
bool onEvent(const Events::NGCFT1_recv_request&) override;
|
||||||
bool onEvent(const Events::NGCFT1_recv_init&) override;
|
bool onEvent(const Events::NGCFT1_recv_init&) override;
|
||||||
|
@ -57,18 +57,18 @@ Manual exceptions to all can be made at the users discretion, eg for other self
|
|||||||
|
|
||||||
TODO: is reusing the ft request api a good idea for this?
|
TODO: is reusing the ft request api a good idea for this?
|
||||||
|
|
||||||
| fttype | name | content (ft id) |
|
| fttype | name | content (ft id) |
|
||||||
|------|------|---------------------|
|
|------------|------|---------------------|
|
||||||
| 0x01 | time range | - ts start </br> - ts end </br> - supported compression? |
|
| 0x00000f00 | time range | - ts start </br> - ts end </br> - supported compression? |
|
||||||
| | TODO: id range based request? | |
|
| | TODO: id range based request? | |
|
||||||
| 0x01 | single message | - ppk </br> - mid </br> - ts |
|
| 0x00000f01 | single message | - ppk </br> - mid </br> - ts |
|
||||||
|
|
||||||
## File transfers
|
## File transfers
|
||||||
|
|
||||||
| fttype | name | content |
|
| fttype | name | content |
|
||||||
|--------|------|---------------------|
|
|------------|------|---------------------|
|
||||||
| 0x01 | time range | - feature bitset (1byte? different compressions?) </br> - ts start </br> - ts end </br> - list size </br> \\+ entry `ppk` </br> \\+ entry `mid` </br> \\+ entry `ts` |
|
| 0x00000f00 | time range | - feature bitset (1byte? different compressions?) </br> - ts start </br> - ts end </br> - list size </br> \\+ entry `ppk` </br> \\+ entry `mid` </br> \\+ entry `ts` |
|
||||||
| 0x01 | single message | - message type (text/textaction/file) </br> - text if text or action, file type and file id if file |
|
| 0x00000f01 | single message | - message type (text/textaction/file) </br> - text if text or action, file type and file id if file |
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user