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 && duplicate.getServerMsgId() == null
&& message.getServerMsgId() != null) { && message.getServerMsgId() != null) {
duplicate.setServerMsgId(message.getServerMsgId()); duplicate.setServerMsgId(message.getServerMsgId());
mXmppConnectionService.databaseBackend.updateMessage(message); if (mXmppConnectionService.databaseBackend.updateMessage(duplicate)) {
serverMsgIdUpdated = true; serverMsgIdUpdated = true;
} else {
serverMsgIdUpdated = false;
Log.e(Config.LOGTAG,"failed to update message");
}
} else { } else {
serverMsgIdUpdated = false; serverMsgIdUpdated = false;
} }

View File

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