only store messages up to a length of 1M chars

This commit is contained in:
Daniel Gultsch 2017-02-07 17:45:01 +01:00
parent 6313c3c92e
commit e35ada4997
2 changed files with 2 additions and 1 deletions

View File

@ -77,6 +77,7 @@ public final class Config {
public static final int REFRESH_UI_INTERVAL = 500;
public static final int MAX_DISPLAY_MESSAGE_CHARS = 4096;
public static final int MAX_STORAGE_MESSAGE_CHARS = 1024 * 1024 * 1024;
public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000;

View File

@ -219,7 +219,7 @@ public class Message extends AbstractEntity {
} else {
values.put(TRUE_COUNTERPART, trueCounterpart.toPreppedString());
}
values.put(BODY, body);
values.put(BODY, body.length() > Config.MAX_STORAGE_MESSAGE_CHARS ? body.substring(0,Config.MAX_STORAGE_MESSAGE_CHARS) : body);
values.put(TIME_SENT, timeSent);
values.put(ENCRYPTION, encryption);
values.put(STATUS, status);