TelegramTUI/inc/tgtui.h

42 lines
672 B
C++

#pragma once
#include <thread>
#include "slimchat.h"
#include "tgclient.h"
#include "message.h"
#include <cdk/cdk.h>
class TgTUI {
public:
TgTUI();
~TgTUI();
void run();
void stop();
const std::vector<SlimChat>& getChats();
private:
void initDoneCB();
void threadLoop();
void handleNewChat(objptr<td_api::chat> chat);
void handleChatMessages(const std::vector<std::shared_ptr<Message>>& msgs);
TGClient tgclient;
std::vector<SlimChat> chats;
std::vector<char*> chatsItemList;
std::vector<std::shared_ptr<Message>> messages;
CDKSCROLL* chatsScroll = nullptr;
CDKSCROLL* chatScroll = nullptr;
bool shouldRun = false;
std::thread tuiThread;
};