From 89e74b35f83d888f8aa2e5230811b8a5e2b101a7 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 3 Nov 2023 14:33:41 +0100 Subject: [PATCH] fill in ID for each contact --- solanaceae/tox_contacts/tox_contact_model2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/solanaceae/tox_contacts/tox_contact_model2.cpp b/solanaceae/tox_contacts/tox_contact_model2.cpp index 19e0d62..635d2da 100644 --- a/solanaceae/tox_contacts/tox_contact_model2.cpp +++ b/solanaceae/tox_contacts/tox_contact_model2.cpp @@ -32,6 +32,7 @@ ToxContactModel2::ToxContactModel2(Contact3Registry& cr, ToxI& t, ToxEventProvid _cr.emplace(c, this); _cr.emplace(c); _cr.emplace(c, _t.toxSelfGetName()); + _cr.emplace(c, _t.toxSelfGetPublicKey()); _friend_self = c; @@ -154,6 +155,7 @@ Contact3Handle ToxContactModel2::getContactFriend(uint32_t friend_number) { _cr.emplace(c, this); _cr.emplace(c, friend_number); _cr.emplace(c, f_key); + _cr.emplace(c, f_key_opt.value()); _cr.emplace(c, _friend_self); _cr.emplace(c, _t.toxFriendGetName(friend_number).value_or("")); @@ -207,6 +209,7 @@ Contact3Handle ToxContactModel2::getContactGroup(uint32_t group_number) { _cr.emplace(c); // start empty _cr.emplace(c, group_number); _cr.emplace(c, g_key); + _cr.emplace(c, g_key_opt.value()); _cr.emplace(c, _t.toxGroupGetName(group_number).value_or("")); _cr.emplace( c, @@ -291,6 +294,7 @@ Contact3Handle ToxContactModel2::getContactGroupPeer(uint32_t group_number, uint _cr.emplace(c, this); _cr.emplace(c, group_number, peer_number); _cr.emplace(c, g_key, g_p_key); + _cr.emplace(c, g_p_key_opt.value()); const auto name_opt = std::get<0>(_t.toxGroupPeerGetName(group_number, peer_number)); if (name_opt.has_value()) { _cr.emplace(c, name_opt.value()); @@ -352,6 +356,7 @@ Contact3Handle ToxContactModel2::getContactGroupPeer(uint32_t group_number, cons _cr.emplace(c, this); //_cr.emplace(c, group_number, peer_number); _cr.emplace(c, g_key, peer_key); + _cr.emplace(c, std::vector{peer_key.data.cbegin(), peer_key.data.cend()}); //_cr.emplace(c, ""); //_cr.emplace(c, std::get<0>(_t.toxGroupPeerGetName(group_number, peer_number)).value_or("")); @@ -432,6 +437,7 @@ bool ToxContactModel2::onToxEvent(const Tox_Event_Friend_Request* e) { _cr.emplace(c); _cr.emplace(c, this); _cr.emplace(c, pub_key); + _cr.emplace(c, std::vector{pub_key.data.cbegin(), pub_key.data.cend()}); _cr.emplace(c, _friend_self); std::cout << "TCM2: created friend contact (requested)\n"; @@ -471,6 +477,7 @@ bool ToxContactModel2::onToxEvent(const Tox_Event_Group_Invite* e) { _cr.emplace(c); _cr.emplace(c, this); _cr.emplace(c, chat_id); + _cr.emplace(c, std::vector{chat_id.data.cbegin(), chat_id.data.cend()}); _cr.emplace(c, std::string(group_name)); auto& ir = _cr.emplace(c);