aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java8
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java5
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) {