diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-29 15:59:41 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-29 15:59:41 +0200 |
commit | 7b625e72eaa751bd1b57612af05bc84ad78fd910 (patch) | |
tree | c77ee5922fe907b16281c1276e8b8c48bd77b0dd | |
parent | 3e4c45143b991a7c8adbf6cf1588e4d4d2b74955 (diff) |
fixed updating of server message id after dedup
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 8 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index 94b3106bc..cacf51c0f 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -629,8 +629,12 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece && duplicate.getServerMsgId() == null && message.getServerMsgId() != null) { duplicate.setServerMsgId(message.getServerMsgId()); - mXmppConnectionService.databaseBackend.updateMessage(message); - serverMsgIdUpdated = true; + if (mXmppConnectionService.databaseBackend.updateMessage(duplicate)) { + serverMsgIdUpdated = true; + } else { + serverMsgIdUpdated = false; + Log.e(Config.LOGTAG, "failed to update message"); + } } else { serverMsgIdUpdated = false; } diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java index e98c8a513..a773c4cb9 100644 --- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java @@ -837,11 +837,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) { |