diff --git a/src/org/linphone/ChatStorage.java b/src/org/linphone/ChatStorage.java index 32eb6bf7e..697042a5d 100644 --- a/src/org/linphone/ChatStorage.java +++ b/src/org/linphone/ChatStorage.java @@ -378,12 +378,20 @@ public class ChatStorage { ArrayList chatList = new ArrayList(); if (useNativeAPI) { + ArrayList chatListReadMessages = new ArrayList(); + LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms(); for (LinphoneChatRoom chatroom : chats) { if (chatroom.getHistory(1).length > 0) { - chatList.add(chatroom.getPeerAddress().asStringUriOnly()); + if (chatroom.getUnreadMessagesCount() > 0) { + chatList.add(chatroom.getPeerAddress().asStringUriOnly()); + } else { + chatListReadMessages.add(chatroom.getPeerAddress().asStringUriOnly()); + } } } + chatList.addAll(chatListReadMessages); + } else { Cursor c = db.query(TABLE_NAME, null, null, null, "remoteContact", null, "id DESC"); while (c != null && c.moveToNext()) {