aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-02-08 21:40:40 +0100
committerChristian Schneppe <christian@pix-art.de>2017-02-08 21:40:40 +0100
commit1c3de25ca64a0eb81b3f9024c7718d45db1d6d66 (patch)
tree9c9bcd668e4406c04cd28f02aafc3eff1be077f7 /src/main
parent256bc64d314d403dc6b40549f687872963726f05 (diff)
only store messages up to a length of 1M chars
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/Config.java1
-rw-r--r--src/main/java/de/pixart/messenger/entities/Message.java2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java
index eef639e40..8b095a149 100644
--- a/src/main/java/de/pixart/messenger/Config.java
+++ b/src/main/java/de/pixart/messenger/Config.java
@@ -94,6 +94,7 @@ public final class Config {
public static boolean PUT_AUTH_TAG_INTO_KEY = false;
public static final int MAX_DISPLAY_MESSAGE_CHARS = 4096;
+ public static final int MAX_STORAGE_MESSAGE_CHARS = 1024 * 1024 * 1024;
public static final boolean ExportLogs = true; // automatically export logs
public static final int ExportLogs_Hour = 4; //valid values from 0 to 23
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java
index 5a3549a95..bf53b3cd7 100644
--- a/src/main/java/de/pixart/messenger/entities/Message.java
+++ b/src/main/java/de/pixart/messenger/entities/Message.java
@@ -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);