-
Notifications
You must be signed in to change notification settings - Fork 2
/
CommonGroupsWindow.hpp
40 lines (32 loc) · 1.13 KB
/
CommonGroupsWindow.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
#include "MenuWindowPad.hpp"
#include "ChatManager.hpp"
#include "td/tl/TlObject.h"
#include "td/utils/Status.h"
#include <memory>
namespace tdcurses {
class CommonGroupsWindow : public MenuWindowPad {
public:
CommonGroupsWindow(Tdcurses *root, td::ActorId<Tdcurses> root_actor, std::shared_ptr<User> user)
: MenuWindowPad(root, std::move(root_actor)), user_(std::move(user)) {
CHECK(user_);
set_pad_to(PadTo::Top);
scroll_first_line();
set_need_refresh();
set_title(PSTRING() << "common groups with " << user_->first_name() << " " << user_->last_name());
}
void request_bottom_elements() override;
void got_chats(td::Result<td::tl_object_ptr<td::td_api::chats>> R);
static MenuWindowSpawnFunction spawn_function(std::shared_ptr<User> user) {
return [user](Tdcurses *root, td::ActorId<Tdcurses> root_id) -> std::shared_ptr<MenuWindow> {
return std::make_shared<CommonGroupsWindow>(root, root_id, user);
};
}
private:
std::shared_ptr<User> user_;
td::int64 last_chat_id_{0};
bool running_req_{false};
bool is_completed_{false};
size_t last_idx_{0};
};
} // namespace tdcurses