aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java2
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java6
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java7
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java12
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java2
5 files changed, 19 insertions, 10 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java
index f1c3e277c..857dff0d1 100644
--- a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java
+++ b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java
@@ -90,7 +90,7 @@ public class PgpDecryptionService {
message.setEncryption(Message.ENCRYPTION_DECRYPTION_FAILED);
}
}
- mXmppConnectionService.updateMessage(message);
+ mXmppConnectionService.updateMessage(message, false);
continueDecryption(true);
}
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index 3e6483650..f09c82473 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -517,7 +517,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
Message previouslySent = conversation.findSentMessageWithUuid(remoteMsgId);
if (previouslySent != null && previouslySent.getServerMsgId() == null && serverMsgId != null) {
previouslySent.setServerMsgId(serverMsgId);
- mXmppConnectionService.databaseBackend.updateMessage(previouslySent);
+ mXmppConnectionService.databaseBackend.updateMessage(previouslySent, false);
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": encountered previously sent OMEMO message without serverId. updating...");
}
}
@@ -639,7 +639,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
&& duplicate.getServerMsgId() == null
&& message.getServerMsgId() != null) {
duplicate.setServerMsgId(message.getServerMsgId());
- if (mXmppConnectionService.databaseBackend.updateMessage(duplicate)) {
+ if (mXmppConnectionService.databaseBackend.updateMessage(duplicate, false)) {
serverMsgIdUpdated = true;
} else {
serverMsgIdUpdated = false;
@@ -838,7 +838,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
ReadByMarker readByMarker = ReadByMarker.from(counterpart, trueJid);
if (message.addReadByMarker(readByMarker)) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": added read by (" + readByMarker.getRealJid() + ") to message '" + message.getBody() + "'");
- mXmppConnectionService.updateMessage(message);
+ mXmppConnectionService.updateMessage(message, false);
mXmppConnectionService.markMessage(account, from.asBareJid(), id, Message.STATUS_SEND_DISPLAYED);
}
}
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index dab6dde5d..fb9d90bed 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -868,9 +868,14 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return db;
}
- public boolean updateMessage(Message message) {
+ public boolean updateMessage(Message message, boolean includeBody) {
SQLiteDatabase db = this.getWritableDatabase();
String[] args = {message.getUuid()};
+ ContentValues contentValues = message.getContentValues();
+ contentValues.remove(Message.UUID);
+ if (!includeBody) {
+ contentValues.remove(Message.BODY);
+ }
return db.update(Message.TABLENAME, message.getContentValues(), Message.UUID + "=?", args) == 1;
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 5bf036bd7..c4a40c1a3 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -2896,7 +2896,11 @@ public class XmppConnectionService extends Service {
}
public void updateMessage(Message message) {
- databaseBackend.updateMessage(message);
+ updateMessage(message, true);
+ }
+
+ public void updateMessage(Message message, boolean includeBody) {
+ databaseBackend.updateMessage(message, includeBody);
updateConversationUi();
}
@@ -2948,7 +2952,7 @@ public class XmppConnectionService extends Service {
if (outPacket != null) {
mMessageGenerator.addDelay(outPacket, message.getTimeSent());
message.setStatus(Message.STATUS_SEND);
- databaseBackend.updateMessage(message);
+ databaseBackend.updateMessage(message, false);
sendMessagePacket(account, outPacket);
}
}
@@ -3392,7 +3396,7 @@ public class XmppConnectionService extends Service {
}
message.setErrorMessage(errorMessage);
message.setStatus(status);
- databaseBackend.updateMessage(message);
+ databaseBackend.updateMessage(message, false);
updateConversationUi();
}
@@ -3571,7 +3575,7 @@ public class XmppConnectionService extends Service {
if (readMessages.size() > 0) {
Runnable runnable = () -> {
for (Message message : readMessages) {
- databaseBackend.updateMessage(message);
+ databaseBackend.updateMessage(message, false);
}
};
mDatabaseWriterExecutor.execute(runnable);
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
index b2eb6a766..6c726c8b9 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
@@ -800,7 +800,7 @@ public class JingleConnection implements Transferable {
this.mJingleStatus = JINGLE_STATUS_FINISHED;
this.message.setStatus(Message.STATUS_RECEIVED);
this.message.setTransferable(null);
- this.mXmppConnectionService.updateMessage(message);
+ this.mXmppConnectionService.updateMessage(message, false);
this.mJingleConnectionManager.finishConnection(this);
}