summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/lazyimage.cpp4
-rw-r--r--src/discord/objects.cpp10
-rw-r--r--src/util.cpp5
3 files changed, 12 insertions, 7 deletions
diff --git a/src/components/lazyimage.cpp b/src/components/lazyimage.cpp
index 13bd65d..90b8f28 100644
--- a/src/components/lazyimage.cpp
+++ b/src/components/lazyimage.cpp
@@ -39,7 +39,9 @@ bool LazyImage::OnDraw(const Cairo::RefPtr<Cairo::Context> &context) {
Abaddon::Get().GetImageManager().LoadAnimationFromURL(m_url, m_width, m_height, sigc::track_obj(cb, *this));
} else {
auto cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
- property_pixbuf() = pb->scale_simple(m_width, m_height, Gdk::INTERP_BILINEAR);
+ int cw, ch;
+ GetImageDimensions(pb->get_width(), pb->get_height(), cw, ch, m_width, m_height);
+ property_pixbuf() = pb->scale_simple(cw, ch, Gdk::INTERP_BILINEAR);
};
Abaddon::Get().GetImageManager().LoadFromURL(m_url, sigc::track_obj(cb, *this));
diff --git a/src/discord/objects.cpp b/src/discord/objects.cpp
index cb0a685..4ad17c3 100644
--- a/src/discord/objects.cpp
+++ b/src/discord/objects.cpp
@@ -27,7 +27,7 @@ void from_json(const nlohmann::json &j, MessageDeleteBulkData &m) {
void from_json(const nlohmann::json &j, GuildMemberListUpdateMessage::GroupItem &m) {
m.Type = "group";
JS_D("id", m.ID);
- JS_D("count", m.Count);
+ JS_ON("count", m.Count);
}
GuildMember GuildMemberListUpdateMessage::MemberItem::GetAsMemberData() const {
@@ -54,16 +54,16 @@ void from_json(const nlohmann::json &j, GuildMemberListUpdateMessage::OpObject &
m.Items.emplace();
JS_D("range", m.Range);
for (const auto &ij : j.at("items")) {
- if (ij.contains("group"))
- m.Items->push_back(std::make_unique<GuildMemberListUpdateMessage::GroupItem>(ij.at("group")));
- else if (ij.contains("member"))
+ if (ij.contains("member")) {
m.Items->push_back(std::make_unique<GuildMemberListUpdateMessage::MemberItem>(ij.at("member")));
+ }
}
} else if (m.Op == "UPDATE") {
JS_D("index", m.Index);
const auto &ij = j.at("item");
- if (ij.contains("member"))
+ if (ij.contains("member")) {
m.OpItem = std::make_unique<GuildMemberListUpdateMessage::MemberItem>(ij.at("member"));
+ }
}
}
diff --git a/src/util.cpp b/src/util.cpp
index 8d21ff4..ae948ea 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -160,7 +160,10 @@ std::string GetExtension(std::string url) {
}
bool IsURLViewableImage(const std::string &url) {
- const auto ext = GetExtension(url);
+ std::string lw_url = url;
+ std::transform(lw_url.begin(), lw_url.end(), lw_url.begin(), ::tolower);
+
+ const auto ext = GetExtension(lw_url);
static const char *exts[] = { ".jpeg",
".jpg",
".png", nullptr };