From 83110a31c03759a5b46aa121eb2417e26e71d6aa Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 2 Apr 2013 11:52:40 +0200 Subject: [PATCH] Fix message status display --- src/org/linphone/ChatStorage.java | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/org/linphone/ChatStorage.java b/src/org/linphone/ChatStorage.java index 55680c18e..54c9f4a8c 100644 --- a/src/org/linphone/ChatStorage.java +++ b/src/org/linphone/ChatStorage.java @@ -55,13 +55,23 @@ public class ChatStorage { } public void updateMessageStatus(String to, String message, int status) { - ContentValues values = new ContentValues(); - values.put("status", status); - - String where = "direction LIKE ? AND remoteContact LIKE ? AND message LIKE ?"; String[] whereArgs = { String.valueOf(OUTGOING), to, message }; + Cursor c = db.query(TABLE_NAME, null, "direction LIKE ? AND remoteContact LIKE ? AND message LIKE ?", whereArgs, null, null, "id DESC"); + + String id = null; + if (c.moveToFirst()) { + try { + id = c.getString(c.getColumnIndex("id")); + } catch (Exception e) { + e.printStackTrace(); + } + } + c.close(); - db.update(TABLE_NAME, values, where, whereArgs); + if (id != null && id.length() > 0) { + int intID = Integer.parseInt(id); + updateMessageStatus(to, intID, status); + } } public void updateMessageStatus(String to, int id, int status) {