#pragma once #include "config.h" #include "posts.h" #include "state.h" #include "tg.h" #include "vk.h" #include #include namespace manager { namespace td_api = td::td_api; using posts::AbstractPost; class RepostManager { public: RepostManager(uv_loop_t *eventLoop, tg::AuthCodeProvider tgCodeProvider, tg::PasswordProvider tgPasswordProvider, state::AppState *appState, config::AppConfig *config); RepostManager(RepostManager&) = delete; void start(); private: void on_clients_ready(); void collect_all_vk_posts(std::function)> callback); void collect_all_tg_posts(std::function>)> callback); void collect_last_vk_posts(int count, std::function)> callback); void collect_last_tg_posts(int count, std::function>)> callback); void collect_vk_posts_from(int offset, int count, std::function)> callback); void collect_tg_posts_from(long from, int count, std::function>)> callback); void collect_vk_posts_from__intermediate(int offset, int count, std::shared_ptr> intermediateResult, std::function)> callback); void collect_tg_posts_from__intermediate(long from, int count, std::shared_ptr>> intermediateResult, std::function>)> callback); bool drop_posts_older_than(std::vector &posts, long lastPostId); std::vector to_abstract_posts(std::vector &posts); std::vector to_abstract_posts(std::vector> &posts); void repost_all(std::vector posts); state::AppState *m_appState; config::AppConfig *m_appConfig; vk::VKClient m_vk; tg::TelegramClient m_tg; }; }