summaryrefslogtreecommitdiff
path: root/src/components/chatwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/chatwindow.cpp')
-rw-r--r--src/components/chatwindow.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/components/chatwindow.cpp b/src/components/chatwindow.cpp
index 38e0247..b68ceba 100644
--- a/src/components/chatwindow.cpp
+++ b/src/components/chatwindow.cpp
@@ -250,11 +250,20 @@ bool ChatWindow::OnInputSubmit(ChatSubmitParams data) {
int restriction = std::max(nitro_restriction, guild_restriction);
+ goffset total_size = 0;
for (const auto &attachment : data.Attachments) {
const auto info = attachment.File->query_info();
- if (info && info->get_size() > restriction) {
- m_input->IndicateTooLarge();
- return false;
+ if (info) {
+ const auto size = info->get_size();
+ if (size > restriction) {
+ m_input->IndicateTooLarge();
+ return false;
+ }
+ total_size += size;
+ if (total_size > MaxMessagePayloadSize) {
+ m_input->IndicateTooLarge();
+ return false;
+ }
}
}