states + refactoring
This commit is contained in:
@@ -2,19 +2,28 @@
|
||||
|
||||
#include "./command_line.hpp"
|
||||
|
||||
#include <string_view>
|
||||
#include "./state.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <tox/tox.h>
|
||||
#include <ngc_ext.h>
|
||||
#include <ngc_ft1.h>
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
// fwd
|
||||
namespace SendStates {
|
||||
struct SHA1Start;
|
||||
}
|
||||
|
||||
struct ToxClient {
|
||||
public:
|
||||
ToxClient(const CommandLine& cl);
|
||||
~ToxClient(void);
|
||||
|
||||
void iterate(void);
|
||||
// returns false when we shoul stop the program
|
||||
bool iterate(void);
|
||||
|
||||
void setToxProfilePath(const std::string& new_path) { _tox_profile_path = new_path; }
|
||||
|
||||
@@ -31,6 +40,8 @@ struct ToxClient {
|
||||
void onToxGroupSelfJoin(uint32_t group_number);
|
||||
|
||||
public: // FT1 callbacks
|
||||
StateI& getState(void); // public accessor for callbacks
|
||||
#if 0
|
||||
// sha1_info
|
||||
void onFT1ReceiveRequestSHA1Info(uint32_t group_number, uint32_t peer_number, const uint8_t* file_id, size_t file_id_size);
|
||||
bool onFT1ReceiveInitSHA1Info(uint32_t group_number, uint32_t peer_number, const uint8_t* file_id, size_t file_id_size, const uint8_t transfer_id, const size_t file_size);
|
||||
@@ -42,6 +53,7 @@ struct ToxClient {
|
||||
bool onFT1ReceiveInitSHA1Chunk(uint32_t group_number, uint32_t peer_number, const uint8_t* file_id, size_t file_id_size, const uint8_t transfer_id, const size_t file_size);
|
||||
void onFT1ReceiveDataSHA1Chunk(uint32_t group_number, uint32_t peer_number, uint8_t transfer_id, size_t data_offset, const uint8_t* data, size_t data_size);
|
||||
void onFT1SendDataSHA1Chunk(uint32_t group_number, uint32_t peer_number, uint8_t transfer_id, size_t data_offset, uint8_t* data, size_t data_size);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void saveToxProfile(void);
|
||||
@@ -55,5 +67,10 @@ struct ToxClient {
|
||||
|
||||
std::string _tox_profile_path;
|
||||
bool _tox_profile_dirty {false}; // set in callbacks
|
||||
|
||||
std::unique_ptr<StateI> _state;
|
||||
|
||||
// TODO: this is a hack, make better?
|
||||
friend SendStates::SHA1Start;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user