2020-08-17 06:40:03 +00:00
|
|
|
#include <gtkmm.h>
|
2020-08-19 05:07:55 +00:00
|
|
|
#include <memory>
|
2020-08-19 05:13:36 +00:00
|
|
|
#include <mutex>
|
2020-08-19 05:07:55 +00:00
|
|
|
#include <string>
|
2020-08-20 07:19:16 +00:00
|
|
|
#include <unordered_set>
|
2020-08-17 06:40:03 +00:00
|
|
|
#include "discord/discord.hpp"
|
2020-08-19 05:07:55 +00:00
|
|
|
#include "windows/mainwindow.hpp"
|
|
|
|
#include "settings.hpp"
|
2020-08-17 06:40:03 +00:00
|
|
|
|
2020-09-03 06:32:28 +00:00
|
|
|
#define APP_TITLE "Abaddon"
|
|
|
|
|
2020-08-17 06:40:03 +00:00
|
|
|
class Abaddon {
|
|
|
|
public:
|
2020-08-19 05:07:55 +00:00
|
|
|
Abaddon();
|
|
|
|
~Abaddon();
|
|
|
|
|
|
|
|
int StartGTK();
|
|
|
|
void StartDiscord();
|
|
|
|
void StopDiscord();
|
|
|
|
|
|
|
|
void LoadFromSettings();
|
2020-08-17 06:40:03 +00:00
|
|
|
|
|
|
|
void ActionConnect();
|
2020-08-19 05:07:55 +00:00
|
|
|
void ActionDisconnect();
|
|
|
|
void ActionSetToken();
|
2020-08-20 01:08:57 +00:00
|
|
|
void ActionMoveGuildUp(Snowflake id);
|
|
|
|
void ActionMoveGuildDown(Snowflake id);
|
2020-08-26 02:10:39 +00:00
|
|
|
void ActionCopyGuildID(Snowflake id);
|
2020-08-20 07:19:16 +00:00
|
|
|
void ActionListChannelItemClick(Snowflake id);
|
2020-08-22 02:25:23 +00:00
|
|
|
void ActionChatInputSubmit(std::string msg, Snowflake channel);
|
2020-08-28 22:21:08 +00:00
|
|
|
void ActionChatLoadHistory(Snowflake id);
|
2020-08-30 06:00:56 +00:00
|
|
|
void ActionChatDeleteMessage(Snowflake channel_id, Snowflake id);
|
2020-08-31 02:55:36 +00:00
|
|
|
void ActionChatEditMessage(Snowflake channel_id, Snowflake id);
|
2020-08-19 05:07:55 +00:00
|
|
|
|
2020-09-03 04:47:49 +00:00
|
|
|
void ActionReloadCSS();
|
|
|
|
|
2020-08-19 05:07:55 +00:00
|
|
|
std::string GetDiscordToken() const;
|
|
|
|
bool IsDiscordActive() const;
|
2020-08-17 06:40:03 +00:00
|
|
|
|
2020-08-19 05:13:36 +00:00
|
|
|
const DiscordClient &GetDiscordClient() const;
|
|
|
|
void DiscordNotifyReady();
|
2020-08-20 01:08:57 +00:00
|
|
|
void DiscordNotifyChannelListFullRefresh();
|
2020-08-21 04:42:46 +00:00
|
|
|
void DiscordNotifyMessageCreate(Snowflake id);
|
2020-08-29 05:14:07 +00:00
|
|
|
void DiscordNotifyMessageDelete(Snowflake id, Snowflake channel_id);
|
2020-08-31 00:24:02 +00:00
|
|
|
void DiscordNotifyMessageUpdateContent(Snowflake id, Snowflake channel_id);
|
2020-09-05 04:55:06 +00:00
|
|
|
void DiscordNotifyGuildMemberListUpdate(Snowflake guild_id);
|
2020-08-19 05:13:36 +00:00
|
|
|
|
2020-08-17 06:40:03 +00:00
|
|
|
private:
|
2020-08-20 07:19:16 +00:00
|
|
|
DiscordClient m_discord;
|
2020-08-19 05:07:55 +00:00
|
|
|
std::string m_discord_token;
|
2020-08-28 22:21:08 +00:00
|
|
|
// todo make these map snowflake to attribs
|
2020-08-20 07:19:16 +00:00
|
|
|
std::unordered_set<Snowflake> m_channels_requested;
|
2020-08-28 22:21:08 +00:00
|
|
|
std::unordered_set<Snowflake> m_channels_history_loaded;
|
|
|
|
std::unordered_map<Snowflake, Snowflake> m_oldest_listed_message;
|
|
|
|
std::unordered_set<Snowflake> m_channels_history_loading;
|
2020-08-20 07:19:16 +00:00
|
|
|
|
2020-08-19 05:13:36 +00:00
|
|
|
mutable std::mutex m_mutex;
|
2020-08-17 06:40:03 +00:00
|
|
|
Glib::RefPtr<Gtk::Application> m_gtk_app;
|
2020-09-03 04:47:49 +00:00
|
|
|
Glib::RefPtr<Gtk::CssProvider> m_css_provider;
|
2020-08-19 05:07:55 +00:00
|
|
|
SettingsManager m_settings;
|
|
|
|
std::unique_ptr<MainWindow> m_main_window; // wah wah cant create a gtkstylecontext fuck you
|
2020-08-19 05:13:36 +00:00
|
|
|
};
|