fixed updating of server message id after dedup

This commit is contained in:
Daniel Gultsch 2018-04-21 19:35:25 +02:00
parent 2992ba647d
commit fc62cbbc52
2 changed files with 8 additions and 5 deletions

View file

@ -520,8 +520,12 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
&& duplicate.getServerMsgId() == null
&& message.getServerMsgId() != null) {
duplicate.setServerMsgId(message.getServerMsgId());
mXmppConnectionService.databaseBackend.updateMessage(message);
if (mXmppConnectionService.databaseBackend.updateMessage(duplicate)) {
serverMsgIdUpdated = true;
} else {
serverMsgIdUpdated = false;
Log.e(Config.LOGTAG,"failed to update message");
}
} else {
serverMsgIdUpdated = false;
}

View file

@ -825,11 +825,10 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return db;
}
public void updateMessage(Message message) {
public boolean updateMessage(Message message) {
SQLiteDatabase db = this.getWritableDatabase();
String[] args = {message.getUuid()};
db.update(Message.TABLENAME, message.getContentValues(), Message.UUID
+ "=?", args);
return db.update(Message.TABLENAME, message.getContentValues(), Message.UUID + "=?", args) == 1;
}
public void updateMessage(Message message, String uuid) {