ADDRESS_VAL TEXT NOT NULL DEFAULT ''
);
+CREATE TABLE MSG_SENTFAIL_INDEX_TABLE
+(
+ MSG_ID INTEGER PRIMARY KEY ,
+ SENTFAIL_INDEX INTEGER DEFAULT 0 ,
+
+ FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID)
+);
+
CREATE INDEX MSG_CONVERSATION_INDEX ON MSG_CONVERSATION_TABLE(CONV_ID);
CREATE INDEX MSG_FOLDER_INDEX ON MSG_FOLDER_TABLE(FOLDER_ID);
CREATE INDEX MSG_MESSAGE_INDEX ON MSG_MESSAGE_TABLE(MSG_ID, CONV_ID, FOLDER_ID);
else
MSG_SEC_DEBUG("FAIL : create %s [%d].", MSGFW_MMS_RECIPIENTS_TABLE_NAME, err);
}
+
+ if (!dbHandle->checkTableExist(MSGFW_SENTFAIL_INDEX_TABLE_NAME)) {
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "CREATE TABLE %s ( "
+ "MSG_ID INTEGER PRIMARY KEY, "
+ "SENTFAIL_INDEX INTEGER DEFAULT 0, "
+ "FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));",
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME);
+
+ err = dbHandle->execQuery(sqlQuery);
+
+ if (err == MSG_SUCCESS)
+ MSG_SEC_DEBUG("SUCCESS : create %s.", MSGFW_SENTFAIL_INDEX_TABLE_NAME);
+ else
+ MSG_SEC_DEBUG("FAIL : create %s [%d].", MSGFW_SENTFAIL_INDEX_TABLE_NAME, err);
+ }
}
return MSG_ERR_DB_EXEC;
}
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME, msgId);
+
+ /* Delete Data from SENTFAIL_INDEX table */
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
if (msgType.subType == MSG_CB_SMS || msgType.subType == MSG_JAVACB_SMS
|| (msgType.subType >= MSG_CMAS_PRESIDENTIAL && msgType.subType <= MSG_CMAS_OPERATOR_DEFINED)) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME,
MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MMS_PREVIEW_TABLE_NAME,
MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
- MSGFW_MMS_RECIPIENTS_TABLE_NAME, MSGFW_UNIQUENESS_INFO_TABLE_NAME};
+ MSGFW_MMS_RECIPIENTS_TABLE_NAME, MSGFW_UNIQUENESS_INFO_TABLE_NAME,
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME};
#else
const char *tableList[] = {MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME,
MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME,
MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MMS_PREVIEW_TABLE_NAME,
MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
- MSGFW_MMS_RECIPIENTS_TABLE_NAME};
+ MSGFW_MMS_RECIPIENTS_TABLE_NAME, MSGFW_SENTFAIL_INDEX_TABLE_NAME};
#endif
int listCnt = sizeof(tableList)/sizeof(char *);
MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME,
MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
MSGFW_SMS_REPORT_TABLE_NAME, MSGFW_MMS_MULTIPART_TABLE_NAME,
- MSGFW_MMS_RECIPIENTS_TABLE_NAME, MSGFW_UNIQUENESS_INFO_TABLE_NAME};
+ MSGFW_MMS_RECIPIENTS_TABLE_NAME, MSGFW_UNIQUENESS_INFO_TABLE_NAME,
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME};
#else
const char *tableList[] = {MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MMS_PREVIEW_TABLE_NAME,
MSGFW_PUSH_MSG_TABLE_NAME, MSGFW_CB_MSG_TABLE_NAME,
MSGFW_SYNCML_MSG_TABLE_NAME, MSGFW_SMS_SENDOPT_TABLE_NAME,
MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME,
MSGFW_SMS_REPORT_TABLE_NAME, MSGFW_MMS_MULTIPART_TABLE_NAME,
- MSGFW_MMS_RECIPIENTS_TABLE_NAME};
+ MSGFW_MMS_RECIPIENTS_TABLE_NAME, MSGFW_SENTFAIL_INDEX_TABLE_NAME};
#endif
int listCnt = sizeof(tableList)/sizeof(char *);
#define MSGFW_TMP_MSGID_TABLE_NAME "MSG_TMP_MSGID_TABLE"
#define MSGFW_ADDRESS_TEMP_TABLE_NAME "MSG_ADDRESS_TEMP_TABLE"
+#define MSGFW_SENTFAIL_INDEX_TABLE_NAME "MSG_SENTFAIL_INDEX_TABLE"
#define MAX_QUERY_LEN 3072
#define MAX_FOLDER_NAME_LEN 20
return MSG_ERR_DB_EXEC;
}
+ /** Delete Message from msg_sentfail_index table */
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SENTFAIL_INDEX_TABLE_NAME, msgId);
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
/** Clear Conversation table */
if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return false;
}
+
+
+msg_error_t SmsPluginStorage::setFailedIndex(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int failedIndex)
+{
+ msg_error_t err = MSG_SUCCESS;
+ char sqlQuery[MAX_QUERY_LEN+1] = {0};
+ if (failedIndex > 0) {
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT OR REPLACE INTO %s(MSG_ID, SENTFAIL_INDEX) VALUES(%d, %d);",
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME, msgId, failedIndex);
+ } else {
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME, msgId);
+ }
+
+ if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+ err = MSG_ERR_DB_EXEC;
+
+ return err;
+}
+
+
+int SmsPluginStorage::getFailedIndex(MsgDbHandler *pDbHandle, msg_message_id_t msgId)
+{
+ int ret = 0;
+ char sqlQuery[MAX_QUERY_LEN+1] = {0};
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SENTFAIL_INDEX FROM %s WHERE MSG_ID = %d;",
+ MSGFW_SENTFAIL_INDEX_TABLE_NAME, msgId);
+
+ if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
+ return 0;
+
+ if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
+ ret = pDbHandle->columnInt(0);
+ } else {
+ pDbHandle->finalizeQuery();
+ return 0;
+ }
+
+ pDbHandle->finalizeQuery();
+
+ return ret;
+}
+
+
+msg_error_t SmsPluginStorage::deleteFailedIndex(MsgDbHandler *pDbHandle, msg_message_id_t msgId)
+{
+ return setFailedIndex(pDbHandle, msgId, 0);
+}
MSG_INFO("MsgSettingGetString() is failed");
}
- for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) {
+ int failedIndex = SmsPluginStorage::instance()->getFailedIndex(dbHandle, pReqInfo->msgInfo.msgId);
+
+ for (int i = failedIndex; i < pReqInfo->msgInfo.nAddressCnt; i++) {
/* Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S */
SMS_SUBMIT_DATA_S submitData = {{0}, };
msgInfoToSubmitData(&(pReqInfo->msgInfo), &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
}
} else {
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+ SmsPluginStorage::instance()->setFailedIndex(dbHandle, pReqInfo->msgInfo.msgId, i);
if (msisdn) {
free(msisdn);
/* Tizen Validation System */
MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s", pReqInfo->msgInfo.msgId, \
(msisdn == NULL)?"ME":msisdn, \
- pReqInfo->msgInfo.addressList[0].addressVal, \
+ pReqInfo->msgInfo.addressList[i].addressVal, \
"Success");
MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, pReqInfo->msgInfo.msgId);
}
+ SmsPluginStorage::instance()->setFailedIndex(dbHandle, pReqInfo->msgInfo.msgId, i);
+
if (msisdn) {
free(msisdn);
msisdn = NULL;
}
}
+ SmsPluginStorage::instance()->deleteFailedIndex(dbHandle, pReqInfo->msgInfo.msgId);
+
_RETURN_FUNC :
if (msisdn) {
free(msisdn);
msg_error_t releasePushEvent();
msg_error_t updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
bool isDuplicatedCBMsg(MSG_MESSAGE_INFO_S *pMsgInfo);
+
+ msg_error_t setFailedIndex(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int failedIndex);
+ int getFailedIndex(MsgDbHandler *pDbHandle, msg_message_id_t msgId);
+ msg_error_t deleteFailedIndex(MsgDbHandler *pDbHandle, msg_message_id_t msgId);
private:
SmsPluginStorage();
~SmsPluginStorage();