send and receiver startup should be complete
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
// fwd
|
||||
namespace States {
|
||||
@@ -29,6 +31,22 @@ struct ToxClient {
|
||||
|
||||
std::string getOwnAddress(void) const;
|
||||
|
||||
template<typename FN>
|
||||
void forEachGroup(FN&& fn) const {
|
||||
for (const auto& it : _groups) {
|
||||
fn(it.first);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FN>
|
||||
void forEachGroupPeer(uint32_t group_number, FN&& fn) const {
|
||||
if (_groups.count(group_number)) {
|
||||
for (const uint32_t peer_number : _groups.at(group_number)) {
|
||||
fn(peer_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public: // tox callbacks
|
||||
void onToxSelfConnectionStatus(TOX_CONNECTION connection_status);
|
||||
void onToxFriendRequest(const uint8_t* public_key, std::string_view message);
|
||||
@@ -60,5 +78,8 @@ struct ToxClient {
|
||||
bool _tox_profile_dirty {false}; // set in callbacks
|
||||
|
||||
std::unique_ptr<StateI> _state;
|
||||
|
||||
// key groupid, value set of peer ids
|
||||
std::map<uint32_t, std::set<uint32_t>> _groups;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user