more setting group state

This commit is contained in:
Green Sky 2023-08-03 16:12:05 +02:00
parent e28c2502d6
commit de332421f7
No known key found for this signature in database

View File

@ -466,6 +466,14 @@ bool ToxContactModel2::onToxEvent(const Tox_Event_Group_Self_Join* e) {
auto c = getContactGroupPeer(group_number, self_id_opt.value()); auto c = getContactGroupPeer(group_number, self_id_opt.value());
c.emplace_or_replace<Contact::Components::TagSelfStrong>(); c.emplace_or_replace<Contact::Components::TagSelfStrong>();
c.emplace_or_replace<Contact::Components::ConnectionState>(Contact::Components::ConnectionState::State::direct); c.emplace_or_replace<Contact::Components::ConnectionState>(Contact::Components::ConnectionState::State::direct);
auto gc = getContactGroup(group_number);
assert(static_cast<bool>(gc)); // should be no failure mode
gc.emplace_or_replace<Contact::Components::ConnectionState>(
_t.toxGroupIsConnected(group_number).value_or(false)
? Contact::Components::ConnectionState::State::cloud
: Contact::Components::ConnectionState::State::disconnected
);
} else { } else {
assert(false); assert(false);
} }