mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add constant for MAX_MESSAGE_BODY_SIZE
This commit is contained in:
parent
304c44064d
commit
7f1fc932ad
2 changed files with 4 additions and 2 deletions
|
@ -20,6 +20,7 @@ public class ServiceConfig {
|
|||
|
||||
public static final int MAX_ATTACHMENT_SIZE = 150 * 1024 * 1024;
|
||||
public static final long MAX_ENVELOPE_SIZE = 0;
|
||||
public static final int MAX_MESSAGE_BODY_SIZE = 2000;
|
||||
public static final long AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE = 10 * 1024 * 1024;
|
||||
public static final boolean AUTOMATIC_NETWORK_RETRY = true;
|
||||
public static final int GROUP_MAX_SIZE = 1001;
|
||||
|
|
|
@ -68,6 +68,7 @@ import org.asamk.signal.manager.api.UserStatus;
|
|||
import org.asamk.signal.manager.api.UsernameLinkUrl;
|
||||
import org.asamk.signal.manager.api.UsernameStatus;
|
||||
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||
import org.asamk.signal.manager.config.ServiceConfig;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
|
@ -748,7 +749,7 @@ public class ManagerImpl implements Manager {
|
|||
final SignalServiceDataMessage.Builder messageBuilder, final Message message
|
||||
) throws AttachmentInvalidException, IOException, UnregisteredRecipientException, InvalidStickerException {
|
||||
final var additionalAttachments = new ArrayList<SignalServiceAttachment>();
|
||||
if (message.messageText().length() > 2000) {
|
||||
if (message.messageText().length() > ServiceConfig.MAX_MESSAGE_BODY_SIZE) {
|
||||
final var messageBytes = message.messageText().getBytes(StandardCharsets.UTF_8);
|
||||
final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec();
|
||||
final var streamDetails = new StreamDetails(new ByteArrayInputStream(messageBytes),
|
||||
|
@ -757,7 +758,7 @@ public class ManagerImpl implements Manager {
|
|||
final var textAttachment = AttachmentUtils.createAttachmentStream(streamDetails,
|
||||
Optional.empty(),
|
||||
uploadSpec);
|
||||
messageBuilder.withBody(message.messageText().substring(0, 2000));
|
||||
messageBuilder.withBody(message.messageText().substring(0, ServiceConfig.MAX_MESSAGE_BODY_SIZE));
|
||||
additionalAttachments.add(context.getAttachmentHelper().uploadAttachment(textAttachment));
|
||||
} else {
|
||||
messageBuilder.withBody(message.messageText());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue