fill in ID for each contact
This commit is contained in:
parent
0404ed84fc
commit
89e74b35f8
@ -32,6 +32,7 @@ ToxContactModel2::ToxContactModel2(Contact3Registry& cr, ToxI& t, ToxEventProvid
|
|||||||
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
||||||
_cr.emplace<Contact::Components::TagSelfStrong>(c);
|
_cr.emplace<Contact::Components::TagSelfStrong>(c);
|
||||||
_cr.emplace<Contact::Components::Name>(c, _t.toxSelfGetName());
|
_cr.emplace<Contact::Components::Name>(c, _t.toxSelfGetName());
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, _t.toxSelfGetPublicKey());
|
||||||
|
|
||||||
_friend_self = c;
|
_friend_self = c;
|
||||||
|
|
||||||
@ -154,6 +155,7 @@ Contact3Handle ToxContactModel2::getContactFriend(uint32_t friend_number) {
|
|||||||
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
||||||
_cr.emplace<Contact::Components::ToxFriendEphemeral>(c, friend_number);
|
_cr.emplace<Contact::Components::ToxFriendEphemeral>(c, friend_number);
|
||||||
_cr.emplace<Contact::Components::ToxFriendPersistent>(c, f_key);
|
_cr.emplace<Contact::Components::ToxFriendPersistent>(c, f_key);
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, f_key_opt.value());
|
||||||
_cr.emplace<Contact::Components::Self>(c, _friend_self);
|
_cr.emplace<Contact::Components::Self>(c, _friend_self);
|
||||||
_cr.emplace<Contact::Components::Name>(c, _t.toxFriendGetName(friend_number).value_or("<unk>"));
|
_cr.emplace<Contact::Components::Name>(c, _t.toxFriendGetName(friend_number).value_or("<unk>"));
|
||||||
|
|
||||||
@ -207,6 +209,7 @@ Contact3Handle ToxContactModel2::getContactGroup(uint32_t group_number) {
|
|||||||
_cr.emplace<Contact::Components::ParentOf>(c); // start empty
|
_cr.emplace<Contact::Components::ParentOf>(c); // start empty
|
||||||
_cr.emplace<Contact::Components::ToxGroupEphemeral>(c, group_number);
|
_cr.emplace<Contact::Components::ToxGroupEphemeral>(c, group_number);
|
||||||
_cr.emplace<Contact::Components::ToxGroupPersistent>(c, g_key);
|
_cr.emplace<Contact::Components::ToxGroupPersistent>(c, g_key);
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, g_key_opt.value());
|
||||||
_cr.emplace<Contact::Components::Name>(c, _t.toxGroupGetName(group_number).value_or("<unk>"));
|
_cr.emplace<Contact::Components::Name>(c, _t.toxGroupGetName(group_number).value_or("<unk>"));
|
||||||
_cr.emplace<Contact::Components::ConnectionState>(
|
_cr.emplace<Contact::Components::ConnectionState>(
|
||||||
c,
|
c,
|
||||||
@ -291,6 +294,7 @@ Contact3Handle ToxContactModel2::getContactGroupPeer(uint32_t group_number, uint
|
|||||||
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
||||||
_cr.emplace<Contact::Components::ToxGroupPeerEphemeral>(c, group_number, peer_number);
|
_cr.emplace<Contact::Components::ToxGroupPeerEphemeral>(c, group_number, peer_number);
|
||||||
_cr.emplace<Contact::Components::ToxGroupPeerPersistent>(c, g_key, g_p_key);
|
_cr.emplace<Contact::Components::ToxGroupPeerPersistent>(c, g_key, g_p_key);
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, g_p_key_opt.value());
|
||||||
const auto name_opt = std::get<0>(_t.toxGroupPeerGetName(group_number, peer_number));
|
const auto name_opt = std::get<0>(_t.toxGroupPeerGetName(group_number, peer_number));
|
||||||
if (name_opt.has_value()) {
|
if (name_opt.has_value()) {
|
||||||
_cr.emplace<Contact::Components::Name>(c, name_opt.value());
|
_cr.emplace<Contact::Components::Name>(c, name_opt.value());
|
||||||
@ -352,6 +356,7 @@ Contact3Handle ToxContactModel2::getContactGroupPeer(uint32_t group_number, cons
|
|||||||
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
||||||
//_cr.emplace<Contact::Components::ToxGroupPeerEphemeral>(c, group_number, peer_number);
|
//_cr.emplace<Contact::Components::ToxGroupPeerEphemeral>(c, group_number, peer_number);
|
||||||
_cr.emplace<Contact::Components::ToxGroupPeerPersistent>(c, g_key, peer_key);
|
_cr.emplace<Contact::Components::ToxGroupPeerPersistent>(c, g_key, peer_key);
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, std::vector<uint8_t>{peer_key.data.cbegin(), peer_key.data.cend()});
|
||||||
//_cr.emplace<Contact::Components::Name>(c, "<unk>");
|
//_cr.emplace<Contact::Components::Name>(c, "<unk>");
|
||||||
//_cr.emplace<Contact::Components::Name>(c, std::get<0>(_t.toxGroupPeerGetName(group_number, peer_number)).value_or("<unk>"));
|
//_cr.emplace<Contact::Components::Name>(c, std::get<0>(_t.toxGroupPeerGetName(group_number, peer_number)).value_or("<unk>"));
|
||||||
|
|
||||||
@ -432,6 +437,7 @@ bool ToxContactModel2::onToxEvent(const Tox_Event_Friend_Request* e) {
|
|||||||
_cr.emplace<Contact::Components::TagBig>(c);
|
_cr.emplace<Contact::Components::TagBig>(c);
|
||||||
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
||||||
_cr.emplace<Contact::Components::ToxFriendPersistent>(c, pub_key);
|
_cr.emplace<Contact::Components::ToxFriendPersistent>(c, pub_key);
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, std::vector<uint8_t>{pub_key.data.cbegin(), pub_key.data.cend()});
|
||||||
_cr.emplace<Contact::Components::Self>(c, _friend_self);
|
_cr.emplace<Contact::Components::Self>(c, _friend_self);
|
||||||
|
|
||||||
std::cout << "TCM2: created friend contact (requested)\n";
|
std::cout << "TCM2: created friend contact (requested)\n";
|
||||||
@ -471,6 +477,7 @@ bool ToxContactModel2::onToxEvent(const Tox_Event_Group_Invite* e) {
|
|||||||
_cr.emplace<Contact::Components::TagBig>(c);
|
_cr.emplace<Contact::Components::TagBig>(c);
|
||||||
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
_cr.emplace<Contact::Components::ContactModel>(c, this);
|
||||||
_cr.emplace<Contact::Components::ToxGroupPersistent>(c, chat_id);
|
_cr.emplace<Contact::Components::ToxGroupPersistent>(c, chat_id);
|
||||||
|
_cr.emplace<Contact::Components::ID>(c, std::vector<uint8_t>{chat_id.data.cbegin(), chat_id.data.cend()});
|
||||||
_cr.emplace<Contact::Components::Name>(c, std::string(group_name));
|
_cr.emplace<Contact::Components::Name>(c, std::string(group_name));
|
||||||
|
|
||||||
auto& ir = _cr.emplace<Contact::Components::ToxGroupIncomingRequest>(c);
|
auto& ir = _cr.emplace<Contact::Components::ToxGroupIncomingRequest>(c);
|
||||||
|
Loading…
Reference in New Issue
Block a user