dbHandle->endTrans(true);
/* Update Thread Callback */
- if (bCheckIndication == true && MsgExistConversation(dbHandle, convId) == true)
+ if (bCheckIndication == true && MsgExistConversation(dbHandle, convId) == true && MsgExistInThreadViewList(dbHandle, convId) == true)
MsgTransactionManager::instance()->broadcastThreadChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, convId);
if (msgType.mainType == MSG_SMS_TYPE && folderId == MSG_INBOX_ID) {
/* Update Thread Callback */
while (!threadList2.empty()) {
msg_thread_id_t cur_thread_id = threadList2.front();
- if (MsgExistConversation(dbHandle, cur_thread_id) == true)
+ if (MsgExistConversation(dbHandle, cur_thread_id) == true && MsgExistInThreadViewList(dbHandle, cur_thread_id) == true)
MsgTransactionManager::instance()->broadcastThreadChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, cur_thread_id);
threadList2.pop();
/* Update Thread Callback */
while (!threadList3.empty()) {
msg_thread_id_t cur_thread_id = threadList3.front();
- if (MsgExistConversation(dbHandle, cur_thread_id) == true)
+ if (MsgExistConversation(dbHandle, cur_thread_id) == true && MsgExistInThreadViewList(dbHandle, cur_thread_id) == true)
MsgTransactionManager::instance()->broadcastThreadChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, cur_thread_id);
threadList3.pop();
} else if (storageChangeType == MSG_STORAGE_CHANGE_DELETE) {
std::list<msg_thread_id_t>::iterator it = cur_conv_list.begin();
for (; it != cur_conv_list.end(); ) {
- if (MsgExistConversation(dbHandle, *it) == false) {
+ if (MsgExistConversation(dbHandle, *it) == false || MsgExistInThreadViewList(dbHandle, *it) == false) {
broadcastThreadChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, *it);
it = cur_conv_list.erase(it);
} else{
bool MsgExistAddress(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t convId, int index);
bool MsgExistConversation(MsgDbHandler *pDbHandle, msg_thread_id_t convId);
bool MsgExistMessage(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg);
+bool MsgExistInThreadViewList(MsgDbHandler *pDbHandle, msg_thread_id_t convId);
int MsgStoGetUnreadCnt(MsgDbHandler *pDbHandle, MSG_MAIN_TYPE_T MsgType);
msg_error_t MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, msg_message_id_t msgId, char *pFilePath);
return true;
}
+bool MsgExistInThreadViewList(MsgDbHandler *pDbHandle, msg_thread_id_t convId)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ int rowCnt = 0;
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
+
+ err = pDbHandle->getTable(sqlQuery, &rowCnt, NULL);
+
+ if (err == MSG_ERR_DB_NORECORD) {
+ pDbHandle->freeTable();
+ return false;
+ } else if (err != MSG_SUCCESS) {
+ pDbHandle->freeTable();
+ return false;
+ }
+ pDbHandle->freeTable();
+
+ return true;
+}
+
bool MsgExistMessage(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg)
{
msg_error_t err = MSG_SUCCESS;