summaryrefslogtreecommitdiff
path: root/components/chatwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'components/chatwindow.cpp')
-rw-r--r--components/chatwindow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/components/chatwindow.cpp b/components/chatwindow.cpp
index d8ae2b7..b7da92d 100644
--- a/components/chatwindow.cpp
+++ b/components/chatwindow.cpp
@@ -115,6 +115,25 @@ void ChatWindow::ProcessMessage(const Message *data, bool prepend) {
} else {
container = Gtk::manage(new ChatMessageContainer(data)); // only accesses timestamp and user
container->Update();
+
+ auto user_id = data->Author.ID;
+ const auto *user = Abaddon::Get().GetDiscordClient().GetUser(user_id);
+ if (user == nullptr) return;
+ Abaddon::Get().GetImageManager().LoadFromURL(user->GetAvatarURL(), [this, user_id](Glib::RefPtr<Gdk::Pixbuf> buf) {
+ // am i retarded?
+ Glib::signal_idle().connect([this, buf, user_id]() -> bool {
+ auto children = m_listbox->get_children();
+ for (auto child : children) {
+ auto *row = dynamic_cast<ChatMessageContainer *>(child);
+ if (row == nullptr) continue;
+ if (row->UserID == user_id) {
+ row->SetAvatarFromPixbuf(buf);
+ }
+ }
+
+ return false;
+ });
+ });
m_num_rows++;
}