summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rw-r--r--windows/pinnedwindow.cpp10
-rw-r--r--windows/pinnedwindow.hpp2
2 files changed, 12 insertions, 0 deletions
diff --git a/windows/pinnedwindow.cpp b/windows/pinnedwindow.cpp
index 99b8c1e..fc6230c 100644
--- a/windows/pinnedwindow.cpp
+++ b/windows/pinnedwindow.cpp
@@ -21,9 +21,19 @@ PinnedWindow::PinnedWindow(const ChannelData &data)
m_chat.SetActiveChannel(ChannelID);
m_chat.SetUsePinnedMenu();
+ Abaddon::Get().GetDiscordClient().signal_message_pinned().connect(sigc::mem_fun(*this, &PinnedWindow::OnMessagePinned));
+ Abaddon::Get().GetDiscordClient().signal_message_unpinned().connect(sigc::mem_fun(*this, &PinnedWindow::OnMessageUnpinned));
FetchPinned();
}
+void PinnedWindow::OnMessagePinned(const Message &msg) {
+ FetchPinned();
+}
+
+void PinnedWindow::OnMessageUnpinned(const Message &msg) {
+ m_chat.ActuallyRemoveMessage(msg.ID);
+}
+
void PinnedWindow::FetchPinned() {
Abaddon::Get().GetDiscordClient().FetchPinned(ChannelID, sigc::mem_fun(*this, &PinnedWindow::OnFetchedPinned));
}
diff --git a/windows/pinnedwindow.hpp b/windows/pinnedwindow.hpp
index a118876..56461a5 100644
--- a/windows/pinnedwindow.hpp
+++ b/windows/pinnedwindow.hpp
@@ -13,6 +13,8 @@ public:
Snowflake ChannelID;
private:
+ void OnMessagePinned(const Message &msg);
+ void OnMessageUnpinned(const Message &msg);
void FetchPinned();
void OnFetchedPinned(const std::vector<Message> &msgs, DiscordError code);