summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-04-13 04:33:19 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-04-13 04:33:19 -0400
commitb6c6c03f879f282110b08a2d41a5cac143ff41aa (patch)
tree09cf3b8d7b2cb8e084323c477e57fee1b5b0fa00 /components
parent42d38a89b244a7053ef7247fe2f4000138c8d323 (diff)
downloadabaddon-portaudio-b6c6c03f879f282110b08a2d41a5cac143ff41aa.tar.gz
abaddon-portaudio-b6c6c03f879f282110b08a2d41a5cac143ff41aa.zip
pass message object through signal instead of just the id
Diffstat (limited to 'components')
-rw-r--r--components/channels.cpp7
-rw-r--r--components/chatinputindicator.cpp6
-rw-r--r--components/chatinputindicator.hpp4
3 files changed, 7 insertions, 10 deletions
diff --git a/components/channels.cpp b/components/channels.cpp
index 8fcbded..d4152ee 100644
--- a/components/channels.cpp
+++ b/components/channels.cpp
@@ -299,12 +299,11 @@ ChannelList::ChannelList() {
// maybe will regret doing it this way
auto &discord = Abaddon::Get().GetDiscordClient();
- auto cb = [this, &discord](Snowflake message_id) {
- const auto message = discord.GetMessage(message_id);
- const auto channel = discord.GetChannel(message->ChannelID);
+ auto cb = [this, &discord](const Message &message) {
+ const auto channel = discord.GetChannel(message.ChannelID);
if (!channel.has_value()) return;
if (channel->Type == ChannelType::DM || channel->Type == ChannelType::GROUP_DM)
- CheckBumpDM(message->ChannelID);
+ CheckBumpDM(message.ChannelID);
};
discord.signal_message_create().connect(sigc::track_obj(cb, *this));
}
diff --git a/components/chatinputindicator.cpp b/components/chatinputindicator.cpp
index e6c9890..3b43b7e 100644
--- a/components/chatinputindicator.cpp
+++ b/components/chatinputindicator.cpp
@@ -76,10 +76,8 @@ void ChatInputIndicator::OnUserTypingStart(Snowflake user_id, Snowflake channel_
AddUser(channel_id, *user, 10);
}
-void ChatInputIndicator::OnMessageCreate(Snowflake message_id) {
- const auto msg = Abaddon::Get().GetDiscordClient().GetMessage(message_id);
- if (!msg.has_value()) return;
- m_typers[msg->ChannelID].erase(msg->Author.ID);
+void ChatInputIndicator::OnMessageCreate(const Message &message) {
+ m_typers[message.ChannelID].erase(message.Author.ID);
ComputeTypingString();
}
diff --git a/components/chatinputindicator.hpp b/components/chatinputindicator.hpp
index 46ca5f1..3b007b3 100644
--- a/components/chatinputindicator.hpp
+++ b/components/chatinputindicator.hpp
@@ -1,7 +1,7 @@
#pragma once
#include <gtkmm.h>
#include <unordered_map>
-#include "../discord/snowflake.hpp"
+#include "../discord/message.hpp"
#include "../discord/user.hpp"
class ChatInputIndicator : public Gtk::Box {
@@ -14,7 +14,7 @@ public:
private:
void AddUser(Snowflake channel_id, const UserData &user, int timeout);
void OnUserTypingStart(Snowflake user_id, Snowflake channel_id);
- void OnMessageCreate(Snowflake message_id);
+ void OnMessageCreate(const Message &message);
void SetTypingString(const Glib::ustring &str);
void ComputeTypingString();