From 09ba4b4914c3de47bbc5ccbaee9288fb468320b1 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 19 Nov 2024 15:18:14 -0500 Subject: [PATCH] Limit size of message to send To a size we would be willing to display at least. --- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5e77324b5e1b08ffec21aec5f01eab85ec346082..3fffc3d43b0fd5f29e08497f2febe81d7f4845d1 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -960,6 +960,10 @@ public class ConversationFragment extends XmppFragment } Editable body = this.binding.textinput.getText(); if (body == null) body = new SpannableStringBuilder(""); + if (body.length() > Config.MAX_DISPLAY_MESSAGE_CHARS) { + Toast.makeText(activity, "Message is too long", Toast.LENGTH_SHORT).show(); + return; + } final Conversation conversation = this.conversation; final boolean hasSubject = binding.textinputSubject.getText().length() > 0; if (conversation == null || (body.length() == 0 && (conversation.getThread() == null || !hasSubject))) {