break;
case SMS_MESSAGE_BOX_TYPE_ALL:
{
+ int spamCount = 0;
+ int draftCount = 0;
err = msg_count_msg_by_type(__msgHandle, MSG_TYPE_SMS, &msgCount);
if (err != MSG_SUCCESS)
return -1;
}
- SysLog(NID_MSG, "Total count of messages is [%d]", msgCount);
+ countInfo = msg_create_struct(MSG_STRUCT_COUNT_INFO);
+
+ err = msg_count_message(__msgHandle, MSG_SPAMBOX_ID , countInfo);
+ r = ConvertException(err);
+ SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to get the message count of the message box (%d)", GetErrorMessage(r), (int) type);
+ msg_get_int_value(countInfo, MSG_COUNT_INFO_SMS_INT, &spamCount);
+
+ err = msg_count_message(__msgHandle, MSG_DRAFT_ID , countInfo);
+ r = ConvertException(err);
+ SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to get the message count of the message box (%d)", GetErrorMessage(r), (int) type);
+ msg_get_int_value(countInfo, MSG_COUNT_INFO_SMS_INT, &draftCount);
+
+ msg_release_struct(&countInfo);
+
+ msgCount = msgCount - spamCount - draftCount;
+ SysLog(NID_MSG, "Total count of messages is [%d] , spam[%d], draft[%d]",msgCount, spamCount, draftCount);
+
return msgCount;
}
break;
// get the count of corresponding message box
countInfo = msg_create_struct(MSG_STRUCT_COUNT_INFO);
err = msg_count_message(__msgHandle, folderType, countInfo);
-
- if (err != MSG_SUCCESS)
- {
r = ConvertException(err);
- SysLogException(NID_MSG, r, "[%s] Failed to get the message count of the message box (%d)", GetErrorMessage(r), (int) type);
- msg_release_struct(&countInfo);
- SetLastResult(r);
- return -1;
- }
+ SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to get the message count of the message box (%d)", GetErrorMessage(r), (int) type);
msg_get_int_value(countInfo, MSG_COUNT_INFO_SMS_INT, &msgCount);
msg_release_struct(&countInfo);
SysLog(NID_MSG, "Total count of messages is [%d]", msgCount);
return msgCount;
+
+
+CATCH:
+
+ msg_release_struct(&countInfo);
+ return -1;
+
}
Tizen::Base::Collection::IList*
ArrayList* pList = NULL;
msg_struct_list_s msgList = {0};
msg_struct_t searchCon = NULL;
-
+ int tempCount = 0;
ClearLastResult();
pList = new (std::nothrow) ArrayList();
// type
folderId = _MsgUtil::GetMsgFolderId(type);
+ SysLog(NID_MSG, "box type [%d]", (int)type);
// Set Condition
searchCon = msg_create_struct(MSG_STRUCT_SEARCH_CONDITION);
r = ConvertException(err);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] msg_search_message call failed.", GetErrorMessage(r));
- totalResultCount = msgList.nCount;
-
- SysLog(NID_MSG, "Total Search count of messages is [%d]", totalResultCount);
- for (int index = 0; index < totalResultCount; index++)
+ for (int index = 0; index < msgList.nCount; index++)
{
SmsMessage* pSmsMessage = null;
+
if (type == SMS_MESSAGE_BOX_TYPE_ALL)
{
err = msg_get_int_value(msgList.msg_struct_info[index], MSG_MESSAGE_FOLDER_ID_INT, &folderId);
+ SysLog(NID_MSG, "Folder [%d]", folderId);
switch (folderId)
{
pSmsMessage = _MsgUtil::ConvertSmsMessageN(SMS_MESSAGE_BOX_TYPE_SENTBOX, msgList.msg_struct_info[index]);
break;
- case MSG_DRAFT_ID:
- //pSmsMessage = _MsgUtil::ConvertSmsMessageN(SMS_MESSAGE_BOX_TYPE_SENTBOX, msgList.msg_struct_info[index]);
- break;
-
- case MSG_ALLBOX_ID:
- //pSmsMessage = _MsgUtil::ConvertSmsMessageN(SMS_MESSAGE_BOX_TYPE_SENTBOX, msgList.msg_struct_info[index]);
+ default:
break;
}
- // add the item to the list
+ if (pSmsMessage)
+ {
+ tempCount++;
pList->Add(*pSmsMessage);
}
+ }
else
{
pSmsMessage = _MsgUtil::ConvertSmsMessageN(type, msgList.msg_struct_info[index]);
+ if (pSmsMessage)
+ {
+ tempCount++;
pList->Add(*pSmsMessage);
}
+
+ }
}
+ totalResultCount = tempCount;
+ SysLog(NID_MSG, "Total Search count of messages is [%d] original [%d]", totalResultCount , msgList.nCount );
if (pSearchString)
{
msg_release_struct(&searchCon);
msg_release_list_struct(&msgList);
+ totalResultCount = 0;
return null;
}