do not include body in simple status updates to not trigger fts update

This commit is contained in:
Daniel Gultsch 2018-05-10 10:47:28 +02:00
parent a8b863ae41
commit 5b41906328
5 changed files with 18 additions and 9 deletions

View File

@ -90,7 +90,7 @@ public class PgpDecryptionService {
message.setEncryption(Message.ENCRYPTION_DECRYPTION_FAILED);
}
}
mXmppConnectionService.updateMessage(message);
mXmppConnectionService.updateMessage(message, false);
continueDecryption(true);
}

View File

@ -407,7 +407,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...");
}
}
@ -529,7 +529,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;
@ -725,7 +725,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);
}
}
}

View File

@ -855,9 +855,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;
}

View File

@ -2616,7 +2616,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();
}
@ -3056,7 +3060,7 @@ public class XmppConnectionService extends Service {
}
message.setErrorMessage(errorMessage);
message.setStatus(status);
databaseBackend.updateMessage(message);
databaseBackend.updateMessage(message, false);
updateConversationUi();
}
@ -3221,7 +3225,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);

View File

@ -771,7 +771,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);
}