SET(RC_LOCAL_SCRIPT msg-server)
INSTALL(PROGRAMS ${RC_LOCAL_SCRIPT} DESTINATION /etc/rc.d/init.d)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/msg-service.service DESTINATION /usr/lib/systemd/user)
+
+# LICENSE file
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license/msg-service)
return MSG_ERR_STORAGE_ERROR;
MSG_DEBUG("pMsg->networkStatus : %d", pMsgInfo->networkStatus);
- err = MsgStoUpdateNetworkStatus(pMsgInfo, pMsgInfo->networkStatus);
+ err = MsgStoUpdateNetworkStatus(&dbHandle, pMsgInfo, pMsgInfo->networkStatus);
if (err != MSG_SUCCESS)
return MSG_ERR_STORAGE_ERROR;
{
MsgSoundPlayStart();
+ if (pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS && pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS) {
+ if (pMsgInfo->bStore == false) {
+ MsgInsertNoti(pMsgInfo);
+ *pSendNoti = false;
+ return err;
+ }
+ }
+
int smsCnt = 0, mmsCnt = 0;
smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE);
break;
case MSG_WAP_SI_SMS:
+ *pSendNoti = true;
+ break;
case MSG_WAP_CO_SMS:
- {
*pSendNoti = false;
- }
- break;
+ break;
}
} else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) {
msg_thread_id_t convId = 0;
char *temp = NULL;
AutoPtr<char> wrap(&temp);
- int len;
+ unsigned int len;
client.read(&temp, &len);
// close connection to msgfw daemon
char *temp = NULL;
AutoPtr<char> wrap(&temp);
- int len;
+ unsigned int len;
client.read(&temp, &len);
// close connection to msgfw daemon
char* retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize;
+ unsigned int retSize;
client.read(&retBuf, &retSize);
// Receive result from Transaction Manager
char* retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize;
+ unsigned int retSize;
client.read(&retBuf, &retSize);
// close connection to msgfw daemon
// Receive result from Transaction Manager
char* retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize;
+ unsigned int retSize;
client.read(&retBuf, &retSize);
// close connection to msgfw daemon
char* retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize;
+ unsigned int retSize;
client.read(&retBuf, &retSize);
// Receive result from Transaction Manager
char* retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize;
+ unsigned int retSize;
client.read(&retBuf, &retSize);
// close connection to msgfw daemon
// Receive result from Transaction Manager
char* retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize;
+ unsigned int retSize;
client.read(&retBuf, &retSize);
// close connection to msgfw daemon
// Receive result from Transaction Manager
char *retBuf = NULL;
AutoPtr<char> wrap(&retBuf);
- int retSize = 0;
+ unsigned int retSize = 0;
client.read(&retBuf, &retSize);
// close connection to msgfw daemon
if (libPath == NULL)
THROW(MsgException::INVALID_PARAM, "libPath NULL");
- void* libHandle = NULL;
+ void* libHandle = NULL;
libHandle = dlopen(libPath, RTLD_NOW);
void MsgGetVoiceMailOpt(MSG_SETTING_S *pSetting)
{
- char *tmpValue = NULL;
+ char *tmpValue = NULL;
- memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
+ memset(&(pSetting->option.voiceMailOpt), 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
- tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER);
- if (tmpValue != NULL) {
- strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN);
- free(tmpValue);
- tmpValue = NULL;
- }
+ tmpValue = MsgSettingGetString(VOICEMAIL_NUMBER);
+ if (tmpValue != NULL) {
+ strncpy(pSetting->option.voiceMailOpt.mailNumber, tmpValue, MAX_PHONE_NUMBER_LEN);
+ free(tmpValue);
+ tmpValue = NULL;
+ }
}
void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting)
{
- memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S));
+ memset(&(pSetting->option.msgSizeOpt), 0x00, sizeof(MSG_MSGSIZE_OPT_S));
- pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION);
+ pSetting->option.msgSizeOpt.nMsgSize = MsgSettingGetInt(MSGSIZE_OPTION);
}
msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting)
{
- msg_error_t err = MSG_SUCCESS;
+ msg_error_t err = MSG_SUCCESS;
- MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
+ MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE);
- // Get Setting Data from SIM
- if (plg != NULL)
- err = plg->setConfigData(pSetting);
- else
- err = MSG_ERR_NULL_POINTER;
+ // Get Setting Data from SIM
+ if (plg != NULL)
+ err = plg->setConfigData(pSetting);
+ else
+ err = MSG_ERR_NULL_POINTER;
- if (err != MSG_SUCCESS)
- {
- MSG_DEBUG("Error. Error code is %d.", err);
- return err;
- }
+ if (err != MSG_SUCCESS)
+ {
+ MSG_DEBUG("Error. Error code is %d.", err);
+ return err;
+ }
- return err;
+ return err;
}
static char* msg_clean_country_code(char *src)
// Add Filter
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, ?);",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, ?, 1);",
MSGFW_FILTER_TABLE_NAME, rowId, pFilter->filterType);
MSG_DEBUG("sql : %s", sqlQuery);
return MSG_ERR_NULL_POINTER;
}
- int rowCnt = 0, index = 3;
+ int rowCnt = 0, index = 4;
char sqlQuery[MAX_QUERY_LEN+1];
// Get filters from DB
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID, FILTER_TYPE, FILTER_VALUE FROM %s;", MSGFW_FILTER_TABLE_NAME);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID, FILTER_TYPE, FILTER_VALUE, FILTER_ACTIVE FROM %s;", MSGFW_FILTER_TABLE_NAME);
msg_error_t err = MSG_SUCCESS;
pFilter->filterType = dbHandle.getColumnToInt(index++);
memset(pFilter->filterValue, 0x00, sizeof(pFilter->filterValue));
dbHandle.getColumnToString(index++, MAX_FILTER_VALUE_LEN, pFilter->filterValue);
+ pFilter->bActive = dbHandle.getColumnToInt(index++);
}
return MSG_SUCCESS;
}
+
+
+msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive)
+{
+ MSG_BEGIN();
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ // Set Filter Activation
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET FILTER_ACTIVE = %d WHERE FILTER_ID = %d;",
+ MSGFW_FILTER_TABLE_NAME, bActive, filterId);
+
+ MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ return MSG_ERR_DB_EXEC;
+ }
+
+ MSG_END();
+
+ return MSG_SUCCESS;
+}
MSG_DATA TEXT , \
THUMB_PATH TEXT , \
MSG_TEXT TEXT , \
- DELIVERY_REPORT_STATUS INTEGER DEFAULT 0 , \
- DELIVERY_REPORT_TIME DATETIME , \
- READ_REPORT_STATUS INTEGER DEFAULT 0 , \
- READ_REPORT_TIME DATETIME , \
ATTACHMENT_COUNT INTEGER DEFAULT 0 , \
FOREIGN KEY(CONV_ID) REFERENCES %s (CONV_ID) , \
FOREIGN KEY(FOLDER_ID) REFERENCES %s (FOLDER_ID) );",
"CREATE TABLE %s ( \
FILTER_ID INTEGER PRIMARY KEY , \
FILTER_TYPE INTEGER NOT NULL , \
- FILTER_VALUE TEXT NOT NULL );",
+ FILTER_VALUE TEXT NOT NULL , \
+ FILTER_ACTIVE INTEGER DEFAULT 0);",
MSGFW_FILTER_TABLE_NAME);
err = dbHandle.execQuery(sqlQuery);
{
return MSG_SUCCESS;
}
+
+msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+ char sqlQuery[MAX_QUERY_LEN+1];
+ unsigned int rowId = 0;
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ // Check whether Same record exists or not.
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND (PKG_NAME LIKE '%s' OR SECURE = 1);",
+ MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName);
+
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_DEBUG("Query Failed [%s]", sqlQuery);
+ return MSG_ERR_DB_PREPARE;
+ }
+
+ if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
+ dbHandle.finalizeQuery();
+ return MSG_ERR_DB_ROW;
+ }
+ dbHandle.finalizeQuery();
+
+ dbHandle.beginTrans();
+ err = dbHandle.getRowId(MSGFW_PUSH_CONFIG_TABLE_NAME, &rowId);
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, ?, ?, ?, %d, 0, 0);",
+ MSGFW_PUSH_CONFIG_TABLE_NAME, rowId, pPushEvent->bLaunch);
+
+
+ MSG_DEBUG("QUERY : %s", sqlQuery);
+
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle.bindText(pPushEvent->contentType, 1);
+ dbHandle.bindText(pPushEvent->appId, 2);
+ dbHandle.bindText(pPushEvent->pkgName, 3);
+
+ if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) {
+ dbHandle.finalizeQuery();
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle.finalizeQuery();
+ dbHandle.endTrans(true);
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t MsgStoDeletePushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent)
+{
+ char sqlQuery[MAX_QUERY_LEN+1];
+ dbHandle.beginTrans();
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND PKG_NAME LIKE '%s';",
+ MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+ dbHandle.endTrans(true);
+ return MSG_SUCCESS;
+}
+
+msg_error_t MsgStoUpdatePushEvent(MSG_PUSH_EVENT_INFO_S* pSrc, MSG_PUSH_EVENT_INFO_S* pDst)
+{
+ char sqlQuery[MAX_QUERY_LEN+1];
+ dbHandle.beginTrans();
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONTENT_TYPE = ?, APP_ID = ?, PKG_NAME = ?, LAUNCH = %d WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND PKG_NAME LIKE '%s';",
+ MSGFW_PUSH_CONFIG_TABLE_NAME, pDst->bLaunch, pSrc->contentType, pSrc->appId, pSrc->pkgName);
+
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle.bindText(pDst->contentType, 1);
+ dbHandle.bindText(pDst->appId, 2);
+ dbHandle.bindText(pDst->pkgName, 3);
+
+ if (dbHandle.stepQuery() != MSG_ERR_DB_DONE) {
+ dbHandle.finalizeQuery();
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle.finalizeQuery();
+ dbHandle.endTrans(true);
+
+ return MSG_SUCCESS;
+}
// Add Message
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, 0, 0, 0);",
MSGFW_MESSAGE_TABLE_NAME, rowId, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType,
pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction,
- 0, pMsg->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+ 0, pMsg->bBackup);
MSG_DEBUG("QUERY : %s", sqlQuery);
MMS_MESSAGE_DATA_S mmsMsg;
memset(&mmsMsg, 0x00, sizeof(MMS_MESSAGE_DATA_S));
- if (pMsg->dataSize == 0) {
- MSG_DEBUG("pMsg->dataSize == 0, So Making emtpy MMS body.");
- char * tempMmsBody = _MsgMmsSerializeMessageData(&mmsMsg, &(pMsg->dataSize));
- memcpy(&pMsg->msgText, tempMmsBody, pMsg->dataSize);
- free(tempMmsBody);
- }
-
if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) {
MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE);
- //pMsg->msgId = pMsg->refernceId;
-
err = plg->addMessage(pMsg, pSendOptInfo, pFileData);
if (err != MSG_SUCCESS)
} else if (msgType.mainType == MSG_MMS_TYPE) {
char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
- char thumbnailpath[MSG_FILEPATH_LEN_MAX] = {0,};
char dirPath[MSG_FILEPATH_LEN_MAX]= {0,};
memset(sqlQuery, 0x00, sizeof(sqlQuery));
rmdir(dirPath);
- // remove thumbnail file
- char *fileName = NULL;
- fileName = strrchr(filePath, '/');
-
- snprintf(thumbnailpath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", fileName+1);
- if(remove(thumbnailpath) == -1)
- MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailpath);
- else
- MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailpath);
-
} else {
MSG_DEBUG("MsgStepQuery() Error [%s]", sqlQuery);
dbHandle.finalizeQuery();
dbHandle.finalizeQuery();
+ // remove thumbnail file
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT VALUE FROM %s "
+ "WHERE MSG_ID = %d AND (TYPE=%d OR TYPE=%d);",
+ MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO);
+
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_PREPARE;
+ }
+
+ while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
+ memset(filePath, 0x00, sizeof(filePath));
+ strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX);
+ if (remove(filePath) == -1)
+ MSG_DEBUG("Fail to delete file [%s]", filePath);
+ else
+ MSG_DEBUG("Success to delete file [%s]", filePath);
+ }
+
+ dbHandle.finalizeQuery();
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+ MSGFW_MMS_PREVIEW_TABLE_NAME, msgId);
+
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
dbHandle.endTrans(false);
return MSG_ERR_DB_EXEC;
}
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
+ MSGFW_REPORT_TABLE_NAME, msgId);
+
+ // Delete Data from MMS STATUS table
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
}
memset(sqlQuery, 0x00, sizeof(sqlQuery));
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_MESSAGE_TABLE_NAME};
+ MMS_PLUGIN_MESSAGE_TABLE_NAME, MSGFW_MMS_PREVIEW_TABLE_NAME,
+ MSGFW_REPORT_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME};
int listCnt = sizeof(tableList)/sizeof(char *);
int rowCnt = 0;
char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
char dirPath[MSG_FILEPATH_LEN_MAX] = {0,};
- char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
//get mms msg id list
memset(sqlQuery, 0x00, sizeof(sqlQuery));
MsgRmRf(dirPath);
rmdir(dirPath);
- // delete thumbnail
- char *fileName = NULL;
- fileName = strrchr(filePath, '/');
+ }
- snprintf(thumbnailPath, sizeof(thumbnailPath), MSG_THUMBNAIL_PATH"%s.jpg", fileName+1);
+ dbHandle.freeTable();
+ }
- if (remove(thumbnailPath) == -1)
- MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailPath);
- else
- MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailPath);
+ // delete thumbnail
+ char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT VALUE FROM %s "
+ "WHERE (TYPE=%d OR TYPE=%d) "
+ "AND (MSG_ID IN (SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d));",
+ MSGFW_MMS_PREVIEW_TABLE_NAME, MSG_MMS_ITEM_TYPE_IMG, MSG_MMS_ITEM_TYPE_VIDEO, MSGFW_MESSAGE_TABLE_NAME, folderId);
- }
+ if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return MSG_ERR_DB_PREPARE;
+ }
- dbHandle.freeTable();
+ while (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
+ memset(filePath, 0x00, sizeof(filePath));
+ strncpy(filePath, (char *)dbHandle.columnText(0), MSG_FILEPATH_LEN_MAX);
+ if (remove(filePath) == -1)
+ MSG_DEBUG("Fail to delete file [%s]", filePath);
+ else
+ MSG_DEBUG("Success to delete file [%s]", filePath);
}
+ dbHandle.finalizeQuery();
+
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN \
}
+msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList)
+{
+ MSG_BEGIN();
+ msg_error_t err = MSG_SUCCESS;
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+ char whereQuery[MAX_QUERY_LEN+1];
+ char sqlQuerySubset[(MAX_QUERY_LEN/5)+1];
+
+ queue<msg_thread_id_t> threadList;
+
+ 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_MESSAGE_TABLE_NAME};
+
+ int listCnt = sizeof(tableList)/sizeof(char *);
+ int rowCnt = 0;
+
+ memset(whereQuery, 0x00, sizeof(whereQuery));
+
+ if (pMsgIdList->nCount < 1) {
+ return MSG_SUCCESS;
+ } else {
+ for (int i=0; i < pMsgIdList->nCount; i++) {
+ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset));
+ if (i==0)
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "(MSG_ID = %d ", pMsgIdList->msgIdList[i]);
+ else
+ snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "OR MSG_ID = %d ", pMsgIdList->msgIdList[i]);
+ strncat(whereQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(whereQuery));
+ }
+ }
+ strncat(whereQuery, ");", MAX_QUERY_LEN-strlen(whereQuery));
+
+ // Get conversation ID from Folder
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE ", MSGFW_MESSAGE_TABLE_NAME);
+ strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+ err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ MSG_DEBUG("sql query is %s.", sqlQuery);
+ dbHandle.freeTable();
+ return err;
+ }
+
+ if (rowCnt <= 0) {
+ dbHandle.freeTable();
+ return MSG_SUCCESS;
+ }
+
+ for (int i = 1; i <= rowCnt; i++) {
+ MSG_DEBUG("thread ID : %d", dbHandle.getColumnToInt(i));
+ threadList.push((msg_thread_id_t)dbHandle.getColumnToInt(i));
+ }
+
+ dbHandle.freeTable();
+
+ /*** Delete Sim Message In Folder **/
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE STORAGE_ID = %d AND ", MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM);
+ strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+ rowCnt = 0;
+
+ err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ MSG_DEBUG("sql query is %s.", sqlQuery);
+ dbHandle.freeTable();
+ return err;
+ }
+
+ for (int i = 1; i <= rowCnt; i++) {
+ err = MsgStoDeleteMessage(dbHandle.getColumnToInt(i), false);
+
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("MsgStoDeleteMessage() Error!!!");
+ dbHandle.freeTable();
+ return err;
+ }
+ }
+
+ dbHandle.freeTable();
+ /*** **/
+
+ dbHandle.beginTrans();
+
+ for (int i = 0; i < listCnt; i++) {
+ if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) {
+
+ int rowCnt = 0;
+
+ char filePath[MSG_FILEPATH_LEN_MAX] = {0,};
+ char dirPath[MSG_FILEPATH_LEN_MAX] = {0,};
+ char thumbnailPath[MSG_FILEPATH_LEN_MAX] = {0,};
+
+ //get mms msg id list
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE ", MMS_PLUGIN_MESSAGE_TABLE_NAME);
+ strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+ err = dbHandle.getTable(sqlQuery, &rowCnt);
+ MSG_DEBUG("rowCnt %d", rowCnt);
+
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+ dbHandle.freeTable();
+ dbHandle.endTrans(false);
+ return err;
+ }
+
+ for (int i = 1; i <= rowCnt; i++) {
+ memset(filePath, 0x00, sizeof(filePath));
+ dbHandle.getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath);
+
+ MSG_DEBUG("filePath [%s]", filePath);
+
+ //delete raw file
+ snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath);
+
+ if (remove(filePath) == -1)
+ MSG_DEBUG("Fail to delete file [%s]", filePath);
+ else
+ MSG_DEBUG("Success to delete file [%s]", filePath);
+
+ MsgRmRf(dirPath);
+
+ rmdir(dirPath);
+ // delete thumbnail
+
+ char *fileName = NULL;
+ fileName = strrchr(filePath, '/');
+
+ snprintf(thumbnailPath, sizeof(thumbnailPath), MSG_THUMBNAIL_PATH"%s.jpg", fileName+1);
+
+ if (remove(thumbnailPath) == -1)
+ MSG_DEBUG("Fail to delete thumbnail [%s]", thumbnailPath);
+ else
+ MSG_DEBUG("Success to delete thumbnail [%s]", thumbnailPath);
+ }
+
+ dbHandle.freeTable();
+ }
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE ", tableList[i]);
+ strncat(sqlQuery, whereQuery, MAX_QUERY_LEN-strlen(sqlQuery));
+
+ // Delete Message in specific folder from table
+ err = dbHandle.execQuery(sqlQuery);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+ dbHandle.endTrans(false);
+ return err;
+ }
+ }
+
+ // Clear Conversation table
+ err = MsgStoClearConversationTable(&dbHandle);
+ if (err != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return err;
+ }
+
+ // Update Address
+ while (!threadList.empty()) {
+ err = MsgStoUpdateConversation(&dbHandle, threadList.front());
+
+ threadList.pop();
+
+ if (err != MSG_SUCCESS) {
+ dbHandle.endTrans(false);
+ return err;
+ }
+ }
+
+ dbHandle.endTrans(true);
+
+ int smsCnt = 0;
+ int mmsCnt = 0;
+
+ smsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_SMS_TYPE);
+ mmsCnt = MsgStoGetUnreadCnt(&dbHandle, MSG_MMS_TYPE);
+
+ MsgSettingSetIndicator(smsCnt, mmsCnt);
+
+/*** Create thread for noti and phone log delete. **/
+ if (pMsgIdList->nCount > 0) {
+ msg_id_list_s *pToDeleteMsgIdList = NULL;
+ pToDeleteMsgIdList = (msg_id_list_s *)new char[sizeof(msg_id_list_s)];
+ memset(pToDeleteMsgIdList, 0x00, sizeof(msg_id_list_s));
+ pToDeleteMsgIdList->nCount = pMsgIdList->nCount;
+ pToDeleteMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pMsgIdList->nCount];
+ memcpy(pToDeleteMsgIdList->msgIdList, pMsgIdList->msgIdList, sizeof(msg_message_id_t)*pMsgIdList->nCount);
+
+ msg_id_list_s *pToDeleteMsgIdListCpy = NULL;
+ pToDeleteMsgIdListCpy = (msg_id_list_s *)new char[sizeof(msg_id_list_s)];
+ memset(pToDeleteMsgIdListCpy, 0x00, sizeof(msg_id_list_s));
+ pToDeleteMsgIdListCpy->nCount = pMsgIdList->nCount;
+ pToDeleteMsgIdListCpy->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pMsgIdList->nCount];
+ memcpy(pToDeleteMsgIdListCpy->msgIdList, pMsgIdList->msgIdList, sizeof(msg_message_id_t)*pMsgIdList->nCount);
+
+ if (g_idle_add(startToDeleteNoti, (void *)pToDeleteMsgIdList) == 0) {
+ MSG_DEBUG("startToDeleteNoti not invoked: %s", strerror(errno));
+ // memory free
+ if (pToDeleteMsgIdList != NULL) {
+ //free peer info list
+ if (pToDeleteMsgIdList->msgIdList != NULL)
+ delete [] pToDeleteMsgIdList->msgIdList;
+
+ delete [] pToDeleteMsgIdList;
+ }
+ err = MSG_ERR_UNKNOWN;
+ }
+
+ if (g_idle_add(startToDeletePhoneLog, (void *)pToDeleteMsgIdListCpy) == 0) {
+ MSG_DEBUG("startToDeletePhoneLog not invoked: %s", strerror(errno));
+ // memory free
+ if (pToDeleteMsgIdListCpy != NULL) {
+ //free peer info list
+ if (pToDeleteMsgIdListCpy->msgIdList != NULL)
+ delete [] pToDeleteMsgIdListCpy->msgIdList;
+
+ delete [] pToDeleteMsgIdListCpy;
+ }
+ err = MSG_ERR_UNKNOWN;
+ }
+ }
+/*** **/
+
+ MSG_END();
+ return MSG_SUCCESS;
+}
+
+
msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t msgId, msg_folder_id_t destFolderId)
{
MSG_MESSAGE_TYPE_S msgType;
pThreadViewList->msg_struct_info = NULL;
int rowCnt = 0;
- int index = 10; // numbers of index
+ int index = 11; // numbers of index
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID, UNREAD_CNT, SMS_CNT, MMS_CNT, \
- MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, DISPLAY_NAME, MSG_TEXT \
- FROM %s WHERE SMS_CNT > 0 OR MMS_CNT > 0 ORDER BY DISPLAY_TIME DESC;",
- MSGFW_CONVERSATION_TABLE_NAME);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \
+ A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, \
+ (SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED \
+ FROM %s A WHERE A.SMS_CNT > 0 OR A.MMS_CNT > 0 ORDER BY A.DISPLAY_TIME DESC;",
+ MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME);
msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
memset(pTmp->threadData, 0x00, sizeof(pTmp->threadData));
dbHandle.getColumnToString(index++, MAX_THREAD_DATA_LEN, pTmp->threadData);
+
+ int protectedCnt = dbHandle.getColumnToInt(index++);
+ if (protectedCnt > 0)
+ pTmp->bProtected = true;
}
dbHandle.freeTable();
return MSG_SUCCESS;
}
+msg_error_t MsgStoGetConversationPreview(MSG_CONVERSATION_VIEW_S *pConv)
+{
+ MsgDbHandler dbHandleForInner;
+ char sqlQuery[MAX_QUERY_LEN + 1];
+ int rowCnt;
+ int index = 3;
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ if (pConv == NULL)
+ return MSG_ERR_NULL_POINTER;
+
+ //(MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER)
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT TYPE, VALUE, COUNT "
+ "FROM %s WHERE MSG_ID=%d;",
+ MSGFW_MMS_PREVIEW_TABLE_NAME, pConv->msgId);
+
+ MSG_DEBUG("QUERY : [%s]", sqlQuery);
+
+ msg_error_t err = dbHandleForInner.getTable(sqlQuery, &rowCnt);
+ if (err == MSG_SUCCESS) {
+ for (int i = 0; i < rowCnt; i++) {
+ int type = dbHandleForInner.getColumnToInt(index++);
+ if (type == MSG_MMS_ITEM_TYPE_IMG) {
+ dbHandleForInner.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pConv->imageThumbPath);
+ dbHandleForInner.getColumnToInt(index++);
+ } else if (type == MSG_MMS_ITEM_TYPE_VIDEO) {
+ dbHandleForInner.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pConv->videoThumbPath);
+ dbHandleForInner.getColumnToInt(index++);
+ } else if (type == MSG_MMS_ITEM_TYPE_AUDIO) {
+ dbHandleForInner.getColumnToString(index++, MSG_FILENAME_LEN_MAX, pConv->audioFileName);
+ dbHandleForInner.getColumnToInt(index++);
+ } else if (type == MSG_MMS_ITEM_TYPE_ATTACH) {
+ dbHandleForInner.getColumnToString(index++, MSG_FILENAME_LEN_MAX, pConv->attachFileName);
+ dbHandleForInner.getColumnToInt(index++);
+ } else if (type == MSG_MMS_ITEM_TYPE_PAGE) {
+ index++;
+ pConv->pageCount = dbHandleForInner.getColumnToInt(index++);
+ } else {
+ MSG_DEBUG("Unknown item type [%d]", type);
+ index+=2;
+ }
+ }
+ }
+
+ dbHandleForInner.freeTable();
+ return MSG_SUCCESS;
+}
+
+msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv)
+{
+ int rowCnt = 0;
+ int index = 16; /** numbers of index */
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
+ DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
+ MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \
+ FROM %s WHERE MSG_ID=%d;",
+ MSGFW_MESSAGE_TABLE_NAME, msgId);
+
+ msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+ if (err == MSG_ERR_DB_NORECORD) {
+ dbHandle.freeTable();
+ return MSG_SUCCESS;
+ } else if (err != MSG_SUCCESS) {
+ MSG_DEBUG("%s", sqlQuery);
+ dbHandle.freeTable();
+ return err;
+ }
+
+ memset(pConv, 0x00, sizeof(MSG_CONVERSATION_VIEW_S));
+ pConv->pText = NULL;
+
+ pConv->msgId = dbHandle.getColumnToInt(index++);
+ pConv->threadId = dbHandle.getColumnToInt(index++);
+ pConv->folderId = dbHandle.getColumnToInt(index++);
+ pConv->storageId = dbHandle.getColumnToInt(index++);
+ pConv->mainType = dbHandle.getColumnToInt(index++);
+ pConv->subType = dbHandle.getColumnToInt(index++);
+ pConv->displayTime = (time_t)dbHandle.getColumnToInt(index++);
+ pConv->textSize = dbHandle.getColumnToInt(index++);
+ pConv->networkStatus = dbHandle.getColumnToInt(index++);
+ pConv->bRead = dbHandle.getColumnToInt(index++);
+ pConv->bProtected = dbHandle.getColumnToInt(index++);
+ pConv->direction = dbHandle.getColumnToInt(index++);
+ pConv->scheduledTime = (time_t)dbHandle.getColumnToInt(index++);
+
+ dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pConv->subject);
+
+ if (pConv->mainType == MSG_MMS_TYPE &&
+ (pConv->networkStatus == MSG_NETWORK_RETRIEVING || pConv->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pConv->subType == MSG_NOTIFICATIONIND_MMS)) {
+ pConv->pText = NULL;
+ pConv->textSize = 0;
+ index++;
+ } else {
+ if (pConv->mainType == MSG_SMS_TYPE) {
+ pConv->pText = new char[pConv->textSize+2];
+ memset(pConv->pText, 0x00, pConv->textSize+2);
+ dbHandle.getColumnToString(index++, pConv->textSize+1, pConv->pText);
+ } else {
+ char tmpMmsText[MAX_MMS_TEXT_LEN+1];
+ memset(tmpMmsText, 0x00, MAX_MMS_TEXT_LEN+1);
+
+ dbHandle.getColumnToString(index++, MAX_MMS_TEXT_LEN, tmpMmsText);
+
+ pConv->textSize = strlen(tmpMmsText);
+
+ pConv->pText = new char[pConv->textSize+2];
+ memset(pConv->pText, 0x00, pConv->textSize+2);
+
+ strncpy(pConv->pText, tmpMmsText, pConv->textSize+1);
+
+ MsgStoGetConversationPreview(pConv);
+ }
+ }
+
+ pConv->attachCount = dbHandle.getColumnToInt(index++);
+
+ MSG_END();
+
+ return MSG_SUCCESS;
+}
msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_list_s *pConvViewList)
{
pConvViewList->msg_struct_info = NULL;
int rowCnt = 0;
- int index = 19; /** numbers of index */
- int order = 0;
+ int index = 16; /** numbers of index */
char sqlQuery[MAX_QUERY_LEN+1];
- // get address information.
- order = MsgGetContactNameOrder();
-
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \
- DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, BACKUP, PRIORITY, \
- MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, THUMB_PATH \
- FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d ORDER BY DISPLAY_TIME, MSG_ID ASC;",
- MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID);
+ DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \
+ MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT \
+ FROM %s WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME, MSG_ID ASC;",
+ MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
MSG_DEBUG("pConvViewList->nCount [%d]", pConvViewList->nCount);
pConvViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt];
+ memset(pConvViewList->msg_struct_info, 0x00, sizeof(msg_struct_t) * rowCnt);
- msg_struct_s *msg = NULL;
- MSG_MESSAGE_HIDDEN_S *pTmp = NULL;
+ msg_struct_s *conv = NULL;
+ MSG_CONVERSATION_VIEW_S *pTmp = NULL;
for (int i = 0; i < rowCnt; i++) {
pConvViewList->msg_struct_info[i] = (msg_struct_t)new char[sizeof(msg_struct_s)];;
+ memset(pConvViewList->msg_struct_info[i], 0x00, sizeof(msg_struct_s));
- msg = (msg_struct_s *)pConvViewList->msg_struct_info[i];
+ conv = (msg_struct_s *)pConvViewList->msg_struct_info[i];
- msg->type = MSG_STRUCT_MESSAGE_INFO;
- msg->data = new char[sizeof(MSG_MESSAGE_HIDDEN_S)];
+ conv->type = MSG_STRUCT_CONV_INFO;
+ conv->data = new char[sizeof(MSG_CONVERSATION_VIEW_S)];
+ memset(conv->data, 0x00, sizeof(MSG_CONVERSATION_VIEW_S));
- pTmp = (MSG_MESSAGE_HIDDEN_S *)msg->data;
+ pTmp = (MSG_CONVERSATION_VIEW_S *)conv->data;
- pTmp->pData = NULL;
- pTmp->pMmsData = NULL;
+ pTmp->pText = NULL;
pTmp->msgId = dbHandle.getColumnToInt(index++);
pTmp->threadId = dbHandle.getColumnToInt(index++);
pTmp->mainType = dbHandle.getColumnToInt(index++);
pTmp->subType = dbHandle.getColumnToInt(index++);
pTmp->displayTime = (time_t)dbHandle.getColumnToInt(index++);
- pTmp->dataSize = dbHandle.getColumnToInt(index++);
+ pTmp->textSize = dbHandle.getColumnToInt(index++);
pTmp->networkStatus = dbHandle.getColumnToInt(index++);
pTmp->bRead = dbHandle.getColumnToInt(index++);
pTmp->bProtected = dbHandle.getColumnToInt(index++);
- pTmp->bBackup = dbHandle.getColumnToInt(index++);
- pTmp->priority = dbHandle.getColumnToInt(index++);
pTmp->direction = dbHandle.getColumnToInt(index++);
index++; // This field is reserved.
if (pTmp->mainType == MSG_MMS_TYPE &&
(pTmp->networkStatus == MSG_NETWORK_RETRIEVING || pTmp->networkStatus == MSG_NETWORK_RETRIEVE_FAIL || pTmp->subType == MSG_NOTIFICATIONIND_MMS)) {
- pTmp->pData = NULL;
+ pTmp->pText = NULL;
+ pTmp->textSize = 0;
index++;
} else {
- pTmp->pData = (void *)new char[pTmp->dataSize+2];
- memset(pTmp->pData, 0x00, pTmp->dataSize+2);
+ if (pTmp->mainType == MSG_SMS_TYPE) {
+ pTmp->pText = new char[pTmp->textSize+2];
+ memset(pTmp->pText, 0x00, pTmp->textSize+2);
+ dbHandle.getColumnToString(index++, pTmp->textSize+1, pTmp->pText);
+ } else {
+ char tmpMmsText[MAX_MMS_TEXT_LEN+1];
+ memset(tmpMmsText, 0x00, MAX_MMS_TEXT_LEN+1);
- dbHandle.getColumnToString(index++, pTmp->dataSize+1, (char *)pTmp->pData);
- }
+ dbHandle.getColumnToString(index++, MAX_MMS_TEXT_LEN, tmpMmsText);
- pTmp->attachCount = dbHandle.getColumnToInt(index++);
+ pTmp->textSize = strlen(tmpMmsText);
- dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath);
+ pTmp->pText = new char[pTmp->textSize+2];
+ memset(pTmp->pText, 0x00, pTmp->textSize+2);
- // set address list handle.
- msg_struct_list_s *addrlist = (msg_struct_list_s *)new msg_struct_list_s;
- memset(addrlist, 0x00, sizeof(msg_struct_list_s));
- MsgDbHandler dbHandleForInner;
- MsgStoGetAddressByConvId(&dbHandleForInner, threadId, order, addrlist);
+ strncpy(pTmp->pText, tmpMmsText, pTmp->textSize+1);
+ }
+ }
- pTmp->addr_list = addrlist;
+ pTmp->attachCount = dbHandle.getColumnToInt(index++);
+ MsgStoGetConversationPreview(pTmp);
}
dbHandle.freeTable();
}
-msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, msg_id_list_s *pMsgIdList)
+msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t threadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList)
{
msg_error_t err = MSG_SUCCESS;
+#if 1
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ /*** Get msg id list **/
+ int rowCnt = 0;
+ int index = 1;
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ if (bIncludeProtect) {
+ 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, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
+ } else {
+ 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 AND PROTECTED = 0;",
+ MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
+ }
+
+ err = dbHandle.getTable(sqlQuery, &rowCnt);
+
+ if (err != MSG_SUCCESS && err != MSG_ERR_DB_NORECORD) {
+ MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+ dbHandle.freeTable();
+ }
+
+ if (rowCnt <= 0) {
+ dbHandle.freeTable();
+ err = MSG_SUCCESS;
+ }
+
+ pMsgIdList->nCount = rowCnt;
+
+ MSG_DEBUG("pMsgIdList->nCount [%d]", pMsgIdList->nCount);
+
+ pMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t) * rowCnt];
+
+ for (int i = 0; i < rowCnt; i++)
+ pMsgIdList->msgIdList[i] = dbHandle.getColumnToInt(index++);
+
+ dbHandle.freeTable();
+ /*** **/
+
+ err = MsgStoDeleteMessageByList(pMsgIdList);
+
+#else
char sqlQuery[MAX_QUERY_LEN+1];
/*** Get msg id list **/
msg_id_list_s *pToDeleteMsgIdList = NULL;
memset(pToDeleteMsgIdList, 0x00, sizeof(msg_id_list_s));
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE CONV_ID = %d", MSGFW_MESSAGE_TABLE_NAME, threadId);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID FROM %s WHERE CONV_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, threadId);
err = dbHandle.getTable(sqlQuery, &rowCnt);
delete [] pToDeleteMsgIdList;
pToDeleteMsgIdList = NULL;
}
+#endif
return err;
}
return MSG_SUCCESS;
}
-
-msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, MSG_REPORT_STATUS_INFO_S *pReportStatus)
+msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus)
{
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ //MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME)
+ //select * from MSG_REPORT_TABLE where MSG_ID=38 order by ADDRESS_VAL DESC, STATUS_TYPE ASC;
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT ADDRESS_VAL, STATUS_TYPE, STATUS, TIME "
+ "FROM %s "
+ "WHERE MSG_ID = %d "
+ "order by ADDRESS_VAL DESC, STATUS_TYPE ASC;"
+ , MSGFW_REPORT_TABLE_NAME, msgId);
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DELIVERY_REPORT_STATUS, \
- DELIVERY_REPORT_TIME, READ_REPORT_STATUS, READ_REPORT_TIME \
- FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId);
+ int rowCnt;
+ msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
+ if (err != MSG_SUCCESS) {
+ MSG_DEBUG("%s", sqlQuery);
+ dbHandle.freeTable();
+ return err;
+ }
- if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
- return MSG_ERR_DB_PREPARE;
+ int index = 4;
- if (dbHandle.stepQuery() == MSG_ERR_DB_ROW) {
- pReportStatus->deliveryStatus = (msg_delivery_report_status_t)dbHandle.columnInt(0);
- pReportStatus->deliveryStatusTime = (time_t)dbHandle.columnInt(1);
- pReportStatus->readStatus = (msg_read_report_status_t)dbHandle.columnInt(2);
- pReportStatus->readStatusTime = (time_t)dbHandle.columnInt(3);
+ *count = rowCnt;
+ MSG_REPORT_STATUS_INFO_S *report_status = (MSG_REPORT_STATUS_INFO_S*)new char[sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt];
+ memset(report_status, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)*rowCnt);
+
+ for (int i = 0; i < rowCnt; i++) {
+ dbHandle.getColumnToString(index++, MAX_ADDRESS_VAL_LEN, report_status[i].addressVal);
+ report_status[i].type = dbHandle.getColumnToInt(index++);
+ report_status[i].status = dbHandle.getColumnToInt(index++);
+ report_status[i].statusTime = (time_t)dbHandle.getColumnToInt(index++);
+
+ MSG_DEBUG("(%d/%d) addr = %s, report_type = %d, report_status = %d, report_time = %d", i, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime );
}
- dbHandle.finalizeQuery();
+ *pReportStatus = report_status;
return MSG_SUCCESS;
}
MSG_BEGIN();
int rowCnt;
- int index = 10; // numbers of index
+ int index = 11; // numbers of index
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CONV_ID, UNREAD_CNT, SMS_CNT, MMS_CNT, \
- MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, DISPLAY_NAME, MSG_TEXT \
- FROM %s WHERE CONV_ID = %d;",
- MSGFW_CONVERSATION_TABLE_NAME, threadId);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, \
+ A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.DISPLAY_NAME, A.MSG_TEXT, \
+ (SELECT COUNT(*) FROM %s B WHERE B.CONV_ID = A.CONV_ID AND B.PROTECTED = 1) AS PROTECTED \
+ FROM %s A WHERE A.CONV_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, MSGFW_CONVERSATION_TABLE_NAME, threadId);
msg_error_t err = dbHandle.getTable(sqlQuery, &rowCnt);
}
} else if (pMsg->msgType.subType == MSG_SENDREQ_MMS) {
snprintf(sqlQuery, sizeof(sqlQuery),
- "UPDATE %s SET MSG_DATA = '%s', MSG_TEXT = ?, THUMB_PATH = '%s' WHERE MSG_ID = %d;",
- MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->msgId);
+ "UPDATE %s SET MSG_DATA = '%s', MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, pMsg->msgData, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId);
if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS) {
dbHandle.endTrans(false);
#include "MsgUtilStorage.h"
#include "MsgStorageHandler.h"
-
/*==================================================================================================
VARIABLES
==================================================================================================*/
#include "MsgDebug.h"
#include "MsgUtilFile.h"
+#include "MsgUtilStorage.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
#include "MsgPluginManager.h"
#include "MsgSubmitHandler.h"
+extern MsgDbHandler dbHandle;
+
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
if(!plg)
{
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
MSG_DEBUG("No Plugin for %d type", msgMainType);
return MSG_ERR_INVALID_PLUGIN_HANDLE;
if(err != MSG_SUCCESS)
{
MSG_DEBUG("Update Network Status : [%d]", err);
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL);
}
return err;
pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID;
err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo));
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
} else {
//new message case
MSG_DEBUG("New Message");
}
else if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS)
{
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus);
}
/* reject_msg_support */
if(simStatus == MSG_SIM_STATUS_NOT_FOUND)
{
MSG_DEBUG("SIM is not present...");
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
return MSG_ERR_NO_SIM;
}
if (err != MSG_SUCCESS)
{
if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS )
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL);
else
- MsgStoUpdateNetworkStatus(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+ MsgStoUpdateNetworkStatus(&dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
}
}
+int MsgSetFilterActivationHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ int eventSize = 0;
+
+ // Get Filter Structure
+ msg_filter_id_t *pFilterId = (msg_filter_id_t *)pCmd->cmdData;
+
+ bool setFlag = false;
+
+ memcpy(&setFlag, pCmd->cmdData+sizeof(msg_filter_id_t), sizeof(bool));
+
+ MSG_DEBUG("Filter id : %d", *pFilterId);
+
+ // Delete Filter
+ err = MsgStoSetFilterActivation(*pFilterId, setFlag);
+
+ if (err == MSG_SUCCESS)
+ {
+ MSG_DEBUG("Command Handle Success : MsgStoSetFilterActivation()");
+ }
+ else
+ {
+ MSG_DEBUG("Command Handle Fail : MsgStoSetFilterActivation()");
+ }
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SET_FILTER_ACTIVATION, err, (void**)ppEvent);
+
+ return eventSize;
+}
+
+
int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
{
msg_error_t err = MSG_SUCCESS;
}
+int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ int eventSize = 0;
+
+ msg_id_list_s msgIdList;
+ memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
+
+ msgIdList.nCount = *((int *)pCmd->cmdData);
+
+ MSG_DEBUG("msgIdList.nCount [%d]", msgIdList.nCount);
+
+ msg_message_id_t msgIds[msgIdList.nCount];
+ memset(msgIds, 0x00, sizeof(msgIds));
+
+ msgIdList.msgIdList = msgIds;
+
+ for (int i=0; i<msgIdList.nCount; i++) {
+ msgIds[i] = *(msg_message_id_t *)(((char*)pCmd->cmdData) + (sizeof(int)*(i+1)));
+ }
+
+ // Delete Message
+ err = MsgStoDeleteMessageByList(&msgIdList);
+
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("Command Handle Success : MsgStoDeleteMessageByList()");
+ MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_DELETE, &msgIdList);
+ } else {
+ MSG_DEBUG("Command Handle Fail : MsgStoDeleteMessageByList()");
+ }
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_MESSAGE_BY_LIST, err, (void**)ppEvent);
+
+ return eventSize;
+}
+
+
int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent)
{
msg_error_t err = MSG_SUCCESS;
msg_error_t err = MSG_SUCCESS;
msg_thread_id_t threadId;
+ bool bIncludeProtect = false;
bool isSyncMLMsg = false;
memcpy(&threadId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_thread_id_t));
+ memcpy(&bIncludeProtect, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), sizeof(bool));
int eventSize = 0;
msg_id_list_s msgIdList;
memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
- err = MsgStoDeleteThreadMessageList(threadId, &msgIdList);
+ err = MsgStoDeleteThreadMessageList(threadId, bIncludeProtect, &msgIdList);
if (err == MSG_SUCCESS) {
MSG_DEBUG("Command Handle Success : MsgStoDeleteThreadMessageList()");
else
{
MSG_DEBUG("Command Handle Fail : MsgStoDeleteThreadMessageList()");
+ if(msgIdList.msgIdList != NULL)
+ delete [] (char*)msgIdList.msgIdList;
}
// Make Event Data
int dataSize = 0, eventSize = 0;
- MSG_REPORT_STATUS_INFO_S reportStatus;
-
- memset(&reportStatus, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S));
+ MSG_REPORT_STATUS_INFO_S *reportStatus = NULL;
+ int report_count = 0;
- err = MsgStoGetReportStatus(*msgId, &reportStatus);
+ err = MsgStoGetReportStatus(*msgId, &report_count, &reportStatus);
if (err == MSG_SUCCESS)
{
MSG_DEBUG("Command Handle Success : MsgGetReportStatusHandler()");
// Encoding Report Status Data
- dataSize = MsgEncodeReportStatus(&reportStatus, &encodedData);
+ dataSize = MsgEncodeReportStatus(reportStatus, report_count, &encodedData);
}
else
{
return eventSize;
}
+
+int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ int eventSize = 0;
+
+ // Get Message Info
+ MSG_PUSH_EVENT_INFO_S* pPushEvent = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
+
+ // Add Message
+ err = MsgStoAddPushEvent(pPushEvent);
+
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("Command Handle Success : MsgStoAddPushEvent()");
+ } else {
+ MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()");
+ }
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_PUSH_EVENT, err, (void**)ppEvent);
+
+ return eventSize;
+}
+
+int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ int eventSize = 0;
+
+ // Get Message Info
+ MSG_PUSH_EVENT_INFO_S* pPushEvent = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
+
+ // Add Message
+ err = MsgStoDeletePushEvent(pPushEvent);
+
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("Command Handle Success : MsgStoDeletePushEvent()");
+ } else {
+ MSG_DEBUG("Command Handle Fail : MsgStoDeletePushEvent()");
+ }
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_PUSH_EVENT, err, (void**)ppEvent);
+
+ return eventSize;
+}
+
+int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+
+ int eventSize = 0;
+
+ // Get Message Info
+ MSG_PUSH_EVENT_INFO_S* pSrc = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData;
+ MSG_PUSH_EVENT_INFO_S* pDst = (MSG_PUSH_EVENT_INFO_S*)(pCmd->cmdData + sizeof(MSG_PUSH_EVENT_INFO_S));
+
+ // Add Message
+ err = MsgStoUpdatePushEvent(pSrc, pDst);
+
+ if (err == MSG_SUCCESS) {
+ MSG_DEBUG("Command Handle Success : MsgStoUpdatePushEvent()");
+ } else {
+ MSG_DEBUG("Command Handle Fail : MsgStoUpdatePushEvent()");
+ }
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_PUSH_EVENT, err, (void**)ppEvent);
+
+ return eventSize;
+}
return eventSize;
}
+int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ // input check
+ if( !pCmd || !ppEvent)
+ THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+ // Get Message Request
+ MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S*) pCmd->cmdData;
+ MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId);
+
+ // storing dst fd in list
+ MsgTransactionManager::instance()->setPushMsgCB(pCmdData);
+
+ // Make Event Data
+ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_PUSH_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
+
+ return eventSize;
+}
+
+int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ // input check
+ if( !pCmd || !ppEvent)
+ THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+ // Get Message Request
+ MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_CB_MSG_CB_S*) pCmd->cmdData;
+ MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d", pCmdData->listenerFd, pCmdData->msgType);
+
+ // storing dst fd in list
+ MsgTransactionManager::instance()->setCBMsgCB(pCmdData);
+
+ // Make Event Data
+ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_CB_MSG_CB, MSG_SUCCESS, (void**)ppEvent);
+
+ return eventSize;
+}
+
int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent)
{
return eventsize;
}
+int MsgIncomingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ MSG_BEGIN();
+ // input check
+ if (!pCmd || !ppEvent)
+ THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+ MSG_PUSH_MESSAGE_DATA_S pushData;
+ memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+ // Get Incoming Message
+ memcpy(&pushData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_PUSH_MESSAGE_DATA_S));
+
+ int eventSize = 0;
+
+ // broadcast to listener threads, here
+ MsgTransactionManager::instance()->broadcastPushMsgCB(MSG_SUCCESS, &pushData);
+
+ // Make Event Data
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, MSG_SUCCESS, (void**)ppEvent);
+
+ MSG_END();
+ return eventSize;
+}
+
+int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+ int eventSize = 0;
+
+ // input check
+ if (!pCmd || !ppEvent)
+ THROW(MsgException::INVALID_PARAM, "pCmd or ppEvent is null");
+
+ // Get Incoming Message
+ MSG_CB_MSG_S cbMsg;
+ memset(&cbMsg, 0x00, sizeof(MSG_CB_MSG_S));
+
+ memcpy(&cbMsg, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_CB_MSG_S));
+
+ msg_id_list_s msgIdList;
+ msg_message_id_t msgIds[1];
+ memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
+
+ MsgTransactionManager::instance()->broadcastCBMsgCB(err, &cbMsg);
+
+ bool bSave = false;
+ MsgSettingGetBool(CB_SAVE, &bSave);
+
+ if(bSave && cbMsg.type!= MSG_ETWS_SMS) {
+ msgIdList.nCount = 1;
+ msgIds[0] = (msg_message_id_t)cbMsg.messageId;
+ msgIdList.msgIdList = msgIds;
+ MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList);
+ }
+ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)ppEvent);
+
+ MSG_END();
+
+ return eventSize;
+}
int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent)
{
handlerMap[MSG_CMD_GET_FILTERLIST] = &MsgGetFilterListHandler;
handlerMap[MSG_CMD_SET_FILTER_OPERATION] = &MsgSetFilterOperationHandler;
handlerMap[MSG_CMD_GET_FILTER_OPERATION] = &MsgGetFilterOperationHandler;
+ handlerMap[MSG_CMD_SET_FILTER_ACTIVATION] = &MsgSetFilterActivationHandler;
handlerMap[MSG_CMD_GET_MSG_TYPE] = &MsgGetMsgTypeHandler;
handlerMap[MSG_CMD_REG_INCOMING_MSG_CB] = &MsgRegIncomingMsgCallbackHandler;
handlerMap[MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB] = &MsgRegIncomingMMSConfMsgCallbackHandler;
handlerMap[MSG_CMD_REG_INCOMING_SYNCML_MSG_CB] = &MsgRegIncomingSyncMLMsgCallbackHandler;
+ handlerMap[MSG_CMD_REG_INCOMING_PUSH_MSG_CB] = &MsgRegIncomingPushMsgCallbackHandler;
+ handlerMap[MSG_CMD_REG_INCOMING_CB_MSG_CB] = &MsgRegIncomingCBMsgCallbackHandler;
handlerMap[MSG_CMD_REG_INCOMING_LBS_MSG_CB] = &MsgRegIncomingLBSMsgCallbackHandler;
handlerMap[MSG_CMD_REG_SYNCML_MSG_OPERATION_CB] = &MsgRegSyncMLMsgOperationCallbackHandler;
handlerMap[MSG_CMD_PLG_STORAGE_CHANGE_IND] = &MsgStorageChangeHandler;
handlerMap[MSG_CMD_PLG_INCOMING_MSG_IND] = &MsgIncomingMsgHandler;
handlerMap[MSG_CMD_PLG_INCOMING_MMS_CONF] = &MsgIncomingMMSConfMsgHandler;
+ handlerMap[MSG_CMD_PLG_INCOMING_PUSH_IND] = &MsgIncomingPushMsgHandler;
+ handlerMap[MSG_CMD_PLG_INCOMING_CB_IND] = &MsgIncomingCBMsgHandler;
handlerMap[MSG_CMD_PLG_INCOMING_SYNCML_IND] = &MsgIncomingSyncMLMsgHandler;
handlerMap[MSG_CMD_PLG_INCOMING_LBS_IND] = &MsgIncomingLBSMsgHandler;
handlerMap[MSG_CMD_SET_VOICE_MSG_OPT] = &MsgSetConfigHandler;
handlerMap[MSG_CMD_SET_GENERAL_MSG_OPT] = &MsgSetConfigHandler;
handlerMap[MSG_CMD_SET_MSG_SIZE_OPT] = &MsgSetConfigHandler;
+
+ handlerMap[MSG_CMD_ADD_PUSH_EVENT] = &MsgAddPushEventHandler;
+ handlerMap[MSG_CMD_DELETE_PUSH_EVENT] = &MsgDeletePushEventHandler;
+ handlerMap[MSG_CMD_UPDATE_PUSH_EVENT] = &MsgUpdatePushEventHandler;
+ handlerMap[MSG_CMD_DELETE_MESSAGE_BY_LIST] = &MsgDeleteMessageByListHandler;
}
// set Status;
setTMStatus();
- if( select(nfds, &readfds, NULL, NULL, NULL) == -1)
- {
- THROW(MsgException::SELECT_ERROR, strerror(errno));
+ if(select(nfds, &readfds, NULL, NULL, NULL) == -1) {
+ THROW(MsgException::SELECT_ERROR, "select error : %s", strerror(errno));
}
try
return;
}
- if (len == 0)
- THROW(MsgException::INVALID_RESULT, "read buffer size = 0");
+ if (len <= 0)
+ THROW(MsgException::INVALID_RESULT, "read buffer size <= 0");
char* pEventData = NULL;
AutoPtr<char> eventBuf(&pEventData);
}
}
+ // remove all newPushMsgCBs for fd
+ pushmsg_list::iterator pushmsg_it = newPushMsgCBList.begin();
+
+ while (pushmsg_it != newPushMsgCBList.end())
+ {
+ if (pushmsg_it->listenerFd == fd)
+ {
+ pushmsg_it = newPushMsgCBList.erase(pushmsg_it);
+ }
+ else
+ {
+ ++pushmsg_it;
+ }
+ }
+
+ // remove all newCBMsgCBs for fd
+ cbmsg_list::iterator cbmsg_it = newCBMsgCBList.begin();
+ bool bSave = false;
+
+ while (cbmsg_it != newCBMsgCBList.end())
+ {
+ if (cbmsg_it->listenerFd == fd)
+ {
+ cbmsg_it = newCBMsgCBList.erase(cbmsg_it);
+ }
+ else
+ {
+ if(cbmsg_it->bsave == true)
+ bSave = true;
+ ++cbmsg_it;
+ }
+ }
+
// remove all operationSyncMLMsgCBs for fd
syncmlop_list::iterator syncmlop_it = operationSyncMLMsgCBList.begin();
}
+void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCbInfo)
+{
+ if (!pCbInfo)
+ {
+ MSG_FATAL("cbinfo NULL");
+ return;
+ }
+
+ pushmsg_list::iterator it = newPushMsgCBList.begin();
+
+ for (; it != newPushMsgCBList.end(); it++)
+ {
+ if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType))
+ {
+ MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType);
+ return;
+ }
+ }
+
+ newPushMsgCBList.push_back(*pCbInfo);
+}
+
+void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo)
+{
+ if (!pCbInfo)
+ {
+ MSG_FATAL("cbinfo NULL");
+ return;
+ }
+
+ cbmsg_list::iterator it = newCBMsgCBList.begin();
+
+ for (; it != newCBMsgCBList.end(); it++)
+ {
+ if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType))
+ {
+ MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType);
+ return;
+ }
+ }
+
+ if(pCbInfo->bsave)
+ MsgSettingSetBool(CB_SAVE, pCbInfo->bsave);
+
+
+ newCBMsgCBList.push_back(*pCbInfo);
+}
+
void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbInfo)
{
if (!pCbInfo)
MSG_END();
}
+void MsgTransactionManager::broadcastPushMsgCB(const msg_error_t err, const MSG_PUSH_MESSAGE_DATA_S *pushData)
+{
+ MSG_BEGIN();
+
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ int eventSize = MsgMakeEvent(pushData, sizeof(MSG_PUSH_MESSAGE_DATA_S), MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, err, (void**)(&pEventData));
+
+ pushmsg_list::iterator it = newPushMsgCBList.begin();
+
+ for (; it != newPushMsgCBList.end(); it++)
+ {
+ if (!strcmp(it->appId, pushData->pushAppId))
+ {
+ MSG_DEBUG("Send incoming Push information to listener %d", it->listenerFd);
+ write(it->listenerFd, pEventData, eventSize);
+ }
+ }
+
+ MSG_END();
+}
+
+void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB_MSG_S *cbMsg)
+{
+ MSG_BEGIN();
+
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ int eventSize = MsgMakeEvent(cbMsg, sizeof(MSG_CB_MSG_S), MSG_EVENT_PLG_INCOMING_CB_MSG_IND, err, (void**)(&pEventData));
+
+ cbmsg_list::iterator it = newCBMsgCBList.begin();
+
+ for (; it != newCBMsgCBList.end(); it++)
+ {
+ MSG_DEBUG("Send incoming CB information to listener %d", it->listenerFd);
+ write(it->listenerFd, pEventData, eventSize);
+ }
+
+ MSG_END();
+}
void MsgTransactionManager::broadcastSyncMLMsgCB(const msg_error_t err, const MSG_SYNCML_MESSAGE_DATA_S *syncMLData)
{
MSG_CMD_REG_INCOMING_CB_MSG_CB,
MSG_CMD_PLG_INCOMING_CB_IND,
MSG_CMD_ADD_PUSH_EVENT,
+
+// 80
MSG_CMD_DELETE_PUSH_EVENT,
MSG_CMD_UPDATE_PUSH_EVENT,
+ MSG_CMD_DELETE_MESSAGE_BY_LIST,
+ MSG_CMD_SET_FILTER_ACTIVATION,
// end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM
MSG_CMD_NUM
MSG_EVENT_SET_VOICE_MSG_OPT,
MSG_EVENT_SET_GENERAL_MSG_OPT,
MSG_EVENT_SET_MSG_SIZE_OPT,
+
MSG_EVENT_REG_INCOMING_PUSH_MSG_CB,
MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND,
MSG_EVENT_REG_INCOMING_CB_MSG_CB,
MSG_EVENT_PLG_INCOMING_CB_MSG_IND,
MSG_EVENT_ADD_PUSH_EVENT,
+// 80
MSG_EVENT_DELETE_PUSH_EVENT,
MSG_EVENT_UPDATE_PUSH_EVENT,
+ MSG_EVENT_DELETE_MESSAGE_BY_LIST,
+ MSG_EVENT_SET_FILTER_ACTIVATION,
// end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM
MSG_EVENT_NUM
{
msg_filter_id_t filterId; /**< Indicates the filter ID. */
msg_filter_type_t filterType; /**< Indicates the filter type. */
- char filterValue[MAX_FILTER_VALUE_LEN+1]; /**< The value of a filter. */
+ char filterValue[MAX_FILTER_VALUE_LEN+1]; /**< The value of a filter. */
+ bool bActive;
} MSG_FILTER_S;
/*==================================================================================================
DEFINES
==================================================================================================*/
-#define MSG_DATA_ROOT_PATH "/opt/data/msg-service/"
+#define MSG_DATA_ROOT_PATH "/opt/usr/data/msg-service/"
#define MSG_DATA_PATH MSG_DATA_ROOT_PATH"msgdata/"
#define MSG_SMIL_FILE_PATH MSG_DATA_ROOT_PATH"smildata/"
#define MSG_IPC_DATA_PATH MSG_DATA_ROOT_PATH"ipcdata/"
#define MAX_THREAD_NAME_LEN 195
#define MAX_THREAD_DATA_LEN 128
#define MAX_CB_MSG_TEXT_LEN 4200 // 1page max char(93)*max page(15)*max bytes of UTF8 1 char(3)
+#define MAX_CB_MSG_LANGUAGE_TYPE_LEN 3
#define MAX_ETWS_WARNING_SECURITY_INFO_LEN 50
#define SMS_MINIMUM_SPACE (3 * 1024)
#define CB_LANGUAGE DEFAULT_CB_MSG_OPT_PATH"/language"
#define VOICEMAIL_NUMBER DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_number"
+#define VOICEMAIL_COUNT DEFAULT_VOICE_MAIL_OPT_PATH"/voice_mail_count"
#define MSGSIZE_OPTION DEFAULT_MSGSIZE_OPT_PATH"/msg_size"
*/
typedef struct
{
- msg_message_id_t msgId; /**< Indicates the message ID of this message. */
- msg_thread_id_t threadId; /**< Indicates the thread ID. */
- msg_folder_id_t folderId; /**< Indicates the folder ID. */
- MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type such as SMS and MMS */
- msg_storage_id_t storageId; /**< Indicates where the message is saved. */
- int nAddressCnt; /**< Indicates the count of addresses. */
+ msg_message_id_t msgId; /**< Indicates the message ID of this message. */
+ msg_thread_id_t threadId; /**< Indicates the thread ID. */
+ msg_folder_id_t folderId; /**< Indicates the folder ID. */
+ MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type such as SMS and MMS */
+ msg_storage_id_t storageId; /**< Indicates where the message is saved. */
+ int nAddressCnt; /**< Indicates the count of addresses. */
MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */
- char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */
- char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */
- time_t displayTime; /**< Indicates the display time related to the specific operation. */
+ char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */
+ char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */
+ time_t displayTime; /**< Indicates the display time related to the specific operation. */
msg_network_status_t networkStatus; /**< Indicates the network status of the message. */
msg_encode_type_t encodeType; /**< Indicates the string encoding type. */
- bool bRead; /**< Indicates whether the message is read or not. */
- bool bProtected; /**< Indicates whether the message is protected or not. */
- bool bBackup; /**< Indicates whether the message was restored from PC. */
+ bool bRead; /**< Indicates whether the message is read or not. */
+ bool bProtected; /**< Indicates whether the message is protected or not. */
+ bool bBackup; /**< Indicates whether the message was restored from PC. */
msg_priority_type_t priority; /**< Indicates the priority of the message. */
msg_direction_type_t direction; /**< Indicates whether the message is MO or MT (affecting address). */
- MSG_PORT_INFO_S msgPort; /**< Indicates the port number information. */
- bool bTextSms; /**< Indicates whether the message is just a text message or not. */
- size_t dataSize; /**< Indicates the data size. The unit is byte. */
- char msgData[MAX_MSG_DATA_LEN+1]; /**< Indicates the message payload information as a body. */
- char msgText[MAX_MSG_TEXT_LEN+1];
+ MSG_PORT_INFO_S msgPort; /**< Indicates the port number information. */
+ bool bTextSms; /**< Indicates whether the message is just a text message or not. */
+ size_t dataSize; /**< Indicates the data size. The unit is byte. */
+ char msgData[MAX_MSG_DATA_LEN+1]; /**< Indicates the message payload information as a body. */
+ char msgText[MAX_MSG_TEXT_LEN+1];
char thumbPath[MSG_FILEPATH_LEN_MAX];
+ bool bStore;
} MSG_MESSAGE_INFO_S;
typedef struct
unsigned short dstPort; /**< Recipient port number, not greater than 16 bit */
unsigned short srcPort; /**< Sender port number, not greater than 16 bit */
int attachCount; /**< Indicates the count of attached files in mms. */
- char thumbPath[MSG_FILEPATH_LEN_MAX];
+ char thumbPath[MSG_FILEPATH_LEN_MAX+1];
size_t dataSize; /**< Indicates the data size. The unit is byte. */
void *pData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
void *pMmsData; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
int unreadCnt; /**< Indicates the unread messages from the Peer. */
int smsCnt; /**< Indicates the SMS messages from the Peer. */
int mmsCnt; /**< Indicates the MMS messages from the Peer. */
+ bool bProtected; /**< Indicates whether the thread includes protected messages. */
} MSG_THREAD_VIEW_S;
/**
+ * @brief Represents message information for conversation view.
+ */
+typedef struct
+{
+ msg_message_id_t msgId; /**< Indicates the message ID of this message. */
+ msg_thread_id_t threadId; /**< Indicates the thread ID of this peer. */
+ MSG_MAIN_TYPE_T mainType; /**< Message main type. See enum _MSG_MAIN_TYPE_E */
+ MSG_SUB_TYPE_T subType; /**< Message sub type. See enum _MSG_SUB_TYPE_E */
+ msg_folder_id_t folderId; /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */
+ msg_storage_id_t storageId; /**< Indicates where the message is saved. see enum _MSG_FOLDER_TYPE_E*/
+ time_t displayTime; /**< Indicates the display time related to the specific operation. */
+ time_t scheduledTime; /**< Indicates the time to send scheduled message. */
+ msg_network_status_t networkStatus; /**< Indicates the network status of the message. */
+ bool bRead; /**< Indicates whether the message is read or not. */
+ bool bProtected; /**< Indicates whether the message is protected or not. */
+ msg_direction_type_t direction; /**< Indicates whether the message is MO or MT, affecting address. */
+ int pageCount; /**< Indicates the count of pageCount in mms. */
+ int attachCount; /**< Indicates the count of attached files in mms. */
+ char attachFileName[MSG_FILENAME_LEN_MAX+1]; /**< Indicates the thumbnail path. */
+ char audioFileName[MSG_FILENAME_LEN_MAX+1]; /**< Indicates the thumbnail path. */
+ char imageThumbPath[MSG_FILEPATH_LEN_MAX+1]; /**< Indicates the thumbnail path. */
+ char videoThumbPath[MSG_FILEPATH_LEN_MAX+1]; /**< Indicates the thumbnail path. */
+ char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */
+ size_t textSize; /**< Indicates the data size. The unit is byte. */
+ char *pText; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
+} MSG_CONVERSATION_VIEW_S;
+
+
+/**
* @brief Represents sim message informatioin list.
*/
typedef struct
unsigned short etwsWarningType;
unsigned char etwsWarningSecurityInfo[MAX_ETWS_WARNING_SECURITY_INFO_LEN];
+ unsigned char language_type[MAX_CB_MSG_LANGUAGE_TYPE_LEN];
} MSG_CB_MSG_S;
MSG_MMS_UNKNOWN,
};
+/**
+ * @brief Represents the values of File Type of MMS. \n
+ * This enum is used as the value of .
+ */
+enum _MSG_MMS_ITEM_TYPE_E
+{
+ MSG_MMS_ITEM_TYPE_IMG, /**< Indicates the image media */
+ MSG_MMS_ITEM_TYPE_AUDIO, /**< Indicates the audio media */
+ MSG_MMS_ITEM_TYPE_VIDEO, /**< Indicates the video media */
+ MSG_MMS_ITEM_TYPE_ATTACH, /**< Indicates the attach file */
+ MSG_MMS_ITEM_TYPE_PAGE, /**< Indicates the page count */
+};
#endif
/**
* @brief Represents the Report Status Data.
*/
- typedef struct
+typedef struct
{
- msg_delivery_report_status_t deliveryStatus; /**< Indicates the message ID of this message. */
- time_t deliveryStatusTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN
- msg_read_report_status_t readStatus; /**< Indicates the message ID of this message. */
- time_t readStatusTime; /**< Indicates the display time related to the specific operation. */ //MAX_DISPLAY_TIME_LEN
-}MSG_REPORT_STATUS_INFO_S;
+ char addressVal[MAX_ADDRESS_VAL_LEN+1];
+ int type;
+ int status;
+ time_t statusTime;
+} MSG_REPORT_STATUS_INFO_S;
+
typedef struct
{
int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgDeleteMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgMoveMessageToStorageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgCountMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgSetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgGetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+int MsgSetFilterActivationHandler(const MSG_CMD_S *pCmd, char **ppEvent);
+
int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetSMSCListHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetCBInfoHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetSmsSendOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetMmsSendOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetMmsRecvOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetPushMsgOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetVoiceMsgOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
-int MsgGetGeneralOptHandler(const MSG_CMD_S *pCmd, char **ppEvent);
#endif // MSG_CMD_HANDLER_H
msg_error_t MsgStoUpdateProtectedStatus(msg_message_id_t MsgId, bool bProtected);
msg_error_t MsgStoDeleteMessage(msg_message_id_t MsgId, bool bCheckIndication);
msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t FolderId, bool bOnlyDB, msg_id_list_s *pMsgIdList);
+msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList);
msg_error_t MsgStoMoveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId);
msg_error_t MsgStoMoveMessageToStorage(const msg_message_id_t MsgId, const msg_storage_id_t DestStorageId);
msg_error_t MsgStoCountMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo);
msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
msg_error_t MsgStoGetMessage(msg_message_id_t MsgId, MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
+msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv);
msg_error_t MsgStoGetFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int ExtId, int PinCode);
msg_error_t MsgStoGetMsgType(msg_message_id_t msgId, MSG_MESSAGE_TYPE_S* pMsgType);
msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_INFO_S *pMsg);
msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList);
msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList);
-msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, msg_id_list_s *pMsgIdList);
+msg_error_t MsgStoDeleteThreadMessageList(msg_thread_id_t ThreadId, bool bIncludeProtect, msg_id_list_s *pMsgIdList);
msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pThreadCountInfo);
msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pThreadViewList);
msg_error_t MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList);
msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
-msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, MSG_REPORT_STATUS_INFO_S* pReportStatus);
+msg_error_t MsgStoGetReportStatus(msg_message_id_t msgId, int *count, MSG_REPORT_STATUS_INFO_S **pReportStatus);
msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pThreadId);
msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t ThreadId, int *cnt);
msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list_s *pAddrList);
msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter);
msg_error_t MsgStoDeleteFilter(msg_filter_id_t FilterId);
msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList);
+msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive);
// Sim Operation related Functions
msg_error_t MsgInitSimMessage(MSG_SIM_STATUS_T SimStatus);
///////////////////////////////////////////////////////////////////////////////////
// For MMS - will be removed
msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg);
-msg_error_t MsgStoUpdateNetworkStatus(MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t Status);
msg_error_t MsgStoGetSubject(msg_message_id_t MsgId, char* pSubject);
msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S *pRecipientList);
msg_error_t MsgStoGetReadStatus(msg_message_id_t MsgId, bool *pReadStatus);
int msg_get_filter_list(msg_handle_t handle, msg_struct_list_s *filter_list);
int msg_set_filter_operation(msg_handle_t handle, bool set_flag);
int msg_get_filter_operation(msg_handle_t handle, bool *set_flag);
+int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active);
//setting
int msg_get_smsc_opt(msg_handle_t handle, msg_struct_t msg_struct);
// filter
+bool msg_get_filter_info_bool(void *filter, int field);
int msg_get_filter_info_int(void *filter, int field);
char *msg_get_filter_info_str(void *filter, int field);
+int msg_set_filter_info_bool(void *filter, int field, bool value);
int msg_set_filter_info_int(void *filter, int field, int value);
int msg_set_filter_info_str(void *filter, int field, char *value, int size);
bool msg_push_config_get_bool(void *event_info, int field);
int msg_push_config_set_str(void *event_info, int field, char *value, int size);
int msg_push_config_set_bool(void *event, int field, bool value);
+
/* added internal apis for new managed api (storage) */
int msg_syncml_info_get_int(void *syncml_info, int field);
int msg_count_info_get_int(void *count_info, int field);
int msg_sortrule_get_int(void *sort_info, int field);
int msg_folder_info_get_int(void *folder_info, int field);
int msg_thread_info_get_int(void *data, int field);
+int msg_conv_info_get_int(void *data, int field);
int msg_search_condition_get_int(void *condition_info, int field);
int msg_report_status_get_int(void *report_info, int field);
+char* msg_report_status_get_str(void *report_info, int field);
char* msg_folder_info_get_str(void *folder_info, int field);
char *msg_thread_info_get_str(void *data, int field);
+char *msg_conv_info_get_str(void *data, int field);
char* msg_search_condition_get_str(void *condition_info, int field, int size);
bool msg_sendopt_get_bool(void *send_opt, int field);
bool msg_sortrule_get_bool(void *sort_rule, int field);
+bool msg_conv_get_bool(void *data, int field);
+bool msg_thread_info_get_bool(void *data, int field);
int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void **value);
/*================================================================================================*/
int msg_get_message(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t msg, msg_struct_t send_opt);
+int msg_get_conversation(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t conv);
/**
* \endcode
*/
/*================================================================================================*/
-int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id);
+int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg);
/**
* \endcode
*/
/*================================================================================================*/
-int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t report_status);
-
-
-
+int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list);
int msg_get_address_list(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_list_s *msg_address_list);
-
int msg_get_thread_id_by_address(msg_handle_t handle, msg_struct_list_s *msg_address_list, msg_thread_id_t *thread_id);
-
int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, msg_struct_t msg_thread);
-
int msg_get_message_list(msg_handle_t handle, msg_folder_id_t folder_id, msg_thread_id_t thread_id, msg_message_type_t msg_type, msg_storage_id_t storage_id, msg_struct_list_s *msg_list);
+
int msg_add_push_event(msg_handle_t handle, const msg_struct_t push_event);
int msg_delete_push_event(msg_handle_t handle, const msg_struct_t push_event);
int msg_update_push_event(msg_handle_t handle, const msg_struct_t src_event, const msg_struct_t dst_event);
+
+int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list);
/**
* @}
*/
#define MAX_COMMON_INFO_SIZE 20
+#define MAX_SEGMENT_NUM 15
+
/**
* @brief Defines the maximum file path length
*/
#define MMS_TR_ID_LEN 40
#define MMS_MSG_ID_LEN 40
#define MMS_LOCATION_LEN 100
+
+#define MAX_MMS_TEXT_LEN 2000
/*==================================================================================================
TYPES
==================================================================================================*/
/**
+ * @brief Represents a Report Type.
+ * The values for this type SHOULD be in _MSG_REPORT_TYPE_E
+ */
+typedef int msg_report_type_t;
+
+
+/**
* @brief Represents a Delivery Report Status.
* The values for this type SHOULD be in _MSG_DELIVERY_REPORT_STATUS_E
*/
MSG_STRUCT_MESSAGE_INFO = 0x0200, /**< Indicates the MSG_STRUCT_MESSAGE_INFO */
MSG_STRUCT_THREAD_INFO = 0x0300,
-
+ MSG_STRUCT_CONV_INFO = 0x0400,
MSG_STRUCT_MMS = 0x0500, /**< Indicates the MSG_STRUCT_MMS */
MSG_STRUCT_MMS_PAGE = 0x0600, /**< Indicates the MSG_STRUCT_MMS_PAGE */
MSG_STRUCT_MMS_MEDIA = 0x0700, /**< Indicates the MSG_STRUCT_MMS_MEDIA */
enum MSG_FILTER_INFO_E {
MSG_FILTER_ID_INT = MSG_STRUCT_FILTER+1, /**< Indicates the filter ID. */
MSG_FILTER_TYPE_INT, /**< Indicates the filter type. See enum _MSG_FILTER_TYPE_E */
- MSG_FILTER_VALUE_STR, /**< The value of a filter. */
+ MSG_FILTER_VALUE_STR, /**< The value of the filter. */
+ MSG_FILTER_ACTIVE_BOOL, /**< Indicates the activation of the filter. */
};
enum MSG_STRUCT_THREAD_INFO_E {
MSG_THREAD_DIRECTION_INT, /**< The latest message direction See enum _MSG_DIRECTION_TYPE_E */
MSG_THREAD_UNREAD_COUNT_INT, /**< Indicates unread count of thread */
MSG_THREAD_SMS_COUNT_INT, /**< Indicates sms message count of thread */
- MSG_THREAD_MMS_COUNT_INT /**< Indicates mms message count of thread */
+ MSG_THREAD_MMS_COUNT_INT, /**< Indicates mms message count of thread */
+ MSG_THREAD_PROTECTED_BOOL /**< Indicates whether thread includes protected messages. */
+};
+
+enum MSG_STRUCT_CONV_INFO_E {
+ MSG_CONV_MSG_ID_INT = MSG_STRUCT_CONV_INFO+1, /**< Indicates the message ID of this message. */
+ MSG_CONV_MSG_THREAD_ID_INT, /**< Indicates the thread ID. */
+ MSG_CONV_MSG_TYPE_INT, /**< Indicates the message type. See enum _MSG_MESSAGE_TYPE_E */
+ MSG_CONV_MSG_FOLDER_ID_INT, /**< Indicates the folder ID. see enum _MSG_FOLDER_TYPE_E */
+ MSG_CONV_MSG_STORAGE_ID_INT, /**< Indicates where the message is saved. see enum _MSG_STORAGE_ID_E*/
+ MSG_CONV_MSG_SUBJECT_STR, /**< Indicates the message subject. */
+ MSG_CONV_MSG_DISPLAY_TIME_INT, /**< Indicates the display time related to the specific operation. */
+ MSG_CONV_MSG_SCHEDULED_TIME_INT, /**< Indicates the time to send scheduled message. */
+ MSG_CONV_MSG_NETWORK_STATUS_INT, /**< Indicates the network status of the message. See enum _MSG_NETWORK_STATUS_E */
+ MSG_CONV_MSG_READ_BOOL, /**< Indicates whether the message is read or not. */
+ MSG_CONV_MSG_PROTECTED_BOOL, /**< Indicates whether the message is protected or not. */
+ MSG_CONV_MSG_DIRECTION_INT, /**< Indicates whether the message is MO or MT, affecting address. See enum _MSG_DIRECTION_TYPE_E */
+ MSG_CONV_MSG_PAGE_COUNT_INT, /**< Indicates the count of pages in mms. */
+ MSG_CONV_MSG_ATTACH_COUNT_INT, /**< Indicates the count of attached files in mms. */
+ MSG_CONV_MSG_ATTACH_NAME_STR, /**< Indicates the attached file name of message. */
+ MSG_CONV_MSG_AUDIO_NAME_STR, /**< Indicates the audio file name of message. */
+ MSG_CONV_MSG_IMAGE_THUMB_PATH_STR, /**< Indicates the image thumbnail path of message. */
+ MSG_CONV_MSG_VIDEO_THUMB_PATH_STR, /**< Indicates the video thumbnail path of message. */
+ MSG_CONV_MSG_TEXT_SIZE_INT, /**< Indicates the data size. The unit is byte. */
+ MSG_CONV_MSG_TEXT_STR /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
};
enum _MSG_STRUCT_SETTING_SMSC_OPT_E {
MSG_SEARCH_CONDITION_RESERVED_INT,
};
-enum MSG_REPORT_STATUS_E {
- MSG_REPORT_STATUS_DELIVERY_STATUS_INT = MSG_STRUCT_REPORT_STATUS_INFO+1, /**< Indicates the message ID of this message. */
- MSG_REPORT_STATUS_DELIVERY_TIME_INT, /**< Indicates the display time related to the specific operation. */
- MSG_REPORT_STATUS_READ_STATUS_INT, /**< Indicates the message ID of this message. */
- MSG_REPORT_STATUS_READ_TIME_INT, /**< Indicates the display time related to the specific operation. */
+enum MSG_REPORT_E {
+ MSG_REPORT_ADDRESS_STR = MSG_STRUCT_REPORT_STATUS_INFO+1, /**< Indicates Report address */
+ MSG_REPORT_TYPE_INT, /**< Indicates Report type. See the msg_report_type_t type*/
+ MSG_REPORT_STATUS_INT, /**< Indicates Report status. See the msg_delivery_report_status_t or msg_read_report_status_t type*/
+ MSG_REPORT_TIME_INT, /**< Indicates Report time */
};
+
enum MSG_ADDRESS_INFO_E {
MSG_ADDRESS_INFO_ADDRESS_TYPE_INT = MSG_STRUCT_ADDRESS_INFO+1, /**< The type of an address in case of an Email or a mobile phone. See enum _MSG_ADDRESS_TYPE_E */
MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, /**< The type of recipient address in case of To, Cc, and Bcc. See enum _MSG_RECIPIENT_TYPE_E */
MSG_CB_MSG_CB_TEXT_STR, /**< CB text */
MSG_CB_MSG_ETWS_WARNING_TYPE_INT, /**< warning type of ETWS Primary Noti. : 2 bytes binary data */
MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR, /**< warning security information of ETWS Primary Noti. : 50 bytes binary data */
+ MSG_CB_MSG_LANGUAGE_TYPE_STR, /**< Language type of CB message data */
};
/**
* @brief Represents the type of Message. More members maybe added if needed \n
* This enum is used as the value of msg_message_type_t.
*/
- enum _MSG_MESSAGE_TYPE_E
+enum _MSG_MESSAGE_TYPE_E
{
MSG_TYPE_INVALID = 0, /** < Invalid Type Message */
MSG_TYPE_SMS_MWI, /** < MWI SMS Message */
MSG_TYPE_SMS_SYNCML, /** < SyncML CP SMS Message */
MSG_TYPE_SMS_REJECT, /** < Reject Message */
+
MSG_TYPE_MMS, /** < Normal MMS Message */
MSG_TYPE_MMS_JAVA, /** < JAVA MMS Message */
MSG_TYPE_MMS_NOTI, /** < MMS Notification Message */
MSG_READ_REPORT_IS_DELETED = 1 /**< Indicates the message is deleted */
};
+/**
+ * @brief Represents the values of a Report Type. \n
+ * This enum is used as the value of msg_read_report_status_t.
+*/
+enum _MSG_REPORT_TYPE_E
+ {
+ MSG_REPORT_TYPE_DELIVERY = 0, /**< Indicates the type is delivery report*/
+ MSG_REPORT_TYPE_READ = 1, /**< Indicates the type is read report */
+
+ };
// filter
/**
#define MAX_SOUND_FILE_LEN 1024
#define DEFAULT_FILE "/usr/share/media/Sherbet.wav"
-#define ALERT_ON_CALL_TONE "/opt/etc/msg-service/alert_on_call.mp3"
+//#define ALERT_ON_CALL_TONE "/opt/etc/msg-service/alert_on_call.mp3"
#define HAPTIC_TEST_ITERATION 1
#define MSG_VIBRATION_INTERVAL 3000
msg_error_t updateProtectedStatus(msg_message_id_t MsgId, bool bProtected);
msg_error_t deleteMessage(msg_message_id_t MsgId);
msg_error_t deleteAllMessagesInFolder(msg_folder_id_t FolderId, bool bOnlyDB);
+ msg_error_t deleteMessagesByList(msg_id_list_s *pMsgIdList);
msg_error_t moveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId);
msg_error_t moveMessageToStorage(msg_message_id_t MsgId, msg_storage_id_t DestStorageId);
msg_error_t countMessage(msg_folder_id_t FolderId, MSG_COUNT_INFO_S *pCountInfo);
msg_error_t countMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount);
msg_error_t countMsgByContact(const MSG_THREAD_LIST_INDEX_INFO_S *pAddrInfo, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList);
msg_error_t getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S *pMsg, MSG_SENDINGOPT_S *pSendOpt);
+ msg_error_t getConversationViewItem(msg_message_id_t MsgId, MSG_CONVERSATION_VIEW_S *pConv);
msg_error_t getFolderViewList(msg_folder_id_t FolderId, const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pMsgFolderViewList);
msg_error_t addFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
msg_error_t updateFolder(const MSG_FOLDER_INFO_S *pFolderInfo);
msg_error_t getThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList);
msg_error_t getConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList);
- msg_error_t deleteThreadMessageList(msg_thread_id_t thread_id);
+ msg_error_t deleteThreadMessageList(msg_thread_id_t thread_id, bool include_protected_msg);
msg_error_t getQuickPanelData(msg_quickpanel_type_t Type, MSG_MESSAGE_HIDDEN_S *pMsg);
msg_error_t resetDatabase();
msg_error_t getMemSize(unsigned int* memsize);
msg_error_t getFilterList(msg_struct_list_s *pFilterList);
msg_error_t setFilterOperation(bool bSetFlag);
msg_error_t getFilterOperation(bool *pSetFlag);
+ msg_error_t setFilterActivation(msg_filter_id_t filter_id, bool active);
//setting
msg_error_t getSMSCOption(msg_struct_t msg_struct);
msg_error_t searchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList);
msg_error_t getRejectMsgList(const char *pNumber, msg_struct_list_s *pRejectMsgList);
msg_error_t regStorageChangeCallback(msg_storage_change_cb onStorageChange, void *pUserParam);
- msg_error_t getReportStatus(msg_message_id_t msg_id, MSG_REPORT_STATUS_INFO_S *pReport_status);
+ msg_error_t getReportStatus(msg_message_id_t msg_id, msg_struct_list_s *report_list);
msg_error_t getThreadIdByAddress(msg_struct_list_s *pAddrList, msg_thread_id_t *pThreadId);
msg_error_t getThread(msg_thread_id_t threadId, MSG_THREAD_VIEW_S* pThreadInfo);
msg_error_t getMessageList(msg_folder_id_t folderId, msg_thread_id_t threadId, msg_message_type_t msgType, msg_storage_id_t storageId, msg_struct_list_s *pMsgList);
+
// Push Event
msg_error_t addPushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
msg_error_t deletePushEvent(MSG_PUSH_EVENT_INFO_S *push_event);
void handleEvent(const MSG_EVENT_S* ptr);
int getRemoteFd();
- int readFromSocket(char** buf, int* len);
+ int readFromSocket(char** buf, unsigned int* len);
private:
MsgProxyListener();
void MsgSettingRegVconfCB();
void MsgSettingRemoveVconfCB();
+
void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
+void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb);
#endif // MSG_GCONF_WRAPPER_H
msg_error_t connect(const char *path);
msg_error_t close();
/* write msg to ipc server */
- int write(const char* buf, int len);
+ int write(const char* buf, unsigned int len);
/* read msg from ipc server */
- int read(char** buf, int* len);
+ int read(char** buf, unsigned int* len);
void addfd(int fd);
int getRemoteFd() {return remotefd; }
private:
- int readn(char *buf, int len );
- int writen (const char *buf, int len);
+ int readn(char *buf, unsigned int len );
+ int writen (const char *buf, unsigned int len);
int sockfd, remotefd, maxfd;
fd_set fds;
/* read msg from client of fd */
int read(int fd, char** buf, int* len );
/* write msg to ipc client */
- int write(int fd, const char* buf, int len);
+ int write(int fd, const char* buf, unsigned int len);
void addfd(int fd);
void setSockfd(int fd) { sockfd = fd; }
private:
- int readn(int fd, char *buf, int len );
- int writen (int fd, const char *buf, int len);
+ int readn(int fd, char *buf, unsigned int len );
+ int writen (int fd, const char *buf, unsigned int len);
/* server socket fd */
int sockfd;
msg_error_t MsgInsertNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg);
+msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg);
+
msg_error_t MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, msg_message_id_t MsgId, msg_delivery_report_status_t Status);
msg_error_t MsgInsertMmsReportToNoti(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S* pMsg);
/*==================================================================================================
DEFINES
==================================================================================================*/
-#define MSGFW_DB_NAME "/opt/dbspace/.msg_service.db"
+#define MSGFW_DB_NAME "/opt/usr/dbspace/.msg_service.db"
#define MSGFW_MESSAGE_TABLE_NAME "MSG_MESSAGE_TABLE"
#define MSGFW_FOLDER_TABLE_NAME "MSG_FOLDER_TABLE"
#define MMS_PLUGIN_MESSAGE_TABLE_NAME "MSG_MMS_MESSAGE_TABLE"
#define MSGFW_SYNCML_MSG_TABLE_NAME "MSG_SYNCML_TABLE"
#define MSGFW_SMS_SENDOPT_TABLE_NAME "MSG_SMS_SENDOPT_TABLE"
-
+#define MSGFW_REPORT_TABLE_NAME "MSG_REPORT_TABLE"
#define MSGFW_PUSH_CONFIG_TABLE_NAME "MSG_PUSHCFG_TABLE"
+#define MSGFW_MMS_PREVIEW_TABLE_NAME "MSG_MMS_PREVIEW_INFO_TABLE"
#define MAX_QUERY_LEN 3072
#define MAX_FOLDER_NAME_LEN 20
#define MAX_ACCOUNT_NAME_LEN 51
* limitations under the License.
*/
-#ifndef SMS_PLUGIN_TEXT_CONVERT_H
-#define SMS_PLUGIN_TEXT_CONVERT_H
+#ifndef MSG_TEXT_CONVERT_H
+#define MSG_TEXT_CONVERT_H
/*==================================================================================================
==================================================================================================*/
#include <map>
-#include "SmsPluginTypes.h"
+//#include "SmsPluginTypes.h"
/*==================================================================================================
typedef unsigned short WCHAR;
-typedef unsigned char SMS_CHAR_TYPE_T;
+typedef unsigned char MSG_CHAR_TYPE_T;
+
+typedef unsigned char MSG_LANGUAGE_ID_T;
/*==================================================================================================
ENUMS
==================================================================================================*/
-enum _SMS_CHAR_TYPE_E
+enum _MSG_CHAR_TYPE_E
{
- SMS_CHAR_DEFAULT = 0,
- SMS_CHAR_GSM7EXT,
- SMS_CHAR_TURKISH,
- SMS_CHAR_SPANISH,
- SMS_CHAR_PORTUGUESE
+ MSG_CHAR_DEFAULT = 0,
+ MSG_CHAR_GSM7EXT,
+ MSG_CHAR_TURKISH,
+ MSG_CHAR_SPANISH,
+ MSG_CHAR_PORTUGUESE
};
+enum _MSG_LANGUAGE_ID_E
+{
+ MSG_LANG_ID_RESERVED = 0,
+ MSG_LANG_ID_TURKISH,
+ MSG_LANG_ID_SPANISH,
+ MSG_LANG_ID_PORTUGUESE,
+ MSG_LANG_ID_BENGALI,
+ MSG_LANG_ID_GUJARATI,
+ MSG_LANG_ID_HINDI,
+ MSG_LANG_ID_KANNADA,
+ MSG_LANG_ID_MALAYALAM,
+ MSG_LANG_ID_ORIYA,
+ MSG_LANG_ID_PUNJABI,
+ MSG_LANG_ID_TAMIL,
+ MSG_LANG_ID_TELUGU,
+ MSG_LANG_ID_URDU,
+};
/*==================================================================================================
STRUCTURES
==================================================================================================*/
+
+typedef struct _MSG_LANG_INFO_S
+{
+ bool bSingleShift;
+ bool bLockingShift;
+
+ MSG_LANGUAGE_ID_T singleLang;
+ MSG_LANGUAGE_ID_T lockingLang;
+} MSG_LANG_INFO_S;
+
+
+typedef struct _MSG_SINGLE_SHIFT_S
+{
+ MSG_LANGUAGE_ID_T langId;
+} MSG_SINGLE_SHIFT_S;
+
+
+typedef struct _MSG_LOCKING_SHIFT_S
+{
+ MSG_LANGUAGE_ID_T langId;
+} MSG_LOCKING_SHIFT_S;
+
+
// ETSI GSM 03.38 GSM 7 bit Default Alphabet Table -> UCS2
static const WCHAR g_GSM7BitToUCS2[] =
{
/*==================================================================================================
CLASS DEFINITIONS
==================================================================================================*/
-class SmsPluginTextConvert
+class MsgTextConvert
{
public:
- static SmsPluginTextConvert* instance();
+ MsgTextConvert();
+ ~MsgTextConvert();
- int convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId);
+ int convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId);
int convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen);
int convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType);
- int convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo);
+ int convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo);
int convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen);
int convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen);
private:
- SmsPluginTextConvert();
- virtual ~SmsPluginTextConvert();
-
- static SmsPluginTextConvert* pInstance;
-
- int convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId);
+ int convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId);
int convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown);
- int convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo);
+ int convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo);
void convertDumpTextToHex(const unsigned char *pText, int length);
std::map<unsigned short, unsigned char> ucs2toPortuList;
};
-#endif //SMS_PLUGIN_TEXT_CONVERT_H
+#endif //MSG_TEXT_CONVERT_H
int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList, char **ppDest);
-int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, char **ppDest);
+int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest);
int MsgEncodeThreadId(msg_thread_id_t *pThreadId, char **ppDest);
void MsgDecodeMemSize(char *pSrc, unsigned int *memsize);
-void MsgDecodeReportStatus(char *pSrc, MSG_REPORT_STATUS_INFO_S *pReportStatus);
+void MsgDecodeReportStatus(char *pSrc, msg_struct_list_s *report_list);
void MsgDecodeThreadId(char *pSrc, msg_thread_id_t *pThreadId);
msg_error_t MsgStoGetMmsRawFilePath(MsgDbHandler *pDbHandle, msg_message_id_t msgId, char *pFilePath);
bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, msg_message_id_t MsgId);
bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, msg_message_id_t MsgId);
+msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status);
char *MsgStoReplaceString(const char *org_str, const char *old_str, const char *new_str);
#endif // MSG_UTIL_STORAGE_H
}
+EXPORT_API int msg_set_filter_active(msg_handle_t handle, msg_filter_id_t filter_id, bool active)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ if (handle == NULL)
+ {
+ return -EINVAL;
+ }
+
+ MsgHandle* pHandle = (MsgHandle*)handle;
+
+ try
+ {
+ err = pHandle->setFilterActivation(filter_id, active);
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_FILTER_ERROR;
+ }
+
+ return err;
+}
+
+
+bool msg_get_filter_info_bool(void *filter, int field)
+{
+ if (!filter)
+ return MSG_ERR_NULL_POINTER;
+
+ int ret = 0;
+
+ MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
+
+ switch (field)
+ {
+ case MSG_FILTER_ACTIVE_BOOL :
+ ret = filter_data->bActive;
+ break;
+ default :
+ return MSG_ERR_INVALID_PARAMETER;
+ }
+
+ return ret;
+}
int msg_get_filter_info_int(void *filter, int field)
return ret_str;
}
+int msg_set_filter_info_bool(void *filter, int field, bool value)
+{
+ if (!filter)
+ return MSG_ERR_NULL_POINTER;
+
+ msg_error_t err = MSG_SUCCESS;
+ MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter;
+
+ switch (field)
+ {
+ case MSG_FILTER_ACTIVE_BOOL :
+ filter_data->bActive = value;
+ break;
+ default :
+ return MSG_ERR_INVALID_PARAMETER;
+ }
+
+ return err;
+}
+
int msg_set_filter_info_int(void *filter, int field, int value)
{
if (!filter)
if (msg_data->pData)
{
int data_len = 0;
- (size >= msg_data->dataSize)? (data_len = msg_data->dataSize) : data_len = size;
+ ((size_t)size >= msg_data->dataSize)? (data_len = msg_data->dataSize) : data_len = size;
memset(value, 0, size);
memcpy(value, msg_data->pData, data_len);
}
int ret = MSG_SUCCESS;
- MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data;
-
switch (field) {
default :
ret = MSG_ERR_INVALID_PARAMETER;
} else if (value == MSG_TYPE_SMS_REJECT) {
msg_data->mainType = MSG_SMS_TYPE;
msg_data->subType = MSG_REJECT_SMS;
- }
+ } else if (value == MSG_TYPE_SMS_ETWS_PRIMARY) {
+ msg_data->mainType = MSG_SMS_TYPE;
+ msg_data->subType = MSG_ETWS_SMS;
+ }
break;
}
case MSG_MESSAGE_CLASS_TYPE_INT :
int ret = MSG_SUCCESS;
- MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data;
-
switch (field) {
default :
ret = MSG_ERR_INVALID_PARAMETER;
value[copylen] = '\0';
}
break;
+ case MSG_CB_MSG_LANGUAGE_TYPE_STR:
+ {
+ int copylen = 0;
+ copylen = ((size_t)size > strlen((const char*)cb_msg->language_type)) ? strlen((const char*)cb_msg->language_type) : size - 1;
+ memcpy (value, cb_msg->language_type, copylen);
+ value[copylen] = '\0';
+ }
+ break;
case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR:
{
- if (size < sizeof(cb_msg->etwsWarningSecurityInfo))
+ if ((size_t)size < sizeof(cb_msg->etwsWarningSecurityInfo))
ret = MSG_ERR_INVALID_PARAMETER;
else
memcpy (value, cb_msg->etwsWarningSecurityInfo, sizeof(cb_msg->etwsWarningSecurityInfo));
msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle;
msg_struct_s *msg_struct_item = NULL;
- void *data = NULL;
switch(msg_struct->type) {
case MSG_STRUCT_MMS:
{
#include "msg_storage.h"
-static int msg_thread_get_msg_type(int mainType, int subType);
+static int msg_get_msg_type(int mainType, int subType);
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
}
+EXPORT_API int msg_delete_msgs_by_list(msg_handle_t handle, msg_id_list_s *msg_id_list)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ if (handle == NULL)
+ {
+ return -EINVAL;
+ }
+
+ MsgHandle* pHandle = (MsgHandle*)handle;
+
+ try
+ {
+ err = pHandle->deleteMessagesByList(msg_id_list);
+ }
+ catch (MsgException& e)
+ {
+ MSG_FATAL("%s", e.what());
+ return MSG_ERR_STORAGE_ERROR;
+ }
+
+ return err;
+}
+
+
EXPORT_API int msg_move_msg_to_folder(msg_handle_t handle, msg_message_id_t msg_id, msg_folder_id_t dest_folder_id)
{
msg_error_t err = MSG_SUCCESS;
}
-EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id)
+EXPORT_API int msg_delete_thread_message_list(msg_handle_t handle, msg_thread_id_t thread_id, bool include_protected_msg)
{
msg_error_t err = MSG_SUCCESS;
try
{
- err = pHandle->deleteThreadMessageList(thread_id);
+ err = pHandle->deleteThreadMessageList(thread_id, include_protected_msg);
}
catch (MsgException& e)
{
return err;
}
-
-EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_t report_status)
+EXPORT_API int msg_get_report_status(msg_handle_t handle, msg_message_id_t msg_id, msg_struct_list_s *report_list)
{
msg_error_t err = MSG_SUCCESS;
- if (handle == NULL || msg_id < 1)
+ if (handle == NULL || msg_id < 1 || report_list == NULL)
{
return -EINVAL;
}
MsgHandle* pHandle = (MsgHandle*)handle;
- msg_struct_s *pStruct = (msg_struct_s *)report_status;
try
{
- err = pHandle->getReportStatus(msg_id, (MSG_REPORT_STATUS_INFO_S *)pStruct->data);
+ err = pHandle->getReportStatus(msg_id, report_list);
}
catch (MsgException& e)
{
return err;
}
-static int msg_thread_get_msg_type(int mainType, int subType)
+static int msg_get_msg_type(int mainType, int subType)
{
if (mainType == MSG_SMS_TYPE)
{
int msg_syncml_info_get_int(void *syncml_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_SYNCML_MESSAGE_S *pSync = (MSG_SYNCML_MESSAGE_S *)syncml_info;
switch(field)
{
result = pSync->pinCode;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_count_info_get_int(void *count_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_COUNT_INFO_S *pCount = (MSG_COUNT_INFO_S *)count_info;
switch(field)
{
result = pCount->nMms;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_thread_count_get_int(void *count_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_THREAD_COUNT_INFO_S *pCount = (MSG_THREAD_COUNT_INFO_S *)count_info;
switch(field)
{
result = pCount->mmsMsgCount;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_thread_index_get_int(void *index_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_THREAD_LIST_INDEX_S *pIndex = (MSG_THREAD_LIST_INDEX_S *)index_info;
switch(field)
{
result = pIndex->contactId;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_sortrule_get_int(void *sort_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_SORT_RULE_S *pSort = (MSG_SORT_RULE_S *)sort_info;
switch(field)
{
result = pSort->sortType;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_folder_info_get_int(void *folder_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_FOLDER_INFO_S *pFolder = (MSG_FOLDER_INFO_S *)folder_info;
switch(field)
{
result = pFolder->folderType;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_thread_info_get_int(void *data, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data;
switch(field)
result = pThread->threadId;
break;
case MSG_THREAD_MSG_TYPE_INT :
- result = msg_thread_get_msg_type(pThread->mainType, pThread->subType);
+ result = msg_get_msg_type(pThread->mainType, pThread->subType);
break;
case MSG_THREAD_MSG_TIME_INT :
result = pThread->threadTime;
result = pThread->mmsCnt;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
+ break;
+ }
+ return result;
+}
+
+
+int msg_conv_info_get_int(void *data, int field)
+{
+ int result = MSG_ERR_INVALID_PARAMETER;
+ MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
+
+ switch(field)
+ {
+ case MSG_CONV_MSG_ID_INT :
+ result = pConv->msgId;
+ break;
+ case MSG_CONV_MSG_THREAD_ID_INT :
+ result = pConv->threadId;
+ break;
+ case MSG_CONV_MSG_FOLDER_ID_INT :
+ result = pConv->folderId;
+ break;
+ case MSG_CONV_MSG_TYPE_INT :
+ result = msg_get_msg_type(pConv->mainType, pConv->subType);
+ break;
+ case MSG_CONV_MSG_STORAGE_ID_INT :
+ result = pConv->storageId;
+ break;
+ case MSG_CONV_MSG_DISPLAY_TIME_INT :
+ result = pConv->displayTime;
+ break;
+ case MSG_CONV_MSG_SCHEDULED_TIME_INT :
+ result = pConv->scheduledTime;
+ break;
+ case MSG_CONV_MSG_NETWORK_STATUS_INT :
+ result = pConv->networkStatus;
+ break;
+ case MSG_CONV_MSG_DIRECTION_INT :
+ result = pConv->direction;
+ break;
+ case MSG_CONV_MSG_ATTACH_COUNT_INT :
+ result = pConv->attachCount;
+ break;
+ case MSG_CONV_MSG_TEXT_SIZE_INT :
+ result = pConv->textSize;
+ break;
+ case MSG_CONV_MSG_PAGE_COUNT_INT :
+ result = pConv->pageCount;
+ break;
+ default:
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
}
+
int msg_search_condition_get_int(void *condition_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_SEARCH_CONDITION_S *pCond = (MSG_SEARCH_CONDITION_S *)condition_info;
switch(field)
{
result = pCond->reserved;
break;
default:
- result = -1;
+ result = MSG_ERR_INVALID_PARAMETER;
break;
}
return result;
int msg_report_status_get_int(void *report_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
switch(field)
{
- case MSG_REPORT_STATUS_DELIVERY_STATUS_INT:
- result = pReport->deliveryStatus;
+ case MSG_REPORT_TYPE_INT:
+ result = pReport->type;
break;
- case MSG_REPORT_STATUS_DELIVERY_TIME_INT:
- result = pReport->deliveryStatusTime;
+ case MSG_REPORT_STATUS_INT:
+ result = pReport->status;
break;
- case MSG_REPORT_STATUS_READ_STATUS_INT:
- result = pReport->readStatus;
+ case MSG_REPORT_TIME_INT:
+ result = pReport->statusTime;
break;
- case MSG_REPORT_STATUS_READ_TIME_INT:
- result = pReport->readStatusTime;
+
+ default:
+ result = MSG_ERR_INVALID_PARAMETER;
break;
+ }
+ return result;
+}
+
+char* msg_report_status_get_str(void *report_info, int field)
+{
+ char *result = NULL;
+ MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
+ switch(field)
+ {
+
+ case MSG_REPORT_ADDRESS_STR:
+ result = pReport->addressVal;
+ break;
+
default:
- result = -1;
break;
}
return result;
return ret_str;
}
+
+char *msg_conv_info_get_str(void *data, int field)
+{
+ char *ret_str = NULL;
+ MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
+
+ switch(field)
+ {
+ case MSG_CONV_MSG_SUBJECT_STR :
+ ret_str = pConv->subject;
+ break;
+ case MSG_CONV_MSG_ATTACH_NAME_STR :
+ ret_str = pConv->attachFileName;
+ break;
+ case MSG_CONV_MSG_AUDIO_NAME_STR :
+ ret_str = pConv->audioFileName;
+ break;
+ case MSG_CONV_MSG_IMAGE_THUMB_PATH_STR :
+ ret_str = pConv->imageThumbPath;
+ break;
+ case MSG_CONV_MSG_VIDEO_THUMB_PATH_STR :
+ ret_str = pConv->videoThumbPath;
+ break;
+ case MSG_CONV_MSG_TEXT_STR :
+ ret_str = pConv->pText;
+ break;
+ default:
+ break;
+ }
+
+ return ret_str;
+}
+
+
char* msg_search_condition_get_str(void *condition_info, int field, int size)
{
char *result = NULL;
return result;
}
+bool msg_conv_get_bool(void *data, int field)
+{
+ bool result = false;
+ MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data;
+ switch(field)
+ {
+ case MSG_CONV_MSG_READ_BOOL:
+ result = pConv->bRead;
+ break;
+ case MSG_CONV_MSG_PROTECTED_BOOL:
+ result = pConv->bProtected;
+ break;
+ default:
+ break;
+ }
+ return result;
+}
+
+bool msg_thread_info_get_bool(void *data, int field)
+{
+ bool result = false;
+ MSG_THREAD_VIEW_S *pthreadInfo = (MSG_THREAD_VIEW_S *)data;
+ switch(field)
+ {
+ case MSG_THREAD_PROTECTED_BOOL:
+ result = pthreadInfo->bProtected;
+ break;
+ default:
+ break;
+ }
+ return result;
+}
+
int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **value)
{
msg_error_t err = MSG_SUCCESS;
int msg_address_info_get_int(void *addr_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_ADDRESS_INFO_S *pAddr = (MSG_ADDRESS_INFO_S *)addr_info;
switch(field)
{
}
int msg_mms_sendopt_get_int(void *opt_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MMS_SENDINGOPT_S *pOpt = (MMS_SENDINGOPT_S *)opt_info;
switch(field)
{
int msg_reject_message_get_int(void *msg_info, int field)
{
- int result = -1;
+ int result = MSG_ERR_INVALID_PARAMETER;
MSG_REJECT_MSG_INFO_S *pMsg = (MSG_REJECT_MSG_INFO_S *)msg_info;
switch(field)
{
if(!report_info)
return MSG_ERR_NULL_POINTER;
- MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
- switch(field)
- {
- case MSG_REPORT_STATUS_DELIVERY_STATUS_INT:
- pReport->deliveryStatus = value;
- break;
- case MSG_REPORT_STATUS_DELIVERY_TIME_INT:
- pReport->deliveryStatusTime = value;
+ MSG_REPORT_STATUS_INFO_S *pReport = (MSG_REPORT_STATUS_INFO_S *)report_info;
+ switch(field)
+ {
+ case MSG_REPORT_TYPE_INT:
+ pReport->type = value;
break;
- case MSG_REPORT_STATUS_READ_STATUS_INT:
- pReport->readStatus = value;
+ case MSG_REPORT_STATUS_INT:
+ pReport->status = value;
break;
- case MSG_REPORT_STATUS_READ_TIME_INT:
- pReport->readStatusTime = value;
+ case MSG_REPORT_TIME_INT:
+ pReport->statusTime = value;
break;
- default:
+
+ default:
err = MSG_ERR_UNKNOWN;
break;
- }
+ }
return err;
}
#include <string.h>
+#include "MsgDebug.h"
#include "MsgTypes.h"
#include "MsgHandle.h"
+#include "MsgTextConvert.h"
#include "MsgException.h"
#include "msg_private.h"
case MSG_STRUCT_MESSAGE_INFO :
msg_message_create_struct(msg_struct);
break;
+ case MSG_STRUCT_CONV_INFO:
+ {
+ msg_struct->data = (void *)new MSG_CONVERSATION_VIEW_S;
+ memset(msg_struct->data, 0x00, sizeof(MSG_CONVERSATION_VIEW_S));
+ break;
+ }
case MSG_STRUCT_FILTER:
{
msg_struct->data = (void *)new MSG_FILTER_S;
*msg_struct_handle = NULL;
break;
}
+ case MSG_STRUCT_CONV_INFO:
+ {
+ MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S*)(msg_struct->data);
+
+ if (pConv->pText) {
+ delete [] pConv->pText;
+ pConv->pText = NULL;
+ }
+
+ delete pConv;
+ msg_struct->data = NULL;
+
+ delete msg_struct;
+ *msg_struct_handle = NULL;
+ break;
+ }
case MSG_STRUCT_THREAD_INFO:
{
delete (MSG_THREAD_VIEW_S*)(msg_struct->data);
*msg_struct_handle = NULL;
break;
}
+ case MSG_STRUCT_ADDRESS_INFO :
+ {
+ delete (MSG_ADDRESS_INFO_S*)(msg_struct->data);
+ msg_struct->data = NULL;
+
+ delete msg_struct;
+ *msg_struct_handle = NULL;
+ break;
+ }
case MSG_STRUCT_PUSH_CONFIG_INFO:
{
delete (MSG_PUSH_EVENT_INFO_S*)(msg_struct->data);
}
if(msg_struct_list->nCount > 0) {
- for(int i = 0; i < msg_struct_list->nCount; i++) {
+ int structType = ((msg_struct_s *)msg_struct_list->msg_struct_info[0])->type;
+ int listCnt = msg_struct_list->nCount;
+
+ switch (structType)
+ {
+ case MSG_STRUCT_ADDRESS_INFO :
+ {
+ listCnt = MAX_TO_ADDRESS_CNT;
+ break;
+ }
+ default :
+ break;
+ }
+
+ for(int i = 0; i < listCnt; i++) {
msg_release_struct(&(msg_struct_list->msg_struct_info[i]));
}
}
case MSG_STRUCT_THREAD_INFO :
*value = msg_thread_info_get_int(msg_struct->data, field);
break;
+ case MSG_STRUCT_CONV_INFO :
+ *value = msg_conv_info_get_int(msg_struct->data, field);
+ break;
case MSG_STRUCT_SEARCH_CONDITION :
*value = msg_search_condition_get_int(msg_struct->data, field);
break;
else
strncpy(src, ret_str, size);
break;
+ case MSG_STRUCT_CONV_INFO :
+ ret_str = msg_conv_info_get_str(msg_struct->data, field);
+ if (ret_str == NULL)
+ err = MSG_ERR_UNKNOWN;
+ else
+ strncpy(src, ret_str, size);
+ break;
case MSG_STRUCT_SEARCH_CONDITION :
ret_str = msg_search_condition_get_str(msg_struct->data, field, size);
if (ret_str == NULL)
else
strncpy(src, ret_str, size);
break;
+ case MSG_STRUCT_REPORT_STATUS_INFO:
+ ret_str = msg_report_status_get_str(msg_struct->data, field);
+ if (ret_str == NULL)
+ err = MSG_ERR_UNKNOWN;
+ else
+ strncpy(src, ret_str, size);
+ break;
case MSG_STRUCT_CB_MSG :
err = msg_cb_message_get_str_value(msg_struct->data, field, src, size);
+ break;
default :
err = MSG_ERR_INVALID_PARAMETER;
break;
switch (msg_struct->type)
{
+ case MSG_STRUCT_FILTER :
+ *value = msg_get_filter_info_bool(msg_struct->data, field);
+ break;
case MSG_STRUCT_MESSAGE_INFO :
err = msg_message_get_bool_value(msg_struct->data, field, value);
break;
+ case MSG_STRUCT_THREAD_INFO :
+ *value = msg_thread_info_get_bool(msg_struct->data, field);
+ break;
+ case MSG_STRUCT_CONV_INFO:
+ *value = msg_conv_get_bool(msg_struct->data, field);
+ break;
case MSG_STRUCT_SENDOPT:
*value = msg_sendopt_get_bool(msg_struct->data, field);
break;
switch (msg_struct->type)
{
+ case MSG_STRUCT_FILTER :
+ err = msg_set_filter_info_bool(msg_struct->data, field, value);
+ break;
case MSG_STRUCT_MESSAGE_INFO :
err = msg_message_set_bool_value(msg_struct->data, field, value);
break;
{
return (int)g_list_length((GList *)list_handle);
}
+
+
+EXPORT_API int msg_calculate_text_length(msg_handle_t handle, const char* msg_text, msg_encode_type_t msg_encode_type, unsigned int *text_size, unsigned int *segment_size)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ try
+ {
+ if (msg_text == NULL || strlen(msg_text) == 0) {
+ err = MSG_ERR_INVALID_PARAMETER;
+ return err;
+ }
+ }
+ catch (exception& e)
+ {
+ MSG_FATAL("%s", e.what());
+ err = MSG_ERR_INVALID_PARAMETER;
+ return err;
+ }
+
+ msg_encode_type_t encodeType = MSG_ENCODE_AUTO;
+ MSG_LANGUAGE_ID_T langId = MSG_LANG_ID_RESERVED;
+
+ int decodeLen = 0;
+ int bufSize = (160*MAX_SEGMENT_NUM) + 1;
+ int textSize = 0;
+
+ textSize = strlen(msg_text);
+
+ unsigned char decodeData[bufSize];
+ memset(decodeData, 0x00, sizeof(decodeData));
+
+ MsgTextConvert textCvt;
+
+ *text_size = 0;
+ *segment_size = 0;
+
+ switch (msg_encode_type)
+ {
+ case MSG_ENCODE_GSM7BIT :
+ decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId);
+ break;
+ case MSG_ENCODE_UCS2 :
+ decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (const unsigned char*)msg_text, textSize);
+ break;
+ case MSG_ENCODE_AUTO :
+ decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &encodeType);
+ break;
+ default :
+ err = MSG_ERR_INVALID_PARAMETER;
+ break;
+ }
+
+ // calculate segment size.
+ int headerLen = 1;
+ int concat = 5;
+ int lang = 3;
+
+ int headerSize = 0;
+ int segSize = 0;
+
+ if (langId != MSG_LANG_ID_RESERVED) {
+ MSG_DEBUG("National Language Exists");
+ headerSize += lang;
+ }
+
+ if (msg_encode_type == MSG_ENCODE_GSM7BIT || encodeType == MSG_ENCODE_GSM7BIT) {
+ MSG_DEBUG("MSG_ENCODE_GSM7BIT");
+
+ if (((decodeLen+headerSize)/160) > 1)
+ segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
+ else
+ segSize = 160;
+
+ } else if (msg_encode_type == MSG_ENCODE_UCS2 || encodeType == MSG_ENCODE_UCS2) {
+ MSG_DEBUG("MSG_ENCODE_UCS2");
+
+ if (((decodeLen+headerSize)/140) > 1)
+ segSize = 140 - (headerLen + concat + headerSize);
+ else
+ segSize = 140;
+ } else {
+ MSG_DEBUG("Unsupported encode type.");
+ err = MSG_ERR_INVALID_PARAMETER;
+ return err;
+ }
+
+ *text_size = decodeLen;
+ *segment_size = segSize;
+
+ return err;
+}
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <request>
+ <domain name="msg-service"/>
+ </request>
+</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="msg-service" policy="restricted" plist="msg-service-tools"/>
+ <provide>
+ <label name="msg-service::db"/>
+ </provide>
+ </define>
+ <request>
+ <domain name="msg-service"/>
+ </request>
+</manifest>
--- /dev/null
+
+[Unit]
+Description=Start the msg-server
+
+[Service]
+ExecStart=/usr/bin/msg-server
+
+[Install]
+WantedBy=tizen-middleware.target
+
Name: msg-service
-Version: 0.9.0
+Version: 0.9.2
Release: 1
License: Samsung
Summary: Messaging Framework Library
Requires(post): /usr/bin/vconftool
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
+Requires(post): systemd
+Requires(postun): systemd
BuildRequires: cmake
BuildRequires: pkgconfig(alarm-service)
BuildRequires: pkgconfig(aul)
%package devel
-License: Apache License v2.0
+License: Flora License v1.0
Summary: Messaging Framework Library (development)
Requires: %{name} = %{version}-%{release}
Group: Development/Libraries
%package tools
-License: Apache License v2.0
+License: Flora License v1.0
Summary: Messaging server application
Requires: %{name} = %{version}-%{release}
Group: TO_BU / FILL_IN
%package -n sms-plugin
-License: Apache License v2.0
+License: Flora License v1.0
Summary: SMS plugin library
Requires: %{name} = %{version}-%{release}
Group: System/Libraries
Description: SMS plugin library
%package -n mms-plugin
-License: Apache License v2.0
+License: Flora License v1.0
Summary: MMS plugin library
Requires: %{name} = %{version}-%{release}
Group: System/Libraries
make %{?jobs:-j%jobs}
%install
-
rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+
%make_install
+mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
+ln -s %{_libdir}/systemd/user/msg-service.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/msg-service.service
+
mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d
ln -s %{_sysconfdir}/rc.d/init.d/msg-server %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S70msg-server
mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d
ln -s %{_sysconfdir}/rc.d/init.d/msg-server %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S70msg-server
-
-
-mkdir -p %{buildroot}/opt/data/msg-service
+mkdir -p %{buildroot}/opt/usr/data/msg-service
%post tools -p /sbin/ldconfig
%post -n sms-plugin -p /sbin/ldconfig
%post
/sbin/ldconfig
-if [ ! -f /opt/dbspace/.msg_service.db ]
+if [ ! -f /opt/usr/dbspace/.msg_service.db ]
then
- sqlite3 /opt/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;
+ mkdir -p %{buildroot}/opt/usr/dbspace/
+ sqlite3 /opt/usr/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;
CREATE TABLE MSG_CONVERSATION_TABLE ( CONV_ID INTEGER NOT NULL , UNREAD_CNT INTEGER DEFAULT 0 , SMS_CNT INTEGER DEFAULT 0 , MMS_CNT INTEGER DEFAULT 0 , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , MSG_DIRECTION INTEGER NOT NULL , DISPLAY_TIME INTEGER , DISPLAY_NAME TEXT , MSG_TEXT TEXT );
CREATE TABLE MSG_ADDRESS_TABLE ( ADDRESS_ID INTEGER PRIMARY KEY , CONV_ID INTEGER NOT NULL , ADDRESS_TYPE INTEGER , RECIPIENT_TYPE INTEGER , ADDRESS_VAL TEXT , CONTACT_ID INTEGER , DISPLAY_NAME TEXT , FIRST_NAME TEXT , LAST_NAME TEXT , IMAGE_PATH TEXT , SYNC_TIME DATETIME , FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) );
CREATE TABLE MSG_FOLDER_TABLE ( FOLDER_ID INTEGER PRIMARY KEY , FOLDER_NAME TEXT NOT NULL , FOLDER_TYPE INTEGER DEFAULT 0 );
- CREATE TABLE MSG_MESSAGE_TABLE ( MSG_ID INTEGER PRIMARY KEY , CONV_ID INTEGER NOT NULL , FOLDER_ID INTEGER NOT NULL , STORAGE_ID INTEGER NOT NULL , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , DISPLAY_TIME DATETIME , DATA_SIZE INTEGER DEFAULT 0 , NETWORK_STATUS INTEGER DEFAULT 0 , READ_STATUS INTEGER DEFAULT 0 , PROTECTED INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , MSG_DIRECTION INTEGER NOT NULL , SCHEDULED_TIME DATETIME , BACKUP INTEGER DEFAULT 0 , SUBJECT TEXT , MSG_DATA TEXT , THUMB_PATH TEXT , MSG_TEXT TEXT , DELIVERY_REPORT_STATUS INTEGER DEFAULT 0 , DELIVERY_REPORT_TIME DATETIME , READ_REPORT_STATUS INTEGER DEFAULT 0 , READ_REPORT_TIME DATETIME , ATTACHMENT_COUNT INTEGER DEFAULT 0 , FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) , FOREIGN KEY (FOLDER_ID) REFERENCES MSG_FOLDER_TABLE (FOLDER_ID) );
+ CREATE TABLE MSG_MESSAGE_TABLE ( MSG_ID INTEGER PRIMARY KEY , CONV_ID INTEGER NOT NULL , FOLDER_ID INTEGER NOT NULL , STORAGE_ID INTEGER NOT NULL , MAIN_TYPE INTEGER NOT NULL , SUB_TYPE INTEGER NOT NULL , DISPLAY_TIME DATETIME , DATA_SIZE INTEGER DEFAULT 0 , NETWORK_STATUS INTEGER DEFAULT 0 , READ_STATUS INTEGER DEFAULT 0 , PROTECTED INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , MSG_DIRECTION INTEGER NOT NULL , SCHEDULED_TIME DATETIME , BACKUP INTEGER DEFAULT 0 , SUBJECT TEXT , MSG_DATA TEXT , THUMB_PATH TEXT , MSG_TEXT TEXT , ATTACHMENT_COUNT INTEGER DEFAULT 0 , FOREIGN KEY (CONV_ID) REFERENCES MSG_CONVERSATION_TABLE (CONV_ID) , FOREIGN KEY (FOLDER_ID) REFERENCES MSG_FOLDER_TABLE (FOLDER_ID) );
CREATE TABLE MSG_SIM_TABLE ( MSG_ID INTEGER , SIM_ID INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
CREATE TABLE MSG_PUSH_TABLE ( MSG_ID INTEGER , ACTION INTEGER , CREATED INTEGER , EXPIRES INTEGER , ID TEXT , HREF TEXT , CONTENT TEXT , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
CREATE TABLE MSG_CBMSG_TABLE ( MSG_ID INTEGER , CB_MSG_ID INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
CREATE TABLE MSG_SYNCML_TABLE ( MSG_ID INTEGER , EXT_ID INTEGER NOT NULL , PINCODE INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
CREATE TABLE MSG_SMS_SENDOPT_TABLE ( MSG_ID INTEGER , DELREP_REQ INTEGER NOT NULL , KEEP_COPY INTEGER NOT NULL , REPLY_PATH INTEGER NOT NULL , FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) );
- CREATE TABLE MSG_FILTER_TABLE ( FILTER_ID INTEGER PRIMARY KEY , FILTER_TYPE INTEGER NOT NULL , FILTER_VALUE TEXT NOT NULL );
+ CREATE TABLE MSG_FILTER_TABLE ( FILTER_ID INTEGER PRIMARY KEY , FILTER_TYPE INTEGER NOT NULL , FILTER_VALUE TEXT NOT NULL , FILTER_ACTIVE INTEGER DEFAULT 0);
CREATE TABLE MSG_MMS_MESSAGE_TABLE ( MSG_ID INTEGER , TRANSACTION_ID TEXT , MESSAGE_ID TEXT , FWD_MESSAGE_ID TEXT , CONTENTS_LOCATION TEXT , FILE_PATH TEXT , VERSION INTEGER NOT NULL , DATA_TYPE INTEGER DEFAULT -1 , DATE DATETIME , HIDE_ADDRESS INTEGER DEFAULT 0 , ASK_DELIVERY_REPORT INTEGER DEFAULT 0 , REPORT_ALLOWED INTEGER DEFAULT 0 , READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0 , ASK_READ_REPLY INTEGER DEFAULT 0 , READ INTEGER DEFAULT 0 , READ_REPORT_SEND_STATUS INTEGER DEFAULT 0 , READ_REPORT_SENT INTEGER DEFAULT 0 , PRIORITY INTEGER DEFAULT 0 , KEEP_COPY INTEGER DEFAULT 0 , MSG_SIZE INTEGER NOT NULL , MSG_CLASS INTEGER DEFAULT -1 , EXPIRY_TIME DATETIME , CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0 , DELIVERY_TIME DATETIME , MSG_STATUS INTEGER DEFAULT -1 , FOREIGN KEY (MSG_ID) REFERENCES MSG_MESSAGE_TABLE (MSG_ID) );
+ CREATE TABLE MSG_MMS_PREVIEW_INFO_TABLE ( MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER, PRIMARY KEY (MSG_ID, TYPE) ON CONFLICT REPLACE FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID) ON DELETE CASCADE);
+ CREATE TABLE MSG_REPORT_TABLE ( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
CREATE TABLE MSG_PUSHCFG_TABLE ( PUSH_ID INTEGER , CONTENT_TYPE TEXT, APP_ID TEXT, PKG_NAME TEXT, LAUNCH INTEGER, APPCODE INTEGER, SECURE INTEGER);
CREATE INDEX MSG_CONVERSATION_INDEX ON MSG_CONVERSATION_TABLE(CONV_ID);
INSERT INTO MSG_PUSHCFG_TABLE VALUES (35, 'application/vnd.wap.emn+wbxml', 'X-oma-docomo:xmd.mail.ua', '', 0, 45, 1);"
fi
-chown :6011 /opt/dbspace/.msg_service.db
-chown :6011 /opt/dbspace/.msg_service.db-journal
-
-
-chmod 660 /opt/dbspace/.msg_service.db
-chmod 660 /opt/dbspace/.msg_service.db-journal
-
+chown :6011 /opt/usr/dbspace/.msg_service.db
+chown :6011 /opt/usr/dbspace/.msg_service.db-journal
+chmod 660 /opt/usr/dbspace/.msg_service.db
+chmod 660 /opt/usr/dbspace/.msg_service.db-journal
+mkdir -p /opt/usr/data/msg-service
+chgrp db_msg_service /opt/usr/data/msg-service
########## Setting Config Value (Internal keys) ##########
# Message Server Status
-vconftool set -t bool memory/msg/ready 0 -i
+vconftool set -t bool memory/msg/ready 0 -i -g 5000
# SMS Send Options
vconftool set -t int db/msg/network_mode 2
# General Options
vconftool set -t bool db/private/msg-service/general/keep_copy 1
vconftool set -t bool db/private/msg-service/general/auto_erase 0
-vconftool set -t bool db/private/msg-service/general/block_msg 0
+vconftool set -t bool db/private/msg-service/general/block_msg 1
vconftool set -t int db/private/msg-service/general/contact_sync_time 0
# SMS Send Options
vconftool set -t bool db/private/msg-service/cb_msg/language/9 0
# Voice Mail Options
-vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number ""
+vconftool set -t string db/private/msg-service/voice_mail/voice_mail_number "5500" -f
+vconftool set -t int db/private/msg-service/voice_mail/voice_mail_count 0
# MMS Size Options
vconftool set -t int db/private/msg-service/size_opt/msg_size 300
vconftool set -t string memory/private/msg-service/sim_imsi "" -i
vconftool set -t bool memory/private/msg-service/national_sim 0 -i
+/sbin/ldconfig
+/bin/systemctl daemon-reload
+if [ "$1" = "1" ]; then
+ systemctl stop msg-service.service
+fi
+
%postun -p /sbin/ldconfig
%postun tools -p /sbin/ldconfig
%postun -n mms-plugin -p /sbin/ldconfig
%files
+%manifest msg-service.manifest
%defattr(-,root,root,-)
-%dir /opt/data/msg-service
+%dir %attr(775,root,db_msg_service) /opt/usr/data/msg-service
%{_libdir}/libmsg_plugin_manager.so
%{_libdir}/libmsg_mapi.so.*
%{_libdir}/libmsg_framework_handler.so
%{_libdir}/libmsg_transaction_manager.so
%{_libdir}/libmsg_utils.so
%{_libdir}/libmsg_transaction_proxy.so
-%{_sysconfdir}/rc.d/init.d/msg-server
-%{_sysconfdir}/rc.d/rc3.d/S70msg-server
-%{_sysconfdir}/rc.d/rc5.d/S70msg-server
+/usr/share/license/msg-service/LICENSE
%files devel
%defattr(-,root,root,-)
%{_includedir}/msg-service/*
%files tools
+%manifest msg-service-tools.manifest
%defattr(-,root,root,-)
%{_bindir}/msg-helper
%{_bindir}/msg-server
%{_datadir}/media/Sherbet.wav
%attr(0644,root,root)/usr/share/msg-service/plugin.cfg
+%{_sysconfdir}/rc.d/init.d/msg-server
+%{_sysconfdir}/rc.d/rc3.d/S70msg-server
+%{_sysconfdir}/rc.d/rc5.d/S70msg-server
+%{_libdir}/systemd/user/msg-service.service
+%{_libdir}/systemd/user/tizen-middleware.target.wants/msg-service.service
+/usr/share/license/msg-service/LICENSE
%files -n sms-plugin
+%manifest sms-plugin.manifest
%defattr(-,root,root,-)
%{_libdir}/libmsg_sms_plugin.so
+/usr/share/license/msg-service/LICENSE
%files -n mms-plugin
+%manifest mms-plugin.manifest
%defattr(-,root,root,-)
%{_libdir}/libmsg_mms_plugin.so
%{_libdir}/libmsg_mms_language_pack.so
+/usr/share/license/msg-service/LICENSE
%changelog
+* Wed Oct 25 2012 Sangkoo Kim <sangkoo.kim@samsung.com>
+- New release version
+
* Wed Aug 8 2012 KeeBum Kim <keebum.kim@samsung.com>
- Apply New TAPI.
- Modify transaction data size of sos recipient list.
#define MAX_ASCII 256
#define MAX_ASCII_NUM 255
-static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len);
+//static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len);
static UINT __WmLngLatin12UnicodeN(MCHAR *pOutStr, UCHAR *pInputStr, UINT len);
static int __WmLngConvertLatin12Unicode (MCHAR *des, UCHAR *str, UINT len);
*
* @see
*/
+/* Unused....
static void __WmLngReverseKeyCode(UCHAR *pOutStr, MCHAR *pInputStr, UINT len)
{
UCHAR *rear=NULL;
pInputStr = p;
}
}
-
+*/
/*
* This function convert character Localcode(Latin1) to Processcode(Unicode)
#include "MmsPluginMIME.h"
#include "MmsPluginMessage.h"
#include "MmsPluginWmLngPack.h"
-
+#include "MmsPluginUtil.h"
const int MSG_MAX_CH_PER_LINE = 75;
/* ==================================================================
return MmsDebugPrintUnknownValue(dataType);
}
}
-
-#ifdef MMS_PLUGIN_DEBUG_ENABLE
-bool
-MmsDebugPrintMsgAttributes(char *pszFunc, MmsAttrib *pAttrib, bool bAll)
-{
- SysRequireEx(pAttrib != NULL, false);
-
- if (pszFunc)
- SysDebug((MID_MMS|DBG_MMS_COMMON,"%s ========= \n", pszFunc));
-
- SysDebug((MID_MMS|DBG_MMS_COMMON, "szSubject = %s \n", pAttrib->szSubject));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "contentType=%s \n", MmsDebugGetMimeType(pAttrib->contentType)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "dataType=%s \n", MmsDebugGetDataType(pAttrib->dataType)));
-
- if (pAttrib->specialMsgType != MMS_SPECIAL_MSG_TYPE_NONE)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "spcialMsgType = %lu \n", pAttrib->specialMsgType));
-
- SysDebug((MID_MMS|DBG_MMS_COMMON, "date=%lu, msgSize=%lu, bRead=%lu\n", pAttrib->date, pAttrib->msgSize, pAttrib->bRead));
-
- if (!bAll)
- return true;
-
- SysDebug((MID_MMS|DBG_MMS_COMMON, "msgClass=%s, priority=%lu \n", MmsDebugGetMsgClass(pAttrib->msgClass), pAttrib->priority ));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "deliveryTime.type = %lu, time = %lu\n", pAttrib->deliveryTime.type, pAttrib->deliveryTime.time));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "expiryTime.type = %lu, time = %lu\n", pAttrib->expiryTime.type, pAttrib->expiryTime.time));
-
- if (pAttrib->szTo && pAttrib->szTo[0] != 0)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "szTo = %s \n", pAttrib->szTo));
- if (pAttrib->szCc && pAttrib->szCc[0] != 0)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "szCc = %s \n", pAttrib->szCc));
- if (pAttrib->szBcc && pAttrib->szBcc[0] != 0)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "szBcc = %s \n", pAttrib->szBcc));
-
-#if defined(_MMS_SUPPORT_RECEIVING_OPTION_PROMPT)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "readReportAllowedType = %lu \n", pAttrib->readReportAllowedType));
-#endif
- SysDebug((MID_MMS|DBG_MMS_COMMON, "bAskDeliveryReport=%lu, bReportAllowed=%lu, bAskReadReply=%lu, bLeaveCopy=%lu \n",
- pAttrib->bAskDeliveryReport, pAttrib->bReportAllowed, pAttrib->bAskReadReply, pAttrib->bLeaveCopy));
-
- if (pAttrib->bHideAddress)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "bHideAddress=true\n"));
-
- SysDebug((MID_MMS|DBG_MMS_COMMON, "msgStatus = %s \n", MmsDebugGetMsgStatus(pAttrib->msgStatus)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "responseStatus = %s \n", MmsDebugGetResponseStatus(pAttrib->responseStatus)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "retrieveStatus = %s \n", MmsDebugGetRetrieveStatus(pAttrib->retrieveStatus)));
-
- if (pAttrib->szResponseText && pAttrib->szResponseText[0] != 0)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "szResponseText = %s \n", pAttrib->szResponseText));
-
- if (pAttrib->szRetrieveText && pAttrib->szRetrieveText[0] != 0)
- SysDebug((MID_MMS|DBG_MMS_COMMON, "szRetrieveText = %s \n", pAttrib->szRetrieveText));
-
- return true;
-}
-
-char *MmsDebugGetMsgDrmType(MsgDrmType drmType)
-{
- switch (drmType) {
- case MSG_DRM_TYPE_NONE:
- return "MSG_DRM_TYPE_NONE";
- case MSG_DRM_TYPE_FL:
- return "MSG_DRM_TYPE_FL";
- case MSG_DRM_TYPE_CD:
- return "MSG_DRM_TYPE_CD";
- case MSG_DRM_TYPE_SD:
- return "MSG_DRM_TYPE_SD";
- case MSG_DRM_TYPE_SSD:
- return "MSG_DRM_TYPE_SSD";
- }
-
- return MmsDebugPrintUnknownValue(drmType);
-}
-
-char *MmsDebugGetDrmDeliveryMode(DrmDeliveryMode deliveryMode)
-{
- switch (deliveryMode) {
- case DRM_DELIVERYMODE_FORWARD_LOCK:
- return "DRM_DELIVERYMODE_FORWARD_LOCK";
- case DRM_DELIVERYMODE_COMBINED_DELIVERY:
- return "DRM_DELIVERYMODE_COMBINED_DELIVERY";
- case DRM_DELIVERYMODE_SEPARATE_DELIVERY:
- return "DRM_DELIVERYMODE_SEPARATE_DELIVERY";
- case DRM_DELIVERYMODE_SPECIAL_SEPARATE:
- return "DRM_DELIVERYMODE_SPECIAL_SEPARATE";
- }
-
- return MmsDebugPrintUnknownValue(deliveryMode);
-}
-
-char *MmsDebugGetDrmRightState(DrmRightState rightState)
-{
- switch (rightState) {
- case DRMRIGHT_STATE_NORIGHTS:
- return "DRMRIGHT_STATE_NORIGHTS";
- case DRMRIGHT_STATE_INVALID_RIGHTS:
- return "DRMRIGHT_STATE_INVALID_RIGHTS";
- case DRMRIGHT_STATE_VALID_RIGHTS:
- return "DRMRIGHT_STATE_VALID_RIGHTS";
- case DRMRIGHT_STATE_EXPIRED_RIGHTS:
- return "DRMRIGHT_STATE_EXPIRED_RIGHTS";
- }
-
- return MmsDebugPrintUnknownValue(rightState);
-}
-
-
-bool MmsDebugPrintDrmRight(DrmRight *pDrmRight)
-{
- if (!pDrmRight)
- return true;
-
- if (pDrmRight->rightStatus == DRMRIGHT_STATE_NORIGHTS) {
- SysDebug((MID_MMS|DBG_MMS_COMMON, "rightStatus = %s \n", MmsDebugGetDrmRightState(pDrmRight->rightStatus)));
- return true;
- }
-
- SysDebug((MID_MMS|DBG_MMS_COMMON, "iDeliveryType = %s \n", MmsDebugGetDrmDeliveryMode(pDrmRight->iDeliveryType)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "bestConstraint = %s \n", MmsDebugGetDrmConsumeMode(pDrmRight->bestConstraint)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "bFirstIntervalRender = %d \n", pDrmRight->bFirstIntervalRender));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "rightStatus = %s \n", MmsDebugGetDrmRightState(pDrmRight->rightStatus)));
-
- SysDebug((MID_MMS|DBG_MMS_COMMON, "bValidIssuer = %d \n", pDrmRight->bValidIssuer));
-
- return true;
-}
-
-char *MmsDebugPrintMsgDRMStatus(MsgDRMStatus status)
-{
- switch (status) {
- case MSG_DRM_STATUS_INVALID:
- return "MSG_DRM_STATUS_INVALID";
- case MSG_DRM_STATUS_VALID:
- return "MSG_DRM_STATUS_VALID";
- case MSG_DRM_STATUS_EXPIRED:
- return "MSG_DRM_STATUS_EXPIRED";
- }
-
- return MmsDebugPrintUnknownValue(status);
-}
-
-
-bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index)
-{
- SysDebug((MID_MMS|DBG_MMS_COMMON, "------------------------------\n"));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "%dth multipart info\n", index));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "header size=%d\n", pMultipart->type.size));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "body size=%d\n", pMultipart->type.contentSize));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "content type=%s\n", MmsDebugGetMimeType(pMultipart->type.type)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "content ID=%s\n", pMultipart->type.szContentID));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "content location=%s\n", pMultipart->type.szContentLocation));
-
- if (pMultipart->type.type == MIME_TEXT_PLAIN) {
- SysDebug((MID_MMS|DBG_MMS_COMMON, "text info\n"));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "charset=%d\n", pMultipart->type.param.charset));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "text file name=%s\n", pMultipart->type.param.szName));
- }
-
- if (pMultipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) {
- SysDebug((MID_MMS|DBG_MMS_COMMON, "drm info\n"));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "drm type=%s\n", MmsDebugGetMsgDrmType(pMultipart->type.drmInfo.drmType)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "drm content type=%s\n", MmsDebugGetMimeType(pMultipart->type.drmInfo.contentType)));
- SysDebug((MID_MMS|DBG_MMS_COMMON, "drm content URI=%s\n", pMultipart->type.drmInfo.szContentURI));
- }
- SysDebug((MID_MMS|DBG_MMS_COMMON, "------------------------------\n"));
- return true;
-}
-
-
-bool MmsDebugPrintCurrentEventHandler(char *pszFunc, MmsDebugEvType evType)
-{
- HEventHandler hMmsEH;
- HEventHandler hSmsEH;
- HEventHandler hEmailEH;
- HEventHandler hCommonEH;
- HEventHandler hCurrentEH;
-
- hMmsEH = WmGetEventHandlerByName(EHN_MMS);
- hSmsEH = WmGetEventHandlerByName(EHN_SMS);
- hEmailEH = WmGetEventHandlerByName(EHN_EMAIL);
- hCommonEH = WmGetEventHandlerByName(EHN_MESSENGER);
- hCurrentEH = WmGetCurrentEventHandler();
-
- switch (evType) {
- case MMS_DEBUG_EV_MMS:
- SysRequireExf(hCurrentEH == hMmsEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \
- pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
- break;
-
- case MMS_DEBUG_EV_SMS:
- SysRequireExf(hCurrentEH == hSmsEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \
- pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
- break;
-
- case MMS_DEBUG_EV_COMMON:
- SysRequireExf(hCurrentEH == hCommonEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \
- pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
- break;
-
- case MMS_DEBUG_EV_EMAIL:
- SysRequireExf(hCurrentEH == hEmailEH, false, ("%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \
- pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
- break;
-
- case MMS_DEBUG_EV_NONE:
- default:
- SysDebug((MID_MMS,"%s, hMmsEH=%d, hSmsEH=%d, hEmailEH=%d, hCommonEH=%d, hCurrentEH=%d\n", \
- pszFunc, hMmsEH, hSmsEH, hEmailEH, hCommonEH, hCurrentEH));
- break;
- }
- return true;
-}
-
-
-char *DebugPrintGetRmResultInd(MmsRmResultInd indType)
-{
- switch (indType) {
- case RM_RESULTIND_NONE:
- return "RM_RESULTIND_NONE";
-
- case RM_RESULTIND_MANUAL_SEND:
- return "RM_RESULTIND_MANUAL_SEND";
-
- case RM_RESULTIND_AUTO_SEND:
- return "RM_RESULTIND_AUTO_SEND";
-
- case RM_RESULTIND_MANUAL_GET:
- return "RM_RESULTIND_MANUAL_GET";
-
- case RM_RESULTIND_AUTO_GET:
- return "RM_RESULTIND_AUTO_GET";
-
- case RM_RESULTIND_MANUAL_FORWARD:
- return "RM_RESULTIND_MANUAL_FORWARD";
- }
-
- return MmsDebugPrintUnknownValue(indType);
-}
-
-
-char *DebugPrintHttpStatusCode(int status)
-{
- switch (status) {
- case HTTP_STATUS_100:
- return "HTTP_STATUS_100";
- case HTTP_STATUS_101:
- return "HTTP_STATUS_101";
-
- case HTTP_STATUS_200:
- return "HTTP_STATUS_200";
- case HTTP_STATUS_201:
- return "HTTP_STATUS_201";
- case HTTP_STATUS_202:
- return "HTTP_STATUS_202";
- case HTTP_STATUS_203:
- return "HTTP_STATUS_203";
- case HTTP_STATUS_204:
- return "HTTP_STATUS_204";
- case HTTP_STATUS_205:
- return "HTTP_STATUS_205";
- case HTTP_STATUS_206:
- return "HTTP_STATUS_206";
-
- case HTTP_STATUS_300:
- return "HTTP_STATUS_300";
- case HTTP_STATUS_301:
- return "HTTP_STATUS_301";
- case HTTP_STATUS_302:
- return "HTTP_STATUS_302";
- case HTTP_STATUS_303:
- return "HTTP_STATUS_303";
- case HTTP_STATUS_304:
- return "HTTP_STATUS_304";
- case HTTP_STATUS_305:
- return "HTTP_STATUS_305";
-
- case HTTP_STATUS_400:
- return "HTTP_STATUS_400";
- case HTTP_STATUS_401:
- return "HTTP_STATUS_401";
- case HTTP_STATUS_402:
- return "HTTP_STATUS_402";
- case HTTP_STATUS_403:
- return "HTTP_STATUS_403";
- case HTTP_STATUS_404:
- return "HTTP_STATUS_404";
- case HTTP_STATUS_405:
- return "HTTP_STATUS_405";
- case HTTP_STATUS_406:
- return "HTTP_STATUS_406";
- case HTTP_STATUS_407:
- return "HTTP_STATUS_407";
- case HTTP_STATUS_408:
- return "HTTP_STATUS_408";
- case HTTP_STATUS_409:
- return "HTTP_STATUS_409";
- case HTTP_STATUS_410:
- return "HTTP_STATUS_410";
- case HTTP_STATUS_411:
- return "HTTP_STATUS_411";
- case HTTP_STATUS_412:
- return "HTTP_STATUS_412";
- case HTTP_STATUS_413:
- return "HTTP_STATUS_413";
- case HTTP_STATUS_414:
- return "HTTP_STATUS_414";
- case HTTP_STATUS_415:
- return "HTTP_STATUS_415";
-
- case HTTP_STATUS_500:
- return "HTTP_STATUS_500";
- case HTTP_STATUS_501:
- return "HTTP_STATUS_501";
- case HTTP_STATUS_502:
- return "HTTP_STATUS_502";
- case HTTP_STATUS_503:
- return "HTTP_STATUS_503";
- case HTTP_STATUS_504:
- return "HTTP_STATUS_504";
- case HTTP_STATUS_505:
- return "HTTP_STATUS_505";
-
- case REASON_WTP_UNKNOWN:
- return "REASON_WTP_UNKNOWN";
- case REASON_WTP_PROTO_ERR:
- return "REASON_WTP_PROTO_ERR";
- case REASON_WTP_INVALID_TID:
- return "REASON_WTP_INVALID_TID";
- case REASON_WTP_NOT_IMPLEMENTED_CL2:
- return "REASON_WTP_NOT_IMPLEMENTED_CL2";
- case REASON_WTP_NOT_IMPLEMENTED_SAR:
- return "REASON_WTP_NOT_IMPLEMENTED_SAR";
- case REASON_WTP_NOT_IMPLEMENTEDU_ACK:
- return "REASON_WTP_NOT_IMPLEMENTEDU_ACK";
- case REASON_WTP_VERSIONONE:
- return "REASON_WTP_VERSIONONE";
- case REASON_WTP_CAPTEMP_EXCEED:
- return "REASON_WTP_CAPTEMP_EXCEED";
- case REASON_WTP_NO_RESPONSE:
- return "REASON_WTP_NO_RESPONSE";
- case REASON_WTP_MESSAGE_TOO_LARGE:
- return "REASON_WTP_MESSAGE_TOO_LARGE";
-
- case REASON_PROTOERR:
- return "REASON_PROTOERR"; // = 0xE0
- case REASON_DISCONNECT:
- return "REASON_DISCONNECT";
- case REASON_SUSPEND:
- return "REASON_SUSPEND";
- case REASON_RESUME:
- return "REASON_RESUME";
- case REASON_CONGESTION:
- return "REASON_CONGESTION";
- case REASON_CONNECTERR:
- return "REASON_CONNECTERR";
- case REASON_MRUEXCEEDED:
- return "REASON_MRUEXCEEDED";
- case REASON_MOREXCEEDED:
- return "REASON_MOREXCEEDED";
- case REASON_PEERREQ:
- return "REASON_PEERREQ";
- case REASON_NETERR:
- return "REASON_NETERR";
- case REASON_USERREQ:
- return "REASON_USERREQ";
- /* added for ver 1.2 */
- case REASON_USERRFS:
- return "REASON_USERRFS";
- case REASON_PND:
- return "REASON_PND";
- case REASON_USERDCR:
- return "REASON_USERDCR";
- case REASON_USERDCU:
- return "REASON_USERDCU";
- }
-
- return MmsDebugPrintUnknownValue(status);
-}
-
-
-char *DebugPrintRmMethodType(MmsRmMethodType method)
-{
- switch (method) {
- case RM_METHOD_NONE:
- return "RM_METHOD_NONE";
- case RM_METHOD_GET:
- return "RM_METHOD_GET";
- case RM_METHOD_POST:
- return "RM_METHOD_POST";
- }
-
- return MmsDebugPrintUnknownValue(method);
-}
-
-
-char *DebugPrintGetMmsRmNetState(MmsRmNetState state)
-{
- switch (state) {
- case RM_PROTO_IDLE:
- return "RM_PROTO_IDLE";
- case RM_PROTO_STARTING:
- return "RM_PROTO_STARTING";
- case RM_PROTO_STARTED:
- return "RM_PROTO_STARTED";
- case RM_PROTO_STOPPING:
- return "RM_PROTO_STOPPING";
-
- case RM_PROTO_WAITING:
- return "RM_PROTO_WAITING";
- case RM_PROTO_DISCONNECTING_OTHER_APP:
- return "RM_PROTO_DISCONNECTING_OTHER_APP";
- case RM_PROTO_DISCONNECTED_BY_OTHER_APP:
- return "RM_PROTO_DISCONNECTED_BY_OTHER_APP";
-
- case RM_PROTO_FAILED:
- return "RM_PROTO_FAILED";
- }
-
- return MmsDebugPrintUnknownValue(state);
-}
-
-
-char *DebugPrintGetMmsRmEntityState(MmsRmExEntityState stateEx)
-{
- switch (stateEx) {
- case RM_ENTITY_IDLE:
- return "RM_ENTITY_IDLE";
- case RM_ENTITY_PROTO_STARTING:
- return "RM_ENTITY_PROTO_STARTING";
-
- case RM_ENTITY_CNXN_ESTABLISHING:
- return "RM_ENTITY_CNXN_ESTABLISHING";
- case RM_ENTITY_CNXN_ESTABLISHED:
- return "RM_ENTITY_CNXN_ESTABLISHED";
-
- case RM_ENTITY_SENDING_REQUEST:
- return "RM_ENTITY_SENDING_REQUEST";
- case RM_ENTITY_SENDING_REQ_N_NO_RESPONSE:
- return "RM_ENTITY_SENDING_REQ_N_NO_RESPONSE";
-
- case RM_ENTITY_SENDING_REQ_COMPLETED:
- return "RM_ENTITY_SENDING_REQ_COMPLETED";
-
- case RM_ENTITY_SENDING_REQ_FAILED:
- return "RM_ENTITY_SENDING_REQ_FAILED";
- case RM_ENTITY_SENDING_REQ_CANCELLED_BY_USER_CONFIRMED:
- return "RM_ENTITY_SENDING_REQ_CANCELLED_BY_USER_CONFIRMED";
- }
-
- return MmsDebugPrintUnknownValue(stateEx);
-}
-
-
-char *MmsDebugPrintMmsRmResult(MmsRmResult result)
-{
- switch (result) {
- case MMS_RM_RESULT_SUCCESSED:
- return "MMS_RM_RESULT_SUCCESSED";
- case MMS_RM_RESULT_FAIL:
- return "MMS_RM_RESULT_FAIL";
- case MMS_RM_RESULT_FAIL_N_RETRY:
- return "MMS_RM_RESULT_FAIL_N_RETRY";
-
- case MMS_RM_RESULT_PROTO_STARTING_FAILED:
- return "MMS_RM_RESULT_PROTO_STARTING_FAILED";
-
- case MMS_RM_RESULT_DISCONNECT_MMS:
- return "MMS_RM_RESULT_DISCONNECT_MMS";
- case MMS_RM_RESULT_CLOSING_OTHER_APP_FAILED:
- return "MMS_RM_RESULT_CLOSING_OTHER_APP_FAILED";
-
- case MMS_RM_RESULT_SENDING_REQ_FAILED:
- return "MMS_RM_RESULT_SENDING_REQ_FAILED";
- case MMS_RM_RESULT_CANCELED_BY_USER:
- return "MMS_RM_RESULT_CANCELED_BY_USER";
- case MMS_RM_RESULT_CANCELED_FROM_RETRY_POPUP:
- return "MMS_RM_RESULT_CANCELED_FROM_RETRY_POPUP";
-
- case MMS_RM_RESULT_PROTO_FAILED:
- return "MMS_RM_RESULT_PROTO_FAILED";
- case MMS_RM_RESULT_DISCONNECTED_BY_OTHER:
- return "MMS_RM_RESULT_DISCONNECTED_BY_OTHER";
-
- case MMS_RM_RESULT_MEMORY_FULL:
- return "MMS_RM_RESULT_MEMORY_FULL";
- }
-
- return MmsDebugPrintUnknownValue(result);
-}
-
-void MmsDebugPrintReqEntityInfo(MmsRmRequest *pEntity)
-{
- SysDebug((MID_MMS," - proto state=%s\n", DebugPrintGetMmsRmNetState(_MmsRmNetGetState())));
-
- if (_MmsRmNetGetProtoType() == MMS_RM_WAP_CONNORIENTED || _MmsRmNetGetProtoType() == MMS_RM_WTLS) {
- SysDebug((MID_MMS," - wap cnxn state=%s\n", DebugPrintWspState(MmsRmWspGetCnxnState())));
- }
-
- if (!pEntity) {
- SysDebug((MID_EXCEPTION, "MmsDebugPrintReqEntityInfo : pEntity is NULL. \n"));
- return;
- }
-
- SysDebug((MID_MMS," - entity state=%s\n", DebugPrintGetMmsRmEntityState(pEntity->stateEx)));
-
- if (pEntity->cb.result.bSend) {
- if (pEntity->pduType == MMS_RM_READ_REPORT_V10) {
- SysDebug((MID_MMS," - sending read report v10\n"));
- } else if (pEntity->pduType == MMS_RM_READ_REPORT_V11) {
- SysDebug((MID_MMS," - sending read report v11\n"));
- } else {
- SysDebug((MID_MMS," - sending msg\n"));
- }
- } else { // then receiving..
- if (pEntity->cb.result.bAutoRetrieving) {
- SysDebug((MID_MMS," - retrieving(auto)\n"));
- } else {
- SysDebug((MID_MMS," - retrieving(manual)\n"));
- }
- }
-
- SysDebug((MID_MMS," - msgID=%d, trID=0x%x, pduType=%s\n", pEntity->msgID, pEntity->trId, MmsDebugPrintRmPduType(pEntity->pduType)));
-
- if (pEntity->protoActvCount > 1) {
- SysDebug((MID_MMS," - protoActvCount=%d\n", pEntity->protoActvCount));
- }
-
- if (pEntity->reqCount > 1) {
- SysDebug((MID_MMS," - reqCount=%d\n", pEntity->reqCount));
- }
-
- if (pEntity->fullRetryCount > 1) {
- SysDebug((MID_MMS," - fullRetryCount=%d\n", pEntity->fullRetryCount));
- }
-}
-
-char *MmsDebugPrintHttpErrorCode(int errCode)
-{
- switch (errCode) {
- case HTTPERR_INVALID_PARAM:
- return "HTTPERR_INVALID_PARAM";
- case HTTPERR_UNKNOWN:
- return "HTTPERR_UNKNOWN";
- case HTTPERR_INVALID_PROXY:
- return "HTTPERR_INVALID_PROXY";
- case HTTPERR_OUT_OF_MEMORY:
- return "HTTPERR_OUT_OF_MEMORY";
- case HTTPERR_NO_RESPONSE:
- return "HTTPERR_NO_RESPONSE";
- case HTTPERR_INIT:
- return "HTTPERR_INIT";
- case HTTPERR_NETDOWN:
- return "HTTPERR_NETDOWN";
- case HTTPERR_TIMEOUT:
- return "HTTPERR_TIMEOUT";
- case HTTPERR_HOST_UNREACH:
- return "HTTPERR_HOST_UNREACH";
- case HTTPERR_CONN_RESET:
- return "HTTPERR_CONN_RESET";
- case HTTPERR_INTERNAL:
- return "HTTPERR_INTERNAL";
- case HTTPERR_CHUNKEDTR:
- return "HTTPERR_CHUNKEDTR";
- case HTTPERR_USER:
- return "HTTPERR_USER";
- case HTTPERR_TOO_BIG:
- return "HTTPERR_TOO_BIG";
- case HTTPERR_NOT_SUPPORTED_SVC:
- return "HTTPERR_NOT_SUPPORTED_SVC";
- case HTTPERR_NO_CONTENT:
- return "HTTPERR_NO_CONTENT";
- case HTTPERR_WRITEFAIL:
- return "HTTPERR_WRITEFAIL";
- case HTTPERR_AUTHFAIL:
- return "HTTPERR_AUTHFAIL";
-
- case HTTPERR_DNSFAIL:
- return "HTTPERR_DNSFAIL";
- case HTTPERR_UAGENT_NOT_ALLOWED:
- return "HTTPERR_UAGENT_NOT_ALLOWED";
-
- }
- return MmsDebugPrintUnknownValue(errCode);
-}
-
-char *MmsDebugPrintProtoErrorCode(int errCode)
-{
- switch (errCode) {
- case PROTO_ERROR_NONE:
- return "PROTO_ERROR_NONE";
- /* Wireless stack errors */
- case PROTO_ERROR_NO_SERVICE:
- return "PROTO_ERROR_NO_SERVICE";
- case PROTO_ERROR_INVALID_PARAM:
- return "PROTO_ERROR_INVALID_PARAM";
- case PROTO_ERROR_INVALID_APN:
- return "PROTO_ERROR_INVALID_APN";
- case PROTO_ERROR_INVALID_OP_MODE:
- return "PROTO_ERROR_INVALID_OP_MODE";
- case PROTO_ERROR_INVALID_PROTO_TYPE:
- return "PROTO_ERROR_INVALID_PROTO_TYPE";
- case PROTO_ERROR_INVALID_SERVICE_DOMAIN:
- return "PROTO_ERROR_INVALID_SERVICE_DOMAIN";
- case PROTO_ERROR_INVALID_PDP_DATA:
- return "PROTO_ERROR_INVALID_PDP_DATA";
- case PROTO_ERROR_INVALID_QOS:
- return "PROTO_ERROR_INVALID_QOS";
- case PROTO_ERROR_SESSION_DEACTIVATED:
- return "PROTO_ERROR_SESSION_DEACTIVATED";
- case PROTO_ERROR_AUTHENTICATION_FAILED:
- return "PROTO_ERROR_AUTHENTICATION_FAILED";
- case PROTO_ERROR_MOBILE_FAILURE:
- return "PROTO_ERROR_MOBILE_FAILURE";
- case PROTO_ERROR_NETWORK_FAILURE:
- return "PROTO_ERROR_NETWORK_FAILURE";
- case PROTO_ERROR_TIMEOUT:
- return "PROTO_ERROR_TIMEOUT";
- case PROTO_ERROR_NO_RESOURCE:
- return "PROTO_ERROR_NO_RESOURCE";
- case PROTO_ERROR_INVALID_CONTEXT_ID:
- return "PROTO_ERROR_INVALID_CONTEXT_ID";
- case PROTO_ERROR_MODEM_IN_USE:
- return "PROTO_ERROR_MODEM_IN_USE";
- case PROTO_ERROR_INVALID_SIM_STATE:
- return "PROTO_ERROR_INVALID_SIM_STATE:";
- case PROTO_ERROR_SERVICE_NOT_SUBSCRIBED:
- return "PROTO_ERROR_SERVICE_NOT_SUBSCRIBED";
- case PROTO_ERROR_SERVICE_NOT_IMPLEMENTED:
- return "PROTO_ERROR_SERVICE_NOT_IMPLEMENTED";
- case PROTO_ERROR_FDN_NOT_ALLOWED:
- return "PROTO_ERROR_FDN_NOT_ALLOWED";
- case PROTO_ERROR_CALL_INCOME:
- return "PROTO_ERROR_CALL_INCOME";
- case PROTO_ERROR_NOT_SUPPORT_3GCSD:
- return "PROTO_ERROR_NOT_SUPPORT_3GCSD";
- case PROTO_ERROR_UNKNOWN:
- return "PROTO_ERROR_UNKNOWN";
- case PROTO_ERROR_SI_OFFLINE:
- return "PROTO_ERROR_SI_OFFLINE";
- /* TCP/IP/PPP stack errors */
- case PROTO_ERROR_TCPIP_UP:
- return "PROTO_ERROR_TCPIP_UP";
- case PROTO_ERROR_TCPIP_DOWN:
- return "PROTO_ERROR_TCPIP_DOWN";
- case PROTO_ERROR_PPP_UP:
- return "PROTO_ERROR_PPP_UP";
- case PROTO_ERROR_PPP_DOWN:
- return "PROTO_ERROR_PPP_DOWN";
- case PROTO_ERROR_WDP_INIT:
- return "PROTO_ERROR_WDP_INIT";
- /* ProtoMgr API call errors */
- case PROTO_ERROR_ACTIVE_CONNECTIONS:
- return "PROTO_ERROR_ACTIVE_CONNECTIONS";
- case PROTO_ERROR_MAX_CONNECTIONS:
- return "PROTO_ERROR_MAX_CONNECTIONS";
- case PROTO_ERROR_INVALID_HANDLE:
- return "PROTO_ERROR_INVALID_HANDLE";
- case PROTO_ERROR_INVALID_CONTEXT:
- return "PROTO_ERROR_INVALID_CONTEXT";
- case PROTO_ERROR_INVALID_CALLBACK:
- return "PROTO_ERROR_INVALID_CALLBACK";
- case PROTO_ERROR_INVALID_EHN:
- return "PROTO_ERROR_INVALID_EHN";
- case PROTO_ERROR_INVALID_EVENTCLASS:
- return "PROTO_ERROR_INVALID_EVENTCLASS";
- case PROTO_ERROR_INVALID_REFTYPE:
- return "PROTO_ERROR_INVALID_REFTYPE";
- case PROTO_ERROR_INVALID_TIMEOUT:
- return "PROTO_ERROR_INVALID_TIMEOUT";
- case PROTO_ERROR_MAX_CLIENT:
- return "PROTO_ERROR_MAX_CLIENT";
- case PROTO_ERROR_MAX_ACCOUNT:
- return "PROTO_ERROR_MAX_ACCOUNT";
- case PROTO_ERROR_ACCESS_DENIED:
- return "PROTO_ERROR_ACCESS_DENIED";
- case PROTO_ERROR_REGISTRY_LOAD:
- return "PROTO_ERROR_REGISTRY_LOAD";
-
- case PROTO_ERROR_PCBROWSING_ON:
- return "PROTO_ERROR_PCBROWSING_ON";
- case PROTO_ERROR_REACTIVATION_REQ:
- return "PROTO_ERROR_REACTIVATION_REQ";
- case PROTO_ERROR_NO_PDP_ACTIVATED:
- return "PROTO_ERROR_NO_PDP_ACTIVATED";
-
- case PROTO_ERROR_MAX:
- return "PROTO_ERROR_MAX";
-
- }
-
- return MmsDebugPrintUnknownValue(errCode);
-}
-
-
-char *DebugPrintWspResult(WspResult wspResult)
-{
- switch (wspResult) {
- case WSP_RESULT_NO_ERROR:
- return "WSP_RESULT_NO_ERROR";
- case WSP_RESULT_NO_SESSION:
- return "WSP_RESULT_NO_SESSION";
- case WSP_RESULT_NOT_SUITABLE:
- return "WSP_RESULT_NOT_SUITABLE";
-
- case WSP_RESULT_NOT_RESPONDING:
- return "WSP_RESULT_NOT_RESPONDING";
- case WSP_RESULT_MOP_EXCEED:
- return "WSP_RESULT_MOP_EXCEED";
- case WSP_RESULT_MOM_EXCEED:
- return "WSP_RESULT_MOM_EXCEED";
-
- case WSP_RESULT_UNABLE:
- return "WSP_RESULT_UNABLE";
- case WSP_RESULT_UNKNOWN:
- return "WSP_RESULT_UNKNOWN";
- case WSP_RESULT_WRONG_PARAM:
- return "WSP_RESULT_WRONG_PARAM";
-
- case WSP_RESULT_NO_MEMORY:
- return "WSP_RESULT_NO_MEMORY";
- case WSP_RESULT_NO_HANDLE:
- return "WSP_RESULT_NO_HANDLE";
-
- case WSP_RESULT_CAPABILITY_UNABLE:
- return "WSP_RESULT_CAPABILITY_UNABLE";
- case WSP_RESULT_UAGENT_NOT_ALLOWED:
- return "WSP_RESULT_UAGENT_NOT_ALLOWED";
- }
-
- return MmsDebugPrintUnknownValue(wspResult);
-}
-
-
-char *DebugPrintWspState(MmsRmWapState wspState)
-{
- switch (wspState) { //gMmsRmWapState
- case RM_WAP_IDLE:
- return "RM_WAP_IDLE";
- case RM_WAP_CONNECTING:
- return "RM_WAP_CONNECTING";
- case RM_WAP_CONNECTED:
- return "RM_WAP_CONNECTED";
- case RM_WAP_DISCONNECTING:
- return "RM_WAP_DISCONNECTING";
- case RM_WAP_SECURE_REDIRECT:
- return "RM_WAP_SECURE_REDIRECT";
- case RM_WAP_FAILED:
- return "RM_WAP_FAILED";
- case RM_WAP_WTLS_HANDSHAKING:
- return "RM_WAP_WTLS_HANDSHAKING";
- case RM_WAP_WTLS_HANDSHAKE_COMPLETED:
- return "RM_WAP_WTLS_HANDSHAKE_COMPLETED";
- }
-
- return MmsDebugPrintUnknownValue(wspState);
-}
-
-
-char *MmsDebugPrintRmPduType(MmsRmPduType pduType)
-{
- switch (pduType) {
- case MMS_RM_PDU_TYPE:
- return "MMS_RM_PDU_TYPE";
-
- case MMS_RM_SEND_REQ:
- return "MMS_RM_SEND_REQ";
- case MMS_RM_GET_REQ_AUTO:
- return "MMS_RM_GET_REQ_AUTO";
- case MMS_RM_GET_REQ_MANUAL:
- return "MMS_RM_GET_REQ_MANUAL";
- case MMS_RM_NOTIFY_RESP_IND:
- return "MMS_RM_NOTIFY_RESP_IND";
- case MMS_RM_ACK_IND:
- return "MMS_RM_ACK_IND";
-
- case MMS_RM_NOTI_IND:
- return "MMS_RM_NOTI_IND";
- case MMS_RM_RETRIEVE_CONF:
- return "MMS_RM_RETRIEVE_CONF";
-
- case MMS_RM_READ_REPORT_V10:
- return "MMS_RM_READ_REPORT_V10";
- case MMS_RM_READ_REPORT_V11:
- return "MMS_RM_READ_REPORT_V11";
- }
-
- return MmsDebugPrintUnknownValue(pduType);
-}
-
-
-char *MmsDebugPrintMailboxType(MsgMailboxType mailboxType)
-{
- switch (mailboxType) {
- case MSG_MAILBOX_WRITE:
- return "MSG_MAILBOX_WRITE";
- case MSG_MAILBOX_INBOX:
- return "MSG_MAILBOX_INBOX";
- case MSG_MAILBOX_DRAFT:
- return "MSG_MAILBOX_DRAFT";
- case MSG_MAILBOX_SENT:
- return "MSG_MAILBOX_SENT";
- case MSG_MAILBOX_MAILBOX:
- return "MSG_MAILBOX_MAILBOX";
- case MSG_MAILBOX_OUTBOX:
- return "MSG_MAILBOX_OUTBOX";
- case MSG_MAILBOX_TEMPLATE:
- return "MSG_MAILBOX_TEMPLATE";
- case MSG_MAILBOX_MYFOLDER:
- return "MSG_MAILBOX_MYFOLDER";
- case MSG_MAILBOX_MYFOLDER_LIST:
- return "MSG_MAILBOX_MYFOLDER_LIST";
- case MSG_MAILBOX_PRESET:
- return "MSG_MAILBOX_PRESET";
- }
-
- return MmsDebugPrintUnknownValue(mailboxType);
-}
-#endif
-
#include "MmsPluginDrm.h"
#include "MsgDrmWrapper.h"
#endif
-
+#include "MmsPluginUtil.h"
static bool _MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* bufLen < gMmsDecodeMaxLen */
static bool _MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* no bufLen limit */
break;
}
- if (count > 5) {
+ if (count > 4) {
MSG_DEBUG("__MmsBinaryDecodeUintvar : legnth is too long\n");
goto __CATCH;
}
bool _MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
{
FILE *pFile = NULL;
- char *pExt = NULL;
+// char *pExt = NULL;
char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; // file name of temp file
char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file.
#include "MsgMmsTypes.h"
#include "MsgDrmWrapper.h"
#include "MsgDebug.h"
-
+#include "MmsPluginUtil.h"
#ifdef __SUPPORT_DRM__
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MmsPluginMIME.h"
+#include "MmsPluginUtil.h"
gint _g_time_rev_set = 0;
gint _g_time_rev = 0;
if (pType->param.szName[0]) {
char* pszName = NULL;
- if (_MsgIsASCII (pType->param.szName)) {
+ if (MsgIsASCII (pType->param.szName)) {
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName is consisted of ascii char-set chars. \n");
pszName = (char *)malloc(strlen(pType->param.szName) +1);
}
//change empty space to '_' in the file name
- if (_MsgIsSpace(pszName)) {
+ if (MsgIsSpace(pszName)) {
char *pszTempName = NULL;
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szName has space(' '). \n");
- _MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
+ MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
if (pszTempName) {
free(pszName);
if (pType->param.szName[0]) {
char* pszName = NULL;
- if (_MsgIsASCII (pType->param.szName)) {
+ if (MsgIsASCII (pType->param.szName)) {
MSG_DEBUG("MmsBinaryEncodeContentType: szName is consisted of ascii char-set chars. \n");
}
//change empty space to '_' in the file name
- if (_MsgIsSpace(pszName)) {
+ if (MsgIsSpace(pszName)) {
char* pszTempName = NULL;
MSG_DEBUG("MmsBinaryEncodeContentType: szName has space(' '). \n");
- _MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
+ MsgReplaceSpecialChar(pszName, &pszTempName, ' ');
if (pszTempName) {
free(pszName);
goto __CATCH;
pBody->offset = _MmsGetEncodeOffset();
- if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != nRead) {
+ if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
}
}
} else if (pBody->body.pText && pBody->size) {
pBody->offset = _MmsGetEncodeOffset();
- if (MsgWriteFile(pBody->body.pText, sizeof(char),pBody->size, pFile) != pBody->size) {
+ if (MsgWriteFile(pBody->body.pText, sizeof(char),(size_t)pBody->size, pFile) != (size_t)pBody->size) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
}
MmsPluginInternal::instance()->processForwardConf(&msgInfo, pRequest);
break;
+ case eMMS_READREPORT_CONF:
+ remove(pRetrievedFilePath);
+ break;
default:
break;
}
msg_error_t err = MSG_SUCCESS;
MSG_MESSAGE_INFO_S msgInfo = {};
- MMS_RECV_DATA_S recvData = {{0}, };
MSG_DEBUG("pRequest->msgId [%d]", pRequest->msgId);
memset(szBuffer, 0, 1025);
memset(pcheader, 0, HTTP_REQUEST_LEN);
- nResult = __httpGetHeaderField(MMS_HH_ACCEPT_ENCODING, szBuffer);
- if (nResult) {
- strcat(pcheader, "Accept-Encoding: ");
- strcat(pcheader, szBuffer);
- MSG_DEBUG("%s", pcheader);
- *responseHeaders = curl_slist_append(*responseHeaders, pcheader);
- }
-
- memset(szBuffer, 0, 1025);
- memset(pcheader, 0, HTTP_REQUEST_LEN);
nResult = __httpGetHeaderField(MMS_HH_USER_AGENT, szBuffer);
if (nResult) {
strcat(pcheader, "User-Agent: ");
case MMS_HH_USER_AGENT:
{
- char szUserAgent[1024 + 1] = {0,};
+ char szUserAgent[1024 + 1];
- memset(szUserAgent, 0x00, (sizeof(char) * (1024 + 1) ));
+ memset(szUserAgent, 0x00, sizeof(szUserAgent));
snprintf(szUserAgent, 1024, "%s", MSG_MMS_HH_USER_AGENT);
snprintf((char *)szHeaderBuffer, 1024, "%s", szUserAgent);
}
MSG_DEBUG("## End Transaction ##");
- MSG_DEBUG("############ trID = %d ###########", trId);
srandom((unsigned int) time(NULL));
trId = random() % 1000000000 + 1;
+ MSG_DEBUG("############ trID = %d ###########", trId);
httpConfig->transactionId = trId;
}
MSG_DEBUG("## End Transaction ##");
- MSG_DEBUG("############ trID = %d ###########", trId);
+
srandom((unsigned int) time(NULL));
trId = random() % 1000000000 + 1;
+ MSG_DEBUG("############ trID = %d ###########", trId);
+
httpConfig->transactionId = trId;
return eMMS_HTTP_SENT_SUCCESS;
return true;
}
-
void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
- MmsMsg *pMsg = NULL;
- bool bFound = false;
- MmsMsgMultiStatus *pStatus = NULL;
- MmsMsgMultiStatus *pLastStatus = NULL;
-
- pMsg = (MmsMsg *)malloc(sizeof(MmsMsg));
+ MmsMsgMultiStatus status;
+ memset(&status, 0x00, sizeof(MmsMsgMultiStatus));
- if (pMsg == NULL) {
- MSG_DEBUG("fail to allocation memory.");
- return;
- }
+ status.msgStatus = mmsHeader.msgStatus;
+ status.handledTime = mmsHeader.date;
+ status.bDeliveryReportIsRead = false;
+ status.bDeliveyrReportIsLast= true;
- MmsInitMsgAttrib(&pMsg->mmsAttrib);
+ MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
+ MSG_DEBUG("[INFO] [ADDR: %s, MMSID: %s]",mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
- pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
- pMsgInfo->msgType.subType = MSG_DELIVERYIND_MMS;
+ pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
+ pMsgInfo->msgType.subType = MSG_DELIVERYIND_MMS;
pMsgInfo->bTextSms = true;
+ pMsgInfo->dataSize = 0;
+ memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
- MSG_DEBUG("#### mmsHeader.szMsgID = %s : when received delivery ind####", mmsHeader.szMsgID);
- int tmpId = (msg_message_id_t)MmsSearchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
+ strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(status.msgStatus), MAX_MSG_DATA_LEN);
+ pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
+ MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData);
+ strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
- MSG_DEBUG("tmpId [%d]", tmpId);
- MSG_DEBUG("mmsHeader.pTo->szAddr [%s]", mmsHeader.pTo->szAddr);
-
+ int tmpId = (msg_message_id_t)MmsSearchMsgId(mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
if (tmpId > 0) {
- pMsgInfo->msgId = (msg_message_id_t)tmpId;
-
- pMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(pMsgInfo->msgId);
-
- pStatus = pMsg->mmsAttrib.pMultiStatus;
-
- MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo);
-
- while (pStatus && !bFound) {
- MSG_DEBUG("### MmsAddrUtilCompareAddr ###");
- MSG_DEBUG("### mmsHeader.pTo->szAddr = %s ###", mmsHeader.pTo->szAddr);
- if (MmsAddrUtilCompareAddr( pStatus->szTo, mmsHeader.pTo->szAddr)) {
- bFound = true;
- break;
- }
-
- pStatus = pStatus->pNext;
- }
-
- if (bFound == false) {
- MSG_DEBUG("### bFound == false ###");
- /* Queue the delivery report --------------------------- */
+ MSG_DEBUG("Found MSG_ID = %d", tmpId);
- pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus));
- memset(pStatus, 0, sizeof(MmsMsgMultiStatus));
+ //Insert to Delievery DB
+ MmsPluginStorage::instance()->insertDeliveryReport(tmpId, mmsHeader.pTo->szAddr, &status);
- pStatus->readStatus = MMS_READSTATUS_NONE;
- memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1);
- strncpy(pStatus->szTo, mmsHeader.pTo->szAddr, MSG_ADDR_LEN);
-
- if (pMsg->mmsAttrib.pMultiStatus == NULL) {
- /* first delivery report */
- pMsg->mmsAttrib.pMultiStatus = pStatus;
- } else {
- pLastStatus = pMsg->mmsAttrib.pMultiStatus;
-
- while (pLastStatus->pNext) {
- pLastStatus = pLastStatus->pNext;
- }
-
- pLastStatus->pNext = pStatus;
- pLastStatus = pStatus;
- }
- }
-
- pStatus->handledTime = mmsHeader.date;
- pStatus->msgStatus = mmsHeader.msgStatus;
-
- memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
- pMsgInfo->dataSize = 0;
- strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(pStatus->msgStatus), MAX_MSG_DATA_LEN);
- pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
- pMsgInfo->bTextSms = true;
- MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData);
-
- strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
-
- pStatus->bDeliveryReportIsRead = false;
-
- _MmsDataUpdateLastStatus(pMsg);
-
- pStatus->bDeliveyrReportIsLast= true;
-
- MmsUpdateDeliveryReport(pMsgInfo->msgId, pStatus);
+ pMsgInfo->msgId = (msg_message_id_t)tmpId;
MmsPluginStorage::instance()->addMmsNoti(pMsgInfo);
- } else {
- MSG_DEBUG("Can't not find Message!");
- memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
- pMsgInfo->dataSize = 0;
- strncpy(pMsgInfo->msgData, getMmsDeliveryStatus(mmsHeader.msgStatus), MAX_MSG_DATA_LEN);
-
- MSG_DEBUG("Delivery Status = %s", pMsgInfo->msgData);
-
- pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
- MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
-
- strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
+ } else {
+ MSG_DEBUG("Can not find MMS message in DB");
}
- MsgFreeAttrib(&pMsg->mmsAttrib);
-
- free(pMsg);
-
MSG_END();
}
{
MSG_BEGIN();
- MmsMsg *pMsg = NULL;
- bool bFound = false;
- MmsMsgMultiStatus *pStatus = NULL;
- MmsMsgMultiStatus *pLastStatus = NULL;
-
- pMsg = (MmsMsg *)malloc(sizeof(MmsMsg));
-
- if (pMsg == NULL) {
- MSG_DEBUG("fail to allocation memory.");
+ if (pMsgInfo == NULL) {
+ MSG_DEBUG("parameter err");
return;
}
- MmsInitMsgAttrib(&pMsg->mmsAttrib);
-
pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
pMsgInfo->msgType.subType = MSG_READORGIND_MMS;
pMsgInfo->bTextSms = true;
MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
- if (mmsHeader.readStatus != MSG_READ_REPORT_IS_DELETED || (strcmp(mmsHeader.pFrom->szAddr, mmsHeader.pTo->szAddr))) {
- MSG_DEBUG("#### mmsHeader.szMsgID = %s : when received read orig ind####", mmsHeader.szMsgID);
-
- int tmpId = MmsSearchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
-
- if (tmpId > 0) {
- pMsgInfo->msgId = (msg_message_id_t)tmpId;
-
- pMsg->mmsAttrib.pMultiStatus = MmsGetMultiStatus(pMsgInfo->msgId);
-
- pStatus = pMsg->mmsAttrib.pMultiStatus;
-
- MSG_DEBUG("### pStatus->szTo = %s ###", pStatus->szTo);
-
- while (pStatus && !bFound) {
- MSG_DEBUG("### MmsAddrUtilCompareAddr ###");
- MSG_DEBUG("### mmsHeader.pFrom->szAddr = %s ###", mmsHeader.pFrom->szAddr);
- if (MmsAddrUtilCompareAddr(pStatus->szTo, mmsHeader.pFrom->szAddr)) {
- bFound = true;
- break;
- }
-
- pStatus = pStatus->pNext;
- }
-
- if (bFound == false) {
- MSG_DEBUG("### bFound == false ###");
- /* Queue the delivery report --------------------------- */
-
- pStatus = (MmsMsgMultiStatus *)malloc(sizeof(MmsMsgMultiStatus));
- memset(pStatus, 0, sizeof(MmsMsgMultiStatus));
-
- pStatus->msgStatus = MMS_MSGSTATUS_NONE;
-
- memset(pStatus->szTo, 0, MSG_ADDR_LEN + 1);
- strncpy(pStatus->szTo, mmsHeader.pFrom->szAddr, MSG_ADDR_LEN);
-
- if (pMsg->mmsAttrib.pMultiStatus == NULL) {
- /* first readOrg report */
- pMsg->mmsAttrib.pMultiStatus = pStatus;
- } else {
- pLastStatus = pMsg->mmsAttrib.pMultiStatus;
-
- while (pLastStatus->pNext) {
- pLastStatus = pLastStatus->pNext;
- }
-
- pLastStatus->pNext = pStatus;
- pLastStatus = pStatus;
- }
- }
-
- pStatus->readTime = mmsHeader.date;
- pStatus->readStatus = mmsHeader.readStatus;
-
- memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
- pMsgInfo->dataSize = 0;
- strncpy(pMsgInfo->msgData, getMmsReadStatus(pStatus->readStatus), MAX_MSG_DATA_LEN);
- pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
- pMsgInfo->bTextSms = true;
- MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
-
- strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
-
- pStatus->bReadReplyIsRead = false;
+ memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
+ pMsgInfo->dataSize = 0;
- _MmsDataUpdateLastStatus(pMsg);
+ strncpy(pMsgInfo->msgData, getMmsReadStatus(mmsHeader.readStatus), MAX_MSG_DATA_LEN);
+ pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
- pStatus->bReadReplyIsLast= true;
+ MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
+ strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
- MmsUpdateReadReport(pMsgInfo->msgId, pStatus);
+ int tmpId = MmsSearchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
+ if (tmpId > 0) {
+ pMsgInfo->msgId = (msg_message_id_t)tmpId;
- MmsPluginStorage::instance()->addMmsNoti(pMsgInfo);
- } else {
- MSG_DEBUG("Can't not find Message!");
- memset(pMsgInfo->msgData, 0x00, MAX_MSG_DATA_LEN + 1);
- pMsgInfo->dataSize = 0;
- strncpy(pMsgInfo->msgData, getMmsReadStatus(mmsHeader.readStatus), MAX_MSG_DATA_LEN);
- pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
- MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
+ MmsMsgMultiStatus Status;
+ memset(&Status, 0x00, sizeof(MmsMsgMultiStatus));
+ Status.readTime = mmsHeader.date;
+ Status.readStatus = mmsHeader.readStatus;
- MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
+ MmsPluginStorage::instance()->insertReadReport(pMsgInfo->msgId, mmsHeader.pFrom->szAddr, &Status);
+ MmsPluginStorage::instance()->addMmsNoti(pMsgInfo);
- strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pTo->szAddr, MAX_ADDRESS_VAL_LEN);
- }
+ } else {
+ MSG_DEBUG("Can't not find Message!");
}
- MsgFreeAttrib(&pMsg->mmsAttrib);
-
- free(pMsg);
-
MSG_END();
}
{
MSG_BEGIN();
- msg_error_t err = MSG_SUCCESS;
-
MMS_RECV_DATA_S recvData = {{0}, };
pMsgInfo->msgId = pRequest->msgId;
if (mmsHeader.responseStatus == MMS_RESPSTATUS_OK) {
pMsgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS;
+ pMsgInfo->dataSize = pRequest->postDataLen;
} else {
pMsgInfo->networkStatus = MSG_NETWORK_SEND_FAIL;
strcpy(szFileName, pMsg->szFileName);
err = pStorage->getMsgText(&msgData, pMsgInfo->msgText);
- err = pStorage->makeThumbnail(&msgData, pMsgInfo->thumbPath, szFileName);
-
+ MmsMakePreviewInfo(pMsgInfo->msgId, &msgData);
bMultipartRelated = true;
} else {
MSG_DEBUG("Multipart mixed message doesn't support mms conversation");
#include "MmsPluginStorage.h"
#include "MsgMmsMessage.h"
#include "MsgGconfWrapper.h"
-
+#include "MmsPluginUtil.h"
#include "MmsPluginSMILValidate.h"
pMsg->msgBody.presentationType.param.charset = MSG_CHARSET_UTF8;
snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>");
- snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, pMsg->msgBody.presentationType.szContentID);
+ snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, "%s", pMsg->msgBody.presentationType.szContentID);
pMsg->msgType.param.type = mimeType;
memset(pMsg->msgBody.pPresentationBody->body.pText, 0, size + 1);
return false;
}
-bool _MsgIsASCII(char *pszText)
-{
- int length = strlen(pszText);
-
- for (int i = 0; i < length; ++i) {
- if (!isascii(pszText[i])) {
- MSG_DEBUG("_MsgIsASCII false.");
- return false;
- }
- }
-
- MSG_DEBUG("_MsgIsASCII true.");
- return true;
-}
-
-
-bool _MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar)
-{
- MSG_DEBUG("_MsgReplaceNonAscii");
- int nCount = 0;
- int index = 0;
- int cLen = 0;
- char *pNew = NULL;
-
- cLen = strlen(szInText);
-
- pNew = (char *)malloc(cLen + 1);
-
- if (pNew == NULL)
- return false;
-
- memset(pNew, 0, cLen + 1);
-
- while (*(szInText+nCount) != '\0') {
- if (0x0001 <= *(szInText+nCount) && *(szInText+nCount) <= 0x007F) {
- MSG_DEBUG("_MsgReplaceNonAscii: non ascii characters (1bytes). \n");
- pNew[index] = szInText[nCount];
- nCount += 1;
- index += 1;
- } else {
- MSG_DEBUG("_MsgReplaceNonAscii: UTF-8 characters (2bytes). \n");
- pNew[index] = replaceChar;
- nCount += 1;
- index +=1;
- }
- }
-
- *szOutText = pNew;
- return true;
-}
-
-bool _MsgIsSpace(char *pszText)
-{
- MSG_DEBUG("_MsgIsSpace");
- if (!pszText) {
- MSG_DEBUG("_MsgIsSpace: pszText == NULL!\n");
- return false;
- }
-
- if (strchr(pszText, ' ') != NULL)
- return true;
- else
- return false;
-}
-
-bool _MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar)
-{
- MSG_DEBUG("_MsgReplaceSpecialChar");
- char *pszOutText = NULL;
- char szBuf[10] = {0, };
- char temp[5] = {0, };
- int cLen = 0;
- int i = 0;
-
- if (!szInText) {
- MSG_DEBUG("_MsgReplaceSpecialChar: szInText == NULL! \n");
- return false;
- }
-
- if (!szOutText)
- return false;
-
- cLen = strlen(szInText);
-
- if (specialChar == ' ') {
- if ((pszOutText = (char *)malloc(cLen + 1)) == NULL) {
- MSG_DEBUG("_MsgReplaceSpecialChar : %d line. MemAlloc failed.\n", __LINE__);
- return false;
- }
- memset(pszOutText, 0, cLen + 1);
-
- *szOutText = pszOutText;
- }
-
- for (i = 0; i<cLen; i++) {
- switch (specialChar) {
- // changed space to '_'
- case ' ':
- pszOutText[i] = (szInText[i] == specialChar) ? '_' : szInText[i];
- break;
-
- default:
- if (szInText[i] != specialChar) {
- temp[0] = szInText[i];
- *szOutText = MsgStrAppend(*szOutText, temp);
- continue;
- } else {
- _MsgConvertCharToHex(specialChar, szBuf);
- *szOutText = MsgStrAppend(*szOutText, (char *)"%");
- *szOutText = MsgStrAppend(*szOutText, szBuf);
- }
- break;
- }
- }
-
- MSG_DEBUG("_MsgReplaceSpecialChar : output text : [%s]\n", pszOutText);
-
- return true;
-}
-
-char *MsgStrAppend(char *szInputStr1, char *szInputStr2)
-{
- MSG_DEBUG("MsgStrAppend");
- char *szOutputStr = NULL;
-
- if (szInputStr1 == NULL) {
- szOutputStr = MsgStrCopy(szInputStr2);
- } else {
- int length1 = 0;
- int length2 = 0;
- length1 = MsgStrlen(szInputStr1);
- length2 = MsgStrlen(szInputStr2);
-
- szOutputStr = (char *)malloc(length1 + length2 + 1);
-
- if (szOutputStr == NULL)
- goto __CATCH;
-
- memset(szOutputStr, 0, length1 + length2 + 1);
-
- strncpy(szOutputStr, szInputStr1, length1);
-
- if (length2 > 0)
- strcat(szOutputStr, szInputStr2);
-
- free(szInputStr1);
- szInputStr1 = NULL;
- }
-
- return szOutputStr;
-
-__CATCH:
- return NULL;
-}
-
-char *MsgStrCopy(const char *string)
-{
- char *pDst = NULL;
-
- if (string) {
- pDst = (char *)malloc(1 + strlen(string));
- if (pDst == NULL) {
- MSG_DEBUG("MsgStrCopy: pDst MemAlloc Fail \n");
- return NULL;
- }
-
- memset(pDst, 0, strlen(string) + 1);
-
- strcpy(pDst,string);
-
- return pDst;
- }
-
- return NULL;
-}
-
-char *MsgStrNCopy(const char *string, int length)
-{
- char *pDst = NULL;
-
- if (string) {
- pDst = (char *)malloc(1 + length);
- if (pDst == NULL) {
- MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n");
- return NULL;
- }
-
- memset(pDst, 0, length + 1);
- strncpy(pDst,string, length);
-
- return pDst;
- }
-
- return NULL;
-}
-
-int MsgStrlen(char * pStr)
-{
- if (pStr == NULL)
- return 0;
-
- return strlen(pStr);
-}
-
-bool _MsgConvertCharToHex(char pSrc, char *pDest)
-{
- static unsigned char saucHex[] = "0123456789ABCDEF";
- pDest[0] = saucHex[pSrc >> 4];
- pDest[1] = saucHex[pSrc & 0xF];
- pDest[2] = 0;
-
- return true;
-}
MsgMultipart *MmsAllocMultipart(void)
{
if (pageCnt == 0) { // Multipart mixed
pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
+ MmsMakePreviewInfo(pMsgInfo->msgId, pMsgData);
} else { // Multipart related
int RawDataSize = 0;
MmsPluginStorage *pStorage = MmsPluginStorage::instance();
err = pStorage->getMsgText(pMsgData, pMsgInfo->msgText);
- err = pStorage->makeThumbnail(pMsgData, pMsgInfo->thumbPath, szFileName);
+ MmsMakePreviewInfo(pMsgInfo->msgId, pMsgData);
}
#ifdef FEATURE_JAVA_MMS
return msgId;
}
-void MmsUpdateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
-{
- MSG_BEGIN();
-
- MmsPluginStorage::instance()->updateDeliveryReport(msgId, pStatus);
-
- MSG_END();
-}
-
-void MmsUpdateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
-{
- MSG_BEGIN();
-
- MmsPluginStorage::instance()->updateReadReport(msgId, pStatus);
-
- MSG_END();
-}
-
MmsMsgMultiStatus *MmsGetMultiStatus(msg_message_id_t msgId)
{
MmsMsgMultiStatus *pMultiStatus;
return true;
}
#endif
+
+msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg)
+{
+ MMS_PAGE_S *pPage = NULL;
+ MMS_MEDIA_S *pMedia = NULL;
+
+ if (pMmsMsg == NULL)
+ return MSG_ERR_NULL_POINTER;
+
+ if (pMmsMsg->pageCnt > 0) {
+
+ MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_PAGE, (char *)"pagecount", pMmsMsg->pageCnt);
+
+ pPage = _MsgMmsGetPage(pMmsMsg, 0);
+ for (int j = 0; j < pPage->mediaCnt; j++) {
+
+ pMedia = _MsgMmsGetMedia(pPage, j);
+ MSG_DEBUG("pMedia's Name: %s", pMedia->szFilePath);
+
+ if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG || pMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) {
+ char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };
+ char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, };
+
+ memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1);
+ memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX);
+
+ snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms",msgId);
+ snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.jpg", szFileName);
+
+ if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) {
+ if (makeImageThumbnail(pMedia->szFilePath, thumbPath) == true) {
+ MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_IMG, thumbPath);
+ } else {
+ MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath);
+ }
+ } else {
+ if (makeVideoThumbnail(pMedia->szFilePath, thumbPath) == true) {;
+ MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_VIDEO, thumbPath);
+ } else {
+ MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMedia->szFilePath, thumbPath);
+ }
+ }
+
+ } else if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) {
+ MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_AUDIO, pMedia->szFileName);
+ }
+ }
+ } else {
+ MSG_DEBUG("There is no page");
+ }
+
+ int attachCnt = _MsgMmsGetAttachCount(pMmsMsg);
+ if (attachCnt > 0) {
+ MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0);
+ MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt);
+ } else {
+ MSG_DEBUG("There is no attachment");
+ }
+
+ return MSG_SUCCESS;
+}
} else if (MMSUI_IMAGE_REGION_FIT_HIDDEN == pstSmilRegion->fit) {
xmlSetProp(pstRegion, (const xmlChar *)"fit", (const xmlChar *)"hidden");
}
+
+ __MmsSmilInsertNode(pstLayoutList, pstRootLayoutList, pstRegion);
+
} else
MSG_DEBUG("There is no attribute in <region> node\n");
#include <sys/stat.h>
#include <errno.h>
-#include <mm_file.h>
-#include <mm_util_jpeg.h>
-
#include "MsgDebug.h"
#include "MsgException.h"
#include "MsgUtilFile.h"
#include "MmsPluginCodec.h"
#include "MmsPluginSmil.h"
#include "MmsPluginDrm.h"
-#include <media-thumbnail.h>
-#include <mm_util_imgp.h>
-#include <mm_util_jpeg.h>
#include "MsgHelper.h"
static void __MmsReleaseMmsLists(MMS_MESSAGE_DATA_S *mms_data)
MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off
MsgCloseFile(pFile);
+ char filepath[MSG_FILEPATH_LEN_MAX+1] = {0,};
+ int size = 0;
+
+ snprintf((char *)filepath, MSG_FILEPATH_LEN_MAX+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
+ MsgGetFileSize(filepath, &size);
+ pMsgInfo->dataSize = size;
+
_MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
strcpy(szFileName, pMsg->szFileName);
err = pStorage->getMsgText(&mmsMsgData, pMsgInfo->msgText);
- err = pStorage->makeThumbnail(&mmsMsgData, pMsgInfo->thumbPath, szFileName);
-
+ MmsMakePreviewInfo(pMsgInfo->msgId, &mmsMsgData);
__MmsReleaseMmsLists(&mmsMsgData);
}
return MSG_SUCCESS;
}
-
msg_error_t MmsPluginStorage::plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg)
{
MSG_BEGIN();
char filePath[MAX_FULL_PATH_SIZE+1] = {0, };
char sqlQuery[MAX_QUERY_LEN + 1];
- unsigned int addrId = 0;
FILE *pFile = NULL;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
return MSG_SUCCESS;
}
-
-msg_error_t MmsPluginStorage::updateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
+msg_error_t MmsPluginStorage::insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus)
{
char sqlQuery[MAX_QUERY_LEN + 1];
-
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET DELIVERY_REPORT_STATUS = %d, DELIVERY_REPORT_TIME = %ld WHERE MSG_ID = %d;",
- MSGFW_MESSAGE_TABLE_NAME, pStatus->msgStatus, pStatus->handledTime, msgId);
+ //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
+ "(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
+ "VALUES (%d, '%s', %d, %d, %d);",
+ MSGFW_REPORT_TABLE_NAME, msgId, address, MSG_REPORT_TYPE_DELIVERY, pStatus->msgStatus, (int)pStatus->handledTime);
+
+ MSG_DEBUG("QUERY : [%s]", sqlQuery);
if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_EXEC;
return MSG_SUCCESS;
}
-
-msg_error_t MmsPluginStorage::updateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus)
+msg_error_t MmsPluginStorage::insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus)
{
char sqlQuery[MAX_QUERY_LEN + 1];
-
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_REPORT_STATUS = %d, READ_REPORT_TIME = %lu WHERE MSG_ID = %d;",
- MSGFW_MESSAGE_TABLE_NAME, pStatus->readStatus, pStatus->readTime, msgId);
+ //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
+ "(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
+ "VALUES (%d, '%s', %d, %d, %d);",
+ MSGFW_REPORT_TABLE_NAME, msgId, address, MSG_REPORT_TYPE_READ, pStatus->readStatus, (int)pStatus->readTime);
+ MSG_DEBUG("QUERY : [%s]", sqlQuery);
if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_EXEC;
return MSG_SUCCESS;
}
-
msg_error_t MmsPluginStorage::updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType)
{
MSG_BEGIN();
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET EXPIRY_TIME = %d WHERE MSG_ID = %d;",
MMS_PLUGIN_MESSAGE_TABLE_NAME, attrib->expiryTime.time, msgId);
} else if (msgSubType == MSG_RETRIEVE_AUTOCONF_MMS || msgSubType == MSG_RETRIEVE_MANUALCONF_MMS) {
- snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, ASK_READ_REPLY = %d, PRIORITY = %d WHERE MSG_ID = %d;",
- MMS_PLUGIN_MESSAGE_TABLE_NAME, attrib->bAskDeliveryReport, attrib->bAskReadReply, attrib->priority, msgId);
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, ASK_READ_REPLY = %d, PRIORITY = %d, VERSION = %d WHERE MSG_ID = %d;",
+ MMS_PLUGIN_MESSAGE_TABLE_NAME, attrib->bAskDeliveryReport, attrib->bAskReadReply, attrib->priority, attrib->version, msgId);
}
MSG_DEBUG("QUERY : [%s]", sqlQuery);
return MSG_SUCCESS;
}
-
-msg_error_t MmsPluginStorage::makeThumbnail(MMS_MESSAGE_DATA_S *pMmsMsg, char *pThumbnailPath, char *szFileName)
+msg_error_t MmsPluginStorage::insertPreviewInfo(int msgId, int type, char *value, int count)
{
- MMS_PAGE_S *pPage = NULL;
- MMS_MEDIA_S *pMedia = NULL;
-
- bool bThumbnail = false;
-
- for (int i = 0; i < pMmsMsg->pageCnt; i++) {
- pPage = _MsgMmsGetPage(pMmsMsg, i);
- for (int j = 0; j < pPage->mediaCnt; j++) {
- pMedia = _MsgMmsGetMedia(pPage, j);
-
- MSG_DEBUG("pMedia's Name: %s", pMedia->szFilePath);
-
- if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) {
- MSG_DEBUG("Make thumbnail: image");
-
- char thumbPath[MSG_FILEPATH_LEN_MAX] = {0, };
-
- snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"/%s.jpg", szFileName);
- int err = -1;
- err = thumbnail_request_save_to_file(pMedia->szFilePath, MEDIA_THUMB_LARGE, thumbPath);
- if (err < 0) {
- MSG_DEBUG("Make thumbnail: image failed");
- continue;
- }
-
- strncpy(pThumbnailPath, thumbPath, MSG_FILEPATH_LEN_MAX);
-
- bThumbnail = true;
-
- break;
- } else if (pMedia->mediatype == MMS_SMIL_MEDIA_VIDEO) {
- MSG_DEBUG("Make thumbnail: video");
-
- MMHandleType content_attrs = (MMHandleType)NULL;
- char *err_attr_name = NULL;
-
- int fileRet = 0;
-
- int trackCount = 0;
-
- mm_file_create_content_attrs(&content_attrs, pMedia->szFilePath);
-
- fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &trackCount, NULL);
-
- if (fileRet != 0) {
- MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
- if (err_attr_name) {
- free(err_attr_name);
- err_attr_name = NULL;
- }
-
- mm_file_destroy_content_attrs(content_attrs);
-
- continue;
- }
-
- MSG_DEBUG("video track num: %d", trackCount);
-
- if (trackCount > 0) {
- int thumbnailWidth = 0;
- int thumbnailHeight = 0;
- int thumbnailSize = 0;
-
- void *thumbnail = NULL;
-
- fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &thumbnailWidth,
- MM_FILE_CONTENT_VIDEO_HEIGHT, &thumbnailHeight,
- MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail, &thumbnailSize,
- NULL);
-
- if (fileRet != 0) {
- MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
- if (err_attr_name) {
- free(err_attr_name);
- err_attr_name = NULL;
- }
-
- mm_file_destroy_content_attrs(content_attrs);
-
- continue;
- }
-
- MSG_DEBUG("video width: %d", thumbnailWidth);
- MSG_DEBUG("video height: %d", thumbnailHeight);
- MSG_DEBUG("video thumbnail: %p", thumbnail);
-
- if (thumbnail) {
- char thumbPath[MSG_FILEPATH_LEN_MAX] = {0, };
-
- snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName);
-
- fileRet = mm_util_jpeg_encode_to_file (thumbPath, thumbnail, thumbnailWidth, thumbnailHeight, MM_UTIL_JPEG_FMT_RGB888, 70);
-
- if (fileRet != 0) {
- MSG_DEBUG("mm_util_jpeg_encode_to_file fails [%d]", fileRet);
-
- mm_file_destroy_content_attrs(content_attrs);
-
- continue;
- }
-
- memset(pThumbnailPath, 0x00, MSG_FILEPATH_LEN_MAX);
-
- strncpy(pThumbnailPath, thumbPath, MSG_FILEPATH_LEN_MAX);
-
- bThumbnail = true;
-
- }
-
- mm_file_destroy_content_attrs(content_attrs);
-
- break;
- }
-
- mm_file_destroy_content_attrs(content_attrs);
- } else if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) {
- MSG_DEBUG("Make thumbnail: %s", "audio");
-
- MMHandleType tag_attrs = (MMHandleType)NULL;
- char *err_attr_name = NULL;
- void *artwork = NULL;
- int artworkSize = 0;
- int tmpLen = 0;
- int fileRet = 0;
-
- if (mm_file_create_tag_attrs(&tag_attrs, pMedia->szFilePath) == 0) {
-
-
- fileRet = mm_file_get_attrs(tag_attrs, &err_attr_name, MM_FILE_TAG_ARTWORK, &artwork, &tmpLen,
- MM_FILE_TAG_ARTWORK_SIZE, &artworkSize,
- NULL);
-
- mm_file_destroy_tag_attrs(tag_attrs);
-
- if (fileRet != 0) {
- MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
- if (err_attr_name) {
- free(err_attr_name);
- err_attr_name = NULL;
- }
-
- continue;
- }
- } else {
- MSG_DEBUG("mm_file_create_tag_attrs fails");
- continue;
- }
-
- MSG_DEBUG("artwork: %p", artwork);
- MSG_DEBUG("artwork_size: %d", artworkSize);
-
- if (artwork) {
- char thumbPath[MSG_FILEPATH_LEN_MAX] = {0, };
-
- snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName);
-
- FILE *tmp = MsgOpenFile(thumbPath, "wb+");
-
- if(!tmp) {
- MSG_DEBUG("MsgOpenFile file error");
- return MSG_ERR_STORAGE_ERROR;
- }
-
- if (MsgWriteFile((char*)artwork, 1, artworkSize, tmp) != (size_t)artworkSize) {
- MSG_DEBUG("MsgWriteFile error");
- MsgCloseFile(tmp);
- return MSG_ERR_STORAGE_ERROR;
- }
- MsgFsync(tmp);
- MsgCloseFile(tmp);
-
- strncpy(pThumbnailPath, thumbPath, MSG_FILEPATH_LEN_MAX);
+ char sqlQuery[MAX_QUERY_LEN + 1];
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
- bThumbnail = true;
+ //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT)
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "INSERT INTO %s "
+ "(MSG_ID, TYPE, VALUE, COUNT)"
+ "VALUES (%d, %d, '%s', %d);",
+ MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, type, value, count);
- break;
- }
- }
- }
+ MSG_DEBUG("QUERY : [%s]", sqlQuery);
- if (bThumbnail == true)
- break;
- }
+ if (dbHandle.execQuery(sqlQuery) != MSG_SUCCESS)
+ return MSG_ERR_DB_EXEC;
return MSG_SUCCESS;
}
-
msg_error_t MmsPluginStorage::addMmsNoti(MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
void MmsPluginUaManager::start()
{
- bool bStart = true;
+// bool bStart = true;
MutexLocker lock(mx);
MmsPluginHttpAgent *httpAgent = MmsPluginHttpAgent::instance();
int trId;
- CURL *session = NULL;
+// CURL *session = NULL;
int msgId;
MSG_BEGIN();
char fileName[MSG_FILENAME_LEN_MAX] = {0};
- FILE *pFile = NULL;
MSG_DEBUG(":::%d :%s ", rcvdBodyLen, pRcvdBody);
--- /dev/null
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <mm_file.h>
+#include <mm_util_jpeg.h>
+#include <mm_util_imgp.h>
+
+#include <media-thumbnail.h>
+
+//----str
+#include <ctype.h>
+
+#include "MsgDebug.h"
+#include "MmsPluginUtil.h"
+
+bool makeImageThumbnail(char *srcPath, char *dstPath)
+{
+ if (srcPath == NULL || dstPath == NULL) {
+ MSG_DEBUG("Make thumbnail: failed [Invalid Parameter]");
+ return false;
+ }
+
+ int err = -1;
+ err = thumbnail_request_save_to_file(srcPath, MEDIA_THUMB_LARGE, dstPath);
+ if (err < 0) {
+ MSG_DEBUG("Make thumbnail: failed");
+ return false;
+ }
+
+ MSG_DEBUG("Make thumbnail: success [%s]", dstPath);
+ return true;
+}
+
+bool makeVideoThumbnail(char *srcPath, char *dstPath)
+{
+ MMHandleType content_attrs = (MMHandleType)NULL;
+ char *err_attr_name = NULL;
+ int fileRet = 0;
+ int trackCount = 0;
+
+ if (srcPath == NULL || dstPath == NULL) {
+ MSG_DEBUG("Make thumbnail: failed [Invalid Parameter]");
+ return false;
+ }
+
+ mm_file_create_content_attrs(&content_attrs, srcPath);
+ fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &trackCount, NULL);
+
+ if (fileRet != 0) {
+ MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
+
+ if (err_attr_name) {
+ free(err_attr_name);
+ err_attr_name = NULL;
+ }
+
+ mm_file_destroy_content_attrs(content_attrs);
+
+ return false;
+ }
+
+ MSG_DEBUG("video track num: %d", trackCount);
+
+ if (trackCount <= 0) {
+ mm_file_destroy_content_attrs(content_attrs);
+ return false;
+ }
+
+
+ int thumbnailWidth = 0;
+ int thumbnailHeight = 0;
+ int thumbnailSize = 0;
+ void *thumbnail = NULL;
+
+ fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &thumbnailWidth,
+ MM_FILE_CONTENT_VIDEO_HEIGHT, &thumbnailHeight,
+ MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail, &thumbnailSize,
+ NULL);
+
+ if (fileRet != 0) {
+ MSG_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
+ if (err_attr_name) {
+ free(err_attr_name);
+ err_attr_name = NULL;
+ }
+
+ mm_file_destroy_content_attrs(content_attrs);
+ return false;
+ }
+
+ MSG_DEBUG("video width: %d", thumbnailWidth);
+ MSG_DEBUG("video height: %d", thumbnailHeight);
+ MSG_DEBUG("video thumbnail: %p", thumbnail);
+
+ if (thumbnail == NULL) {
+ mm_file_destroy_content_attrs(content_attrs);
+ return false;
+ }
+
+ fileRet = mm_util_jpeg_encode_to_file (dstPath, thumbnail, thumbnailWidth, thumbnailHeight, MM_UTIL_JPEG_FMT_RGB888, 70);
+ if (fileRet != 0) {
+ MSG_DEBUG("mm_util_jpeg_encode_to_file fails [%d]", fileRet);
+ mm_file_destroy_content_attrs(content_attrs);
+ return false;
+ }
+
+ MSG_DEBUG("Make thumbnail: success [%s]", dstPath);
+ mm_file_destroy_content_attrs(content_attrs);
+ return true;
+}
+
+//----------------------------------------------------------------------
+bool MsgIsASCII(char *pszText)
+{
+ int length = strlen(pszText);
+
+ for (int i = 0; i < length; ++i) {
+ if (!isascii(pszText[i])) {
+ MSG_DEBUG("_MsgIsASCII false.");
+ return false;
+ }
+ }
+
+ MSG_DEBUG("_MsgIsASCII true.");
+ return true;
+}
+
+
+bool MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar)
+{
+ MSG_DEBUG("_MsgReplaceNonAscii");
+ int nCount = 0;
+ int index = 0;
+ int cLen = 0;
+ char *pNew = NULL;
+
+ cLen = strlen(szInText);
+
+ pNew = (char *)malloc(cLen + 1);
+
+ if (pNew == NULL)
+ return false;
+
+ memset(pNew, 0, cLen + 1);
+
+ while (*(szInText+nCount) != '\0') {
+ if (0x0001 <= *(szInText+nCount) && *(szInText+nCount) <= 0x007F) {
+ MSG_DEBUG("_MsgReplaceNonAscii: non ascii characters (1bytes). \n");
+ pNew[index] = szInText[nCount];
+ nCount += 1;
+ index += 1;
+ } else {
+ MSG_DEBUG("_MsgReplaceNonAscii: UTF-8 characters (2bytes). \n");
+ pNew[index] = replaceChar;
+ nCount += 1;
+ index +=1;
+ }
+ }
+
+ *szOutText = pNew;
+ return true;
+}
+
+bool MsgIsSpace(char *pszText)
+{
+ MSG_DEBUG("_MsgIsSpace");
+ if (!pszText) {
+ MSG_DEBUG("_MsgIsSpace: pszText == NULL!\n");
+ return false;
+ }
+
+ if (strchr(pszText, ' ') != NULL)
+ return true;
+ else
+ return false;
+}
+
+bool MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar)
+{
+ MSG_DEBUG("_MsgReplaceSpecialChar");
+ char *pszOutText = NULL;
+ char szBuf[10] = {0, };
+ char temp[5] = {0, };
+ int cLen = 0;
+ int i = 0;
+
+ if (!szInText) {
+ MSG_DEBUG("_MsgReplaceSpecialChar: szInText == NULL! \n");
+ return false;
+ }
+
+ if (!szOutText)
+ return false;
+
+ cLen = strlen(szInText);
+
+ if (specialChar == ' ') {
+ if ((pszOutText = (char *)malloc(cLen + 1)) == NULL) {
+ MSG_DEBUG("_MsgReplaceSpecialChar : %d line. MemAlloc failed.\n", __LINE__);
+ return false;
+ }
+ memset(pszOutText, 0, cLen + 1);
+
+ *szOutText = pszOutText;
+ }
+
+ for (i = 0; i<cLen; i++) {
+ switch (specialChar) {
+ // changed space to '_'
+ case ' ':
+ pszOutText[i] = (szInText[i] == specialChar) ? '_' : szInText[i];
+ break;
+
+ default:
+ if (szInText[i] != specialChar) {
+ temp[0] = szInText[i];
+ *szOutText = MsgStrAppend(*szOutText, temp);
+ continue;
+ } else {
+ MsgConvertCharToHex(specialChar, szBuf);
+ *szOutText = MsgStrAppend(*szOutText, (char *)"%");
+ *szOutText = MsgStrAppend(*szOutText, szBuf);
+ }
+ break;
+ }
+ }
+
+ MSG_DEBUG("_MsgReplaceSpecialChar : output text : [%s]\n", pszOutText);
+
+ return true;
+}
+
+char *MsgStrAppend(char *szInputStr1, char *szInputStr2)
+{
+ MSG_DEBUG("MsgStrAppend");
+ char *szOutputStr = NULL;
+
+ if (szInputStr1 == NULL) {
+ szOutputStr = MsgStrCopy(szInputStr2);
+ } else {
+ int length1 = 0;
+ int length2 = 0;
+ length1 = MsgStrlen(szInputStr1);
+ length2 = MsgStrlen(szInputStr2);
+
+ szOutputStr = (char *)malloc(length1 + length2 + 1);
+
+ if (szOutputStr == NULL)
+ goto __CATCH;
+
+ memset(szOutputStr, 0, length1 + length2 + 1);
+
+ strncpy(szOutputStr, szInputStr1, length1);
+
+ if (length2 > 0)
+ strcat(szOutputStr, szInputStr2);
+
+ free(szInputStr1);
+ szInputStr1 = NULL;
+ }
+
+ return szOutputStr;
+
+__CATCH:
+ return NULL;
+}
+
+char *MsgStrCopy(const char *string)
+{
+ char *pDst = NULL;
+
+ if (string) {
+ pDst = (char *)malloc(1 + strlen(string));
+ if (pDst == NULL) {
+ MSG_DEBUG("MsgStrCopy: pDst MemAlloc Fail \n");
+ return NULL;
+ }
+
+ memset(pDst, 0, strlen(string) + 1);
+
+ strcpy(pDst,string);
+
+ return pDst;
+ }
+
+ return NULL;
+}
+
+char *MsgStrNCopy(const char *string, int length)
+{
+ char *pDst = NULL;
+
+ if (string) {
+ pDst = (char *)malloc(1 + length);
+ if (pDst == NULL) {
+ MSG_DEBUG("MsgStrNCopy: pDst MemAlloc Fail \n");
+ return NULL;
+ }
+
+ memset(pDst, 0, length + 1);
+ strncpy(pDst,string, length);
+
+ return pDst;
+ }
+
+ return NULL;
+}
+
+int MsgStrlen(char * pStr)
+{
+ if (pStr == NULL)
+ return 0;
+
+ return strlen(pStr);
+}
+
+bool MsgConvertCharToHex(char pSrc, char *pDest)
+{
+ static unsigned char saucHex[] = "0123456789ABCDEF";
+
+ pDest[0] = saucHex[pSrc >> 4];
+ pDest[1] = saucHex[pSrc & 0xF];
+ pDest[2] = 0;
+
+ return true;
+}
const char *MmsDebugGetMsgStatus(msg_delivery_report_status_t msgStatus);
const char *MmsDebugGetMsgClass(MmsMsgClass msgClass);
const char *MmsDebugGetDataType(MmsDataType dataType);
-#ifdef MMS_PLUGIN_DEBUG_ENABLE
-bool MmsDebugPrintMsgAttributes(char *pszFunc, MmsAttrib *pAttrib, bool bAll);
-char *MmsDebugGetMsgDrmType(MsgDrmType drmType);
-char *MmsDebugGetDrmDeliveryMode(DrmDeliveryMode deliveryMode);
-char *MmsDebugGetDrmRightState(DrmRightState rightState);
-bool MmsDebugPrintDrmRight(DrmRight *pDrmRight);
-char *MmsDebugPrintMsgDRMStatus(MsgDRMStatus status);
-bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index);
-char *DebugPrintGetRmResultInd(MmsRmResultInd indType);
-char *DebugPrintHttpStatusCode(int status);
-char *DebugPrintRmMethodType(MmsRmMethodType method);
-char *DebugPrintGetMmsRmNetState(MmsRmNetState state);
-char *DebugPrintGetMmsRmEntityState(MmsRmExEntityState stateEx);
-char *MmsDebugPrintMmsRmResult(MmsRmResult result);
-void MmsDebugPrintReqEntityInfo(MmsRmRequest *pEntity);
-char *MmsDebugPrintHttpErrorCode(int errCode);
-char *MmsDebugPrintProtoErrorCode(int errCode);
-char *DebugPrintWspResult(WspResult wspResult);
-char *DebugPrintWspState(MmsRmWapState wspState);
-char *MmsDebugPrintRmPduType(MmsRmPduType pduType);
-char *MmsDebugPrintMailboxType(MsgMailboxType mailboxType);
-#endif
-
-typedef enum {
- MMS_DEBUG_EV_NONE,
- MMS_DEBUG_EV_MMS,
- MMS_DEBUG_EV_SMS,
- MMS_DEBUG_EV_COMMON,
- MMS_DEBUG_EV_EMAIL
-
-} MmsDebugEvType;
-
-bool MmsDebugPrintCurrentEventHandler(char *pszFunc, MmsDebugEvType evType);
#endif //MMS_PLUGIN_DEBUG_H
void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId);
MmsMsgMultiStatus *MmsGetMultiStatus(msg_message_id_t msgId);
int MmsSearchMsgId(char *toNumber, char *szMsgID);
-void MmsUpdateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
-void MmsUpdateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
MsgMultipart *MmsAllocMultipart(void);
-bool _MsgIsASCII(char *pszText);
-bool _MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar);
-bool _MsgIsSpace(char *pszText);
-bool _MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar);
-char *MsgStrAppend(char *szInputStr1, char *szInputStr2);
-char *MsgStrCopy(const char *string);
-char *MsgStrNCopy(const char *string, int length);
-int MsgStrlen(char *pStr);
-bool _MsgConvertCharToHex(char pSrc, char *pDest);
msg_error_t MmsAddAttachment(MMS_MESSAGE_DATA_S *pMsgData, MMS_MEDIA_S *pMedia);
bool MmsCheckAdditionalMedia(MMS_MESSAGE_DATA_S *pMsgData, MsgType *partHeader);
#ifdef __SUPPORT_DRM__
bool __MsgInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo);
#endif
+msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg);
#endif
void composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
int searchMsgId(char *toNumber, char *szMsgID);
- int getMmsVersion(msg_message_id_t selectedMsgId);
+ int getMmsVersion(msg_message_id_t selectedMsgId);
- msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
- msg_error_t updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
- msg_error_t updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType);
+ msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData);
+ msg_error_t updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t updateMmsAttrib(msg_message_id_t msgId, MmsAttrib *attrib, MSG_SUB_TYPE_T msgSubType);
msg_error_t updateMmsAttachCount(msg_message_id_t msgId, int count);
- msg_error_t updateNetStatus(msg_message_id_t msgId, msg_network_status_t netStatus);
- msg_error_t updateDeliveryReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
- msg_error_t updateReadReport(msg_message_id_t msgId, MmsMsgMultiStatus *pStatus);
- msg_error_t setReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
- msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
- msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo);
+ msg_error_t updateNetStatus(msg_message_id_t msgId, msg_network_status_t netStatus);
+
+ msg_error_t insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
+ msg_error_t insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
+ msg_error_t insertPreviewInfo(int msgId, int type, char *value, int count = 0);
+
+ msg_error_t setReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus);
+ msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
+ msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t getMmsRawFilePath(msg_message_id_t msgId, char *pFilepath);
- msg_error_t plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath);
+ msg_error_t plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath);
/* reject_msg_support */
msg_error_t getTrID(MSG_MESSAGE_INFO_S *pMsgInfo, char *pszTrID, int nBufferLen);
/* reject_msg_support */
msg_error_t updateMsgServerID(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo);
MmsMsgMultiStatus *getMultiStatus(msg_message_id_t msgId);
- msg_error_t getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
- msg_error_t makeThumbnail(MMS_MESSAGE_DATA_S *pMmsMsg, char *pThumbnailPath, char *szFileName);
+ msg_error_t getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsgText);
msg_error_t addMmsNoti(MSG_MESSAGE_INFO_S *pMsgInfo);
private:
MsgThdSafeQ <mmsTranQEntity> mmsTranQ; // transaction q for mms plugin
};
-bool MsgOpenCreateAndOverwriteFile(char *szFullPath, char *szBuff, int totalLength);
-
#endif // MMSPLUGINUSERAGENT_H
--- /dev/null
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef MMS_PLUGIN_UTIL_H
+#define MMS_PLUGIN_UTIL_H
+
+/*==================================================================================================
+ INCLUDE FILES
+==================================================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+bool makeImageThumbnail(char *srcPath, char *dstPath);
+bool makeVideoThumbnail(char *srcPath, char *dstPath);
+
+bool MsgIsASCII(char *pszText);
+bool MsgReplaceNonAscii(char *szInText, char **szOutText, char replaceChar);
+bool MsgIsSpace(char *pszText);
+bool MsgReplaceSpecialChar(char *szInText, char **szOutText, char specialChar);
+char *MsgStrAppend(char *szInputStr1, char *szInputStr2);
+char *MsgStrCopy(const char *string);
+char *MsgStrNCopy(const char *string, int length);
+int MsgStrlen(char *pStr);
+bool MsgConvertCharToHex(char pSrc, char *pDest);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //MMS_PLUGIN_UTIL_H
+
##########################################################
SET(SMS-PLUGIN-SRCS
- ${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginTextConvert.cpp
${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginUDCodec.cpp
${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginParamCodec.cpp
${CMAKE_SOURCE_DIR}/plugin/sms_plugin/SmsPluginTpduCodec.cpp
#include "SmsPluginSatHandler.h"
#include "SmsPluginParamCodec.h"
#include "SmsPluginTpduCodec.h"
+#include "SmsPluginTransport.h"
#include "SmsPluginSimMsg.h"
#include "SmsPluginSetting.h"
#include "MsgGconfWrapper.h"
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
-void TapiEventDeviceReady(TapiHandle *handle, int result, void *data, void *user_data)
+void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventDeviceReady is called. : result = [%d]", result);
+ MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
try
{
if (tpdu.tpduType == SMS_TPDU_DELIVER)
{
+ if (tpdu.data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.deliver.pid == 0x11) {
+ MSG_DEBUG("Unsupported message!!");
+ SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ return;
+ }
+
MSG_DEBUG("headerCnt [%d]", tpdu.data.deliver.userData.headerCnt);
for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++)
}
else if (tpdu.tpduType == SMS_TPDU_SUBMIT)
{
+ if (tpdu.data.submit.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.submit.pid == 0x11) {
+ MSG_DEBUG("Unsupported message!!");
+ SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
+ return;
+ }
+
MSG_DEBUG("headerCnt [%d]", tpdu.data.submit.userData.headerCnt);
for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++)
}
SmsPluginSetting::instance()->setCbConfigEvent(&cbOpt, true);
+}
+void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSetMailboxInfo is called.");
}
+void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+#if 0 // New TAPI
+ MSG_DEBUG("TapiEventGetMailboxInfo is called.");
+
+ if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
+ {
+ MSG_DEBUG("Error. data is NULL.");
+ SmsPluginSetting::instance()->setMailboxInfoEvent(NULL, false);
+
+ return;
+ }
+
+ TelSimMailboxList_t *list = (TelSimMailboxList_t *)data;
+ SMS_SIM_MAILBOX_LIST_S mbList = {0,};
+
+ if (list->count <= 0) {
+ SmsPluginSetting::instance()->setMailboxInfoEvent(NULL, true);
+ return;
+ }
+
+ mbList.count = list->count;
+
+ for (int i = 0; i < mbList.count; i++) {
+ mbList.list[i].b_cphs = list->list[i].b_cphs;
+ mbList.list[i].alpha_id_max_len = list->list[i].alpha_id_max_len;
+ mbList.list[i].mb_type = list->list[i].mb_type;
+ mbList.list[i].profile_num = list->list[i].profile_num;
+ mbList.list[i].rec_index = list->list[i].rec_index;
+ mbList.list[i].ton = list->list[i].ton;
+ mbList.list[i].npi = list->list[i].npi;
+ snprintf(mbList.list[i].alpha_id, sizeof(mbList.list[i].alpha_id), "%s", list->list[i].alpha_id);
+ snprintf(mbList.list[i].num, sizeof(mbList.list[i].num), "%s", list->list[i].num);
+ mbList.list[i].cc_id = list->list[i].cc_id;
+ mbList.list[i].ext1_id = list->list[i].ext1_id;
+ }
+
+ SmsPluginSetting::instance()->setMailboxInfoEvent(&mbList, true);
+#endif
+}
+
+void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSetMwiInfo is called.");
+}
+
+void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data)
+{
+#if 0 // New TAPI
+ MSG_DEBUG("TapiEventGetMwiInfo is called.");
+
+ if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
+ {
+ MSG_DEBUG("Error. data is NULL.");
+ SmsPluginSetting::instance()->setMwiInfoEvent(NULL, false);
+
+ return;
+ }
+
+ TelSimMessageWaitingResp_t *MwiInfo = (TelSimMessageWaitingResp_t *)data;
+ SMS_SIM_MWI_INFO_S simMwiInfo = {0,};
+
+ memcpy(&simMwiInfo, MwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
+
+ SmsPluginSetting::instance()->setMwiInfoEvent(&simMwiInfo, true);
+#endif
+}
void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *user_data)
{
}
-
void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventSatMoSmsCtrl is called.");
}
+void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("Tapi result is [%d]", result);
+}
+
+void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ MSG_DEBUG("TapiEventSetMsgStatus is called. result [%d]", result);
+
+ if (result != TAPI_API_SUCCESS || data == NULL)
+ {
+ MSG_DEBUG("Error. data is NULL.");
+ SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
+ return;
+ }
+
+ msg_sim_id_t sim_id = *((msg_sim_id_t *)user_data);
+
+ SmsPluginSimMsg::instance()->setSimEvent(sim_id, true);
+}
+
/*==================================================================================================
IMPLEMENTATION OF SmsPluginCallback - Member Functions
==================================================================================================*/
void SmsPluginCallback::registerEvent()
{
- unsigned int tempId = 0;
-
+ tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL);
tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_INCOM_MSG, TapiEventMsgIncoming, NULL);
tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_CB_INCOM_MSG, TapiEventCbMsgIncoming, NULL);
tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_ETWS_INCOM_MSG, TapiEventEtwsMsgIncoming, NULL);
#include "MsgException.h"
#include "MsgGconfWrapper.h"
#include "MsgUtilFile.h"
-#include "SmsPluginTextConvert.h"
#include "SmsPluginUDCodec.h"
#include "SmsPluginStorage.h"
#include "SmsPluginEventHandler.h"
cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData;
memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText));
- SMS_LANG_INFO_S langInfo = {0};
-
- langInfo.bSingleShift = false;
- langInfo.bLockingShift = false;
-
- if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
- cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
- else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
- cbOutMsg.cbTextLen = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
-
-
+ cbOutMsg.cbTextLen= convertTextToUtf8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), &cbMsg);
+ memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type));
+ memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg);
if (err != MSG_SUCCESS)
{
convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
-
+MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
// Get Receive Time
pCbPage->pageHeader.recvTime = getRecvTime();
dataLen = (dataLen*8) / 7;
SmsPluginUDCodec udCodec;
- int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pCbPage->pageData);
+ char pageData[MAX_CBMSG_PAGE_SIZE+1];
+ int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pageData);
+
+ if(pCbPage->pageHeader.dcs.iso639Lang[0])
+ {
+ unpackLen = unpackLen - 3;
+ memcpy(pCbPage->pageData, &pageData[3], unpackLen);
+ } else {
+ memcpy(pCbPage->pageData, &pageData, unpackLen);
+ }
-MSG_DEBUG("dataLen : [%d]", dataLen);
-MSG_DEBUG("unpackLen : [%d]", unpackLen);
+ MSG_DEBUG("unpackLen : [%d]", unpackLen);
pCbPage->pageLength = unpackLen;
pCbPage->pageData[unpackLen] = '\0';
-
-// pCbPage->pageLength = strlen(pCbPage->pageData);
-// pCbPage->pageData[pCbPage->pageLength] = '\0';
}
break;
{
MSG_DEBUG("UCS2");
- memcpy(pCbPage->pageData, &cbData[6], dataLen);
-
- pCbPage->pageLength = strlen(pCbPage->pageData);
-
- pCbPage->pageData[pCbPage->pageLength] = '\0';
+ if(pCbPage->pageHeader.dcs.iso639Lang[0])
+ {
+ memcpy(pCbPage->pageData, &cbData[8], dataLen - 2);
+ pCbPage->pageLength = dataLen - 2;
+ } else {
+ memcpy(pCbPage->pageData, &cbData[6], dataLen);
+ pCbPage->pageLength = dataLen;
+ }
}
break;
}
MSG_DEBUG("LENGTH %d CB MSG %s", cbMsg.msgLength, cbMsg.msgData);
- SMS_LANG_INFO_S langInfo = {0};
-
- langInfo.bSingleShift = false;
- langInfo.bLockingShift = false;
-
// Convert Data values
- if (cbMsg.codingScheme == SMS_CHARSET_7BIT)
- pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength, &langInfo);
- else if (cbMsg.codingScheme == SMS_CHARSET_UCS2)
- pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)cbMsg.msgData, cbMsg.msgLength);
+ pMsgInfo->dataSize = convertTextToUtf8((unsigned char*)tmpBuf, bufSize, &cbMsg);
if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
{
memcpy(pMsgInfo->msgData, EtwsMsg.pageData, pMsgInfo->dataSize);
}
+int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg)
+{
+ int convertedTextSize = 0;
+ MSG_LANG_INFO_S langInfo = {0,};
+
+ if (!outBuf || !pCbMsg)
+ {
+ MSG_DEBUG ("invalid param.\n");
+ return 0;
+ }
+
+ langInfo.bSingleShift = false;
+ langInfo.bLockingShift = false;
+
+
+ // Convert Data values
+ if (pCbMsg->codingScheme == SMS_CHARSET_7BIT)
+ convertedTextSize = textCvt.convertGSM7bitToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength, &langInfo);
+ else if (pCbMsg->codingScheme == SMS_CHARSET_UCS2)
+ convertedTextSize = textCvt.convertUCS2ToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength);
+
+ return convertedTextSize;
+}
+
void SmsPluginCbMsgHandler::addToPageLiat(SMS_CBMSG_PAGE_S CbPage)
{
CB_PAGE_INFO_S tmpInfo;
}
else
{
- /* Default it to English if pMsgData is NULL */
- pDcs->iso639Lang[0] = 0x45; /* E */
- pDcs->iso639Lang[1] = 0x4E; /* N */
- pDcs->iso639Lang[2] = 0x13; /* CR */
+ /* Default it to English if pMsgData is NULL */
+ pDcs->iso639Lang[0] = 0x45; /* E */
+ pDcs->iso639Lang[1] = 0x4E; /* N */
+ pDcs->iso639Lang[2] = 0x13; /* CR */
}
}
}
#include "MsgDebug.h"
#include "MsgCppTypes.h"
#include "MsgUtilFile.h"
-#include "SmsPluginTextConvert.h"
#include "SmsPluginStorage.h"
#include "SmsPluginTransport.h"
#include "SmsPluginEventHandler.h"
memcpy(&(msg.originAddress), &(pTpdu->data.deliver.originAddress), sizeof(SMS_ADDRESS_S));
memcpy(&(msg.dcs), &(pTpdu->data.deliver.dcs), sizeof(SMS_DCS_S));
+#if 0
if (msg.totalSeg > MAX_SEGMENT_NUM) {
MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
return;
}
-
+#endif
/** check noneConcatTypeHeader */
noneConcatTypeHeader = false;
memcpy(&(msg.timeStamp.time.absolute), &(pTpdu->data.deliver.timeStamp.time.absolute), sizeof(SMS_TIME_ABS_S));
memcpy(&(msg.originAddress), &(pTpdu->data.deliver.originAddress), sizeof(SMS_ADDRESS_S));
memcpy(&(msg.dcs), &(pTpdu->data.deliver.dcs), sizeof(SMS_DCS_S));
-
+#if 0
if (msg.totalSeg > MAX_SEGMENT_NUM) {
MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
return;
}
+#endif
/** check noneConcatTypeHeader */
noneConcatTypeHeader = false;
/** Convert Data values */
if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
- SMS_LANG_INFO_S langInfo = {0};
+ MSG_LANG_INFO_S langInfo = {0,};
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
pMsgInfo->encodeType = MSG_ENCODE_GSM7BIT;
- pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
+ pMsgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
pMsgInfo->encodeType = MSG_ENCODE_8BIT;
memcpy(tmpBuf, pUserData, DataSize);
pMsgInfo->dataSize = DataSize;
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
pMsgInfo->encodeType = MSG_ENCODE_UCS2;
- pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
+ pMsgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
}
MSG_DEBUG("Data Size [%d]", pMsgInfo->dataSize);
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MsgGconfWrapper.h"
-#include "SmsPluginTextConvert.h"
#include "SmsPluginTransport.h"
#include "SmsPluginSimMsg.h"
#include "SmsPluginStorage.h"
+#include "SmsPluginSetting.h"
#include "SmsPluginConcatHandler.h"
#include "SmsPluginEventHandler.h"
/** initialize msgInfo */
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ /** check unsupported message */
+ if (pTpdu->tpduType == SMS_TPDU_DELIVER) {
+ if (pTpdu->data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && pTpdu->data.deliver.pid == 0x11) {
+ MSG_DEBUG("Unsupported message!!");
+ SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
+ return;
+ }
+ }
+
/** convert to msgInfo */
convertTpduToMsginfo(pTpdu, &msgInfo);
/** Convert Data values */
if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
- SMS_LANG_INFO_S langInfo = {0};
+ MSG_LANG_INFO_S langInfo = {0,};
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
- msgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
+ msgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
- msgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+ msgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
}
}
void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo)
{
+ MSG_BEGIN();
+
/** Convert Type values */
msgInfo->msgType.mainType = MSG_SMS_TYPE;
msgInfo->msgType.subType = convertMsgSubType(pTpdu->pid);
break;
default:
msgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
if (pTpdu->dcs.bMWI) {
msgInfo->msgPort.srcPort = pTpdu->userData.header[i].udh.appPort16bit.originPort;
} else if (pTpdu->userData.header[i].udhType == SMS_UDH_SPECIAL_SMS) {
msgInfo->msgType.subType = (pTpdu->userData.header[i].udh.specialInd.msgInd+MSG_MWI_VOICE_SMS);
+ msgInfo->bStore = pTpdu->userData.header[i].udh.specialInd.bStore;
+
+ if (pTpdu->userData.header[i].udh.specialInd.waitMsgNum > 0) {
+ SmsPluginSetting::instance()->setMwiInfo(msgInfo->msgType.subType, pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ }
if (pTpdu->userData.length == 0) {
- sprintf(msgInfo->msgText,"[MWI Message] Total %d Message is waiting.", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ switch (msgInfo->msgType.subType) {
+ case MSG_MWI_VOICE_SMS :
+ sprintf(msgInfo->msgText, "%d new voice message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ break;
+ case MSG_MWI_FAX_SMS :
+ sprintf(msgInfo->msgText, "%d new fax message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ break;
+ case MSG_MWI_EMAIL_SMS :
+ sprintf(msgInfo->msgText, "%d new email message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ break;
+ default :
+ sprintf(msgInfo->msgText, "%d new special message", pTpdu->userData.header[i].udh.specialInd.waitMsgNum);
+ break;
+ }
msgInfo->dataSize = strlen(msgInfo->msgText);
return;
}
-
} else if (pTpdu->userData.header[i].udhType == SMS_UDH_ALTERNATE_REPLY_ADDRESS) {
strncpy(msgInfo->addressList[0].addressVal, pTpdu->userData.header[i].udh.alternateAddress.address, MAX_ADDRESS_VAL_LEN);
}
/** Convert Data values */
if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) {
- SMS_LANG_INFO_S langInfo = {0};
+ MSG_LANG_INFO_S langInfo = {0,};
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
}
msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
- msgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
+ msgInfo->dataSize = textCvt.convertGSM7bitToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length, &langInfo);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_8BIT) {
msgInfo->encodeType = MSG_ENCODE_8BIT;
memcpy(msgInfo->msgText, pTpdu->userData.data, pTpdu->userData.length);
msgInfo->dataSize = pTpdu->userData.length;
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_UCS2) {
msgInfo->encodeType = MSG_ENCODE_UCS2;
- msgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+ msgInfo->dataSize = textCvt.convertUCS2ToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
} else if (pTpdu->dcs.codingScheme == SMS_CHARSET_EUCKR) {
msgInfo->encodeType = MSG_ENCODE_8BIT;
- msgInfo->dataSize = SmsPluginTextConvert::instance()->convertEUCKRToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
+ msgInfo->dataSize = textCvt.convertEUCKRToUTF8((unsigned char*)msgInfo->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)pTpdu->userData.data, pTpdu->userData.length);
return;
}
+
+ MSG_END();
}
mx.lock();
- ret = cv.timedwait(mx.pMutex(), 10);
+ ret = cv.timedwait(mx.pMutex(), 16);
mx.unlock();
if (*pStatus != MSG_SIM_STATUS_NOT_FOUND)
{
// Get IMSI
- TelSimImsiInfo_t imsiInfo = {0};
+ TelSimImsiInfo_t imsiInfo;
+ memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
tapiRet = tel_get_sim_imsi(pTapiHandle, &imsiInfo);
tapiRet = tel_check_sms_device_status(pTapiHandle, &status);
- if (tapiRet != TAPI_API_SUCCESS)
- {
+ if (tapiRet != TAPI_API_SUCCESS) {
MSG_DEBUG("tel_check_sms_device_status() Error! [%d], Status [%d]", tapiRet, status);
-
return MSG_ERR_PLUGIN_TAPI_FAILED;
}
- if (status == 1)
- {
+ if (status == 1) {
MSG_DEBUG("Device Is Ready");
return MSG_SUCCESS;
- }
- else if (status == 0)
- {
+ } else if (status == 0) {
MSG_DEBUG("Device Is Not Ready.. Waiting For Ready Callback");
- if (SmsPluginEventHandler::instance()->getDeviceStatus() == true)
- {
+ if (SmsPluginEventHandler::instance()->getDeviceStatus() == true) {
MSG_DEBUG("Device Is Ready");
return MSG_SUCCESS;
+ } else {
+ MSG_DEBUG("Device Is Not Ready.");
+ return MSG_ERR_PLUGIN_TAPI_FAILED;
}
}
MSG_DEBUG("Set Status : [%d]", status);
- tapiRet = tel_set_sms_memory_status(pTapiHandle, status, NULL, NULL);
+ tapiRet = tel_set_sms_memory_status(pTapiHandle, status, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
#include <string.h>
#include "MsgDebug.h"
+#include "MsgTextConvert.h"
#include "SmsPluginUDCodec.h"
-#include "SmsPluginTextConvert.h"
#include "SmsPluginParamCodec.h"
int SmsPluginParamCodec::decodeAddress(const unsigned char *pTpdu, SMS_ADDRESS_S *pAddress)
{
int offset = 0, addrLen = 0, bcdLen = 0;
+ MsgTextConvert textCvt;
memset(pAddress->address, 0x00, sizeof(pAddress->address));
addrLen = (int)pTpdu[offset++];
tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), bcdLen, 0, tmpAddress);
- SMS_LANG_INFO_S langInfo = {0};
+ MSG_LANG_INFO_S langInfo = {0,};
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
- SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)pAddress->address, MAX_ADDRESS_LEN, (unsigned char*)tmpAddress, tmplength, &langInfo);
+ textCvt.convertGSM7bitToUTF8((unsigned char*)pAddress->address, MAX_ADDRESS_LEN, (unsigned char*)tmpAddress, tmplength, &langInfo);
}
else if (pAddress->ton == SMS_TON_INTERNATIONAL)
{
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
- int reqId = 0, tapiRet = TAPI_API_SUCCESS;
+ int tapiRet = TAPI_API_SUCCESS;
// Send SMS
- tapiRet = tel_send_sms(pTapiHandle, &pkgInfo, 0, TapiEventSentStatus, &reqId);
+ tapiRet = tel_send_sms(pTapiHandle, &pkgInfo, 0, TapiEventSentStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
// TP-MTI, TP-RD, TP-VPF, TP-RP, TP-UDHI, TP-SRR
// TP-VPF
- SMS_VPF_T vpf = (SMS_VPF_T)(pTpdu[pos++] & 0x18);
+ SMS_VPF_T vpf = (SMS_VPF_T)(pTpdu[pos++] & 0x18) >> 3;
// TP-MR
unsigned char tmpRef = pTpdu[pos];
// TP-UDL
int udl = pTpdu[pos];
-
int retLen = 0;
if (bIsPackingRequired == true)
memcpy(userData.data, &pTpdu[pos+1], udl);
userData.data[udl] = '\0';
-MSG_DEBUG("user data : %s", userData.data);
+MSG_DEBUG("user data : [%s]", userData.data);
int encodeSize = SmsPluginUDCodec::encodeUserData(&userData, dcs.codingScheme, (char*)&pTpdu[pos]);
#include "MsgDebug.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
+#include "MsgSoundPlayer.h"
+
#include "SmsPluginParamCodec.h"
#include "SmsPluginCallback.h"
#include "SmsPluginSetting.h"
#include <TelSms.h>
#include <TapiUtility.h>
#include <ITapiNetText.h>
+ #include <ITapiSim.h>
}
extern struct tapi_handle *pTapiHandle;
for (int index = 0; index < paramCnt; index++)
{
- if (getParam(index, &tmpSmscData) == false)
- {
+ if (getParam(index, &tmpSmscData) == false) {
failCnt++;
continue;
}
}
tmpSmscList.totalCnt = (paramCnt - failCnt);
- tmpSmscList.selected = selectedParam;
+// below is commented to be the first smsc is selected.
+// tmpSmscList.selected = selectedParam;
- if (paramCnt > 0)
- {
+ if (paramCnt > 0) {
err = addSMSCList(&tmpSmscList);
- if (err == MSG_SUCCESS)
- {
+ if (err == MSG_SUCCESS) {
MSG_DEBUG("######## Add SMSC List Success !!! #######");
- }
- else
- {
+ } else {
MSG_DEBUG("######## Add SMSC List Fail !!! return : %d #######", err);
}
}
// Init CB Config
- if (SimStatus == MSG_SIM_STATUS_CHANGED)
- {
+ if (SimStatus == MSG_SIM_STATUS_CHANGED) {
MSG_DEBUG("simStatus == MSG_SIM_STATUS_CHANGED");
MSG_CBMSG_OPT_S cbMsgOpt = {};
- if (getCbConfig(&cbMsgOpt) == true)
- {
+ if (getCbConfig(&cbMsgOpt) == true) {
err = addCbOpt(&cbMsgOpt);
- if (err == MSG_SUCCESS)
- {
+ if (err == MSG_SUCCESS) {
MSG_DEBUG("######## Add CB Option Success !!! #######");
- }
- else
- {
+ } else {
MSG_DEBUG("######## Add CB Option Fail !!! return : %d #######", err);
}
}
- }
- else if (SimStatus == MSG_SIM_STATUS_NORMAL)
- {
+ } else if (SimStatus == MSG_SIM_STATUS_NORMAL) {
MSG_DEBUG("simStatus == MSG_SIM_STATUS_NORMAL");
// Set CB Data into SIM in case of same SIM
setCbConfig(&(cbSetting.option.cbMsgOpt));
}
+ if (SimStatus != MSG_SIM_STATUS_NOT_FOUND)
+ {
+ MSG_VOICEMAIL_OPT_S tmpVoiceMail;
+ memset(&tmpVoiceMail, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
+
+ if (getVoiceMailInfo(&tmpVoiceMail) == true) {
+ MSG_DEBUG("######## getVoiceMailInfo Success !!! #######");
+ } else {
+ MSG_DEBUG("######## getVoiceMailInfo Fail !!! #######", err);
+ }
+
+ if (getMwiInfo() == true) {
+ MSG_DEBUG("######## getMwiInfo Success !!! #######");
+ } else {
+ MSG_DEBUG("######## getMwiInfo Fail !!! #######", err);
+ }
+ }
+
MSG_END();
}
{
case MSG_SMSC_LIST :
setParamList(&pSetting->option.smscList);
- break;
-
+ break;
case MSG_CBMSG_OPT :
setCbConfig(&pSetting->option.cbMsgOpt);
- break;
-
+ break;
+ case MSG_VOICEMAIL_OPT:
+ setVoiceMailInfo(&pSetting->option.voiceMailOpt);
+ break;
default :
THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
- break;
+ break;
}
}
TelSmsParams_t smsParam = {0};
int ret = TAPI_API_SUCCESS;
- int reqId = 0;
for (int index = 0; index < pSMSCList->totalCnt; index++)
{
MSG_DEBUG("Parameter Count [%d]", paramCnt);
int ret = TAPI_API_SUCCESS;
- int reqId = 0;
MSG_SMSC_DATA_S tmpSmscData = {};
int SmsPluginSetting::getParamCount()
{
- int reqId = 0;
-
int ret = TAPI_API_SUCCESS;
ret = tel_get_sms_parameter_count(pTapiHandle, TapiEventGetParamCnt, NULL);
bool SmsPluginSetting::getParam(int Index, MSG_SMSC_DATA_S *pSmscData)
{
- int reqId = 0;
-
int ret = TAPI_API_SUCCESS;
ret = tel_get_sms_parameters(pTapiHandle, Index, TapiEventGetParam, NULL);
return true;
}
+void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+{
+#if 0 // New TAPI
+ int ret = TAPI_API_SUCCESS;
+
+ TelSimMailBoxNumber_t mailboxInfo = {0,};
+
+ for (int i = 0; i < simMailboxList.count; i++) {
+ if (simMailboxList.list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
+ memset(&simMailboxList.list[i].num, 0x00, sizeof(simMailboxList.list[i].num));
+ snprintf(simMailboxList.list[i].num, sizeof(simMailboxList.list[i].num), "%s", pVoiceOpt->mailNumber);
+ MSG_DEBUG("Mailbox number config [%s]", simMailboxList.list[i].num);
+
+ mailboxInfo.b_cphs = simMailboxList.list[i].b_cphs;
+ mailboxInfo.alpha_id_max_len = simMailboxList.list[i].alpha_id_max_len;
+ mailboxInfo.mb_type = (TelSimMailboxType_t)simMailboxList.list[i].mb_type;
+ mailboxInfo.profile_num = simMailboxList.list[i].profile_num;
+ mailboxInfo.rec_index = simMailboxList.list[i].rec_index;
+ mailboxInfo.ton = (TelSimTypeOfNum_t)simMailboxList.list[i].ton;
+ mailboxInfo.npi = (TelSimNumberingPlanIdentity_t)simMailboxList.list[i].npi;
+ snprintf(mailboxInfo.alpha_id, sizeof(mailboxInfo.alpha_id), "%s", simMailboxList.list[i].alpha_id);
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", simMailboxList.list[i].num);
+ mailboxInfo.cc_id = simMailboxList.list[i].cc_id;
+ mailboxInfo.ext1_id = simMailboxList.list[i].ext1_id;
+
+ break;
+ }
+ }
+
+ ret = tel_set_sim_mailbox_info(pTapiHandle, &mailboxInfo, TapiEventSetMailboxInfo, NULL);
+
+ if (ret == TAPI_API_SUCCESS)
+ {
+ MSG_DEBUG("######## tel_set_sim_mailbox_info() Success !!! #######");
+ }
+ else
+ {
+ MSG_DEBUG("######## tel_set_sim_mailbox_info() Fail !!! return : %d #######", ret);
+ }
+
+ return;
+#endif
+}
+
+bool SmsPluginSetting::getVoiceMailInfo(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+{
+#if 0 // New TAPI
+ int ret = TAPI_API_SUCCESS;
+
+ ret = tel_get_sim_mailbox_info(pTapiHandle, TapiEventGetMailboxInfo, NULL);
+
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_get_sim_mailbox_info() Success !!! #######");
+ } else {
+ MSG_DEBUG("######## tel_get_sim_mailbox_info() Fail !!! return : %d #######", ret);
+ return false;
+ }
+
+ if (getMailboxInfoEvent(pVoiceOpt) == true) {
+ MSG_DEBUG("######## Get MWI info was Successful !!! #######");
+ } else {
+ MSG_DEBUG("######## Get MWI info was Failed !!! #######");
+ return false;
+ }
+
+#endif
+ return true;
+}
+
+void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
+{
+#if 0 // New TAPI
+ if (type < MSG_MWI_VOICE_SMS || type > MSG_MWI_OTHER_SMS) {
+ MSG_DEBUG("Invalid parameter");
+ return;
+ }
+
+ int ret = TAPI_API_SUCCESS;
+
+ TelSimMessageWaitingReq_t mwReq = {0,};
+
+ if (simMwiInfo.b_cphs) {
+ if (type == MSG_MWI_VOICE_SMS)
+ simMwiInfo.cphs_mwi.b_voice1 = true;
+ else if (type == MSG_MWI_FAX_SMS)
+ simMwiInfo.cphs_mwi.b_fax = true;
+ else
+ MSG_DEBUG("There is no type [%d] in CPHS.", type);
+
+ mwReq.mw_data_u.cphs_mw.b_voice1 = simMwiInfo.cphs_mwi.b_voice1;
+ mwReq.mw_data_u.cphs_mw.b_voice2 = simMwiInfo.cphs_mwi.b_voice2;
+ mwReq.mw_data_u.cphs_mw.b_fax = simMwiInfo.cphs_mwi.b_fax;
+ mwReq.mw_data_u.cphs_mw.b_data = simMwiInfo.cphs_mwi.b_data;
+ } else {
+ if (type == MSG_MWI_VOICE_SMS)
+ simMwiInfo.mwi_list.mw_info[0].voice_count = count;
+ else if (type == MSG_MWI_FAX_SMS)
+ simMwiInfo.mwi_list.mw_info[0].fax_count = count;
+ else if (type == MSG_MWI_EMAIL_SMS)
+ simMwiInfo.mwi_list.mw_info[0].email_count = count;
+ else if (type == MSG_MWI_OTHER_SMS)
+ simMwiInfo.mwi_list.mw_info[0].other_count = count;
+ else
+ MSG_DEBUG("No match type [%d]", type);
+
+ mwReq.mw_data_u.mw.rec_index = simMwiInfo.mwi_list.mw_info[0].rec_index;
+ mwReq.mw_data_u.mw.indicator_status = simMwiInfo.mwi_list.mw_info[0].indicator_status;
+ mwReq.mw_data_u.mw.voice_count = simMwiInfo.mwi_list.mw_info[0].voice_count;
+ mwReq.mw_data_u.mw.fax_count = simMwiInfo.mwi_list.mw_info[0].fax_count;
+ mwReq.mw_data_u.mw.email_count = simMwiInfo.mwi_list.mw_info[0].email_count;
+ mwReq.mw_data_u.mw.other_count = simMwiInfo.mwi_list.mw_info[0].other_count;
+ mwReq.mw_data_u.mw.video_count = simMwiInfo.mwi_list.mw_info[0].video_count;
+ }
+
+ mwReq.b_cphs = simMwiInfo.b_cphs;
+
+ ret = tel_set_sim_messagewaiting_info(pTapiHandle, &mwReq, TapiEventSetMwiInfo, NULL);
+
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Success !!! #######");
+ } else {
+ MSG_DEBUG("######## tel_set_sim_messagewaiting_info() Fail !!! return : %d #######", ret);
+ }
+
+ return;
+#endif
+}
+
+
+bool SmsPluginSetting::getMwiInfo(void)
+{
+#if 0 // New TAPI
+ int ret = TAPI_API_SUCCESS;
+
+ ret = tel_get_sim_messagewaiting_info(pTapiHandle, TapiEventGetMwiInfo, NULL);
+
+ if (ret == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_get_sim_messagewaiting_info() Success !!! #######");
+ } else {
+ MSG_DEBUG("######## tel_get_sim_messagewaiting_info() Fail !!! return : %d #######", ret);
+ return false;
+ }
+
+ if (getResultFromSim() == true) {
+ MSG_DEBUG("######## Get Mainbox info was Successful !!! #######");
+ } else {
+ MSG_DEBUG("######## Get Mainbox info was Failed !!! #######");
+ return false;
+ }
+#endif
+ return true;
+}
void SmsPluginSetting::setParamCntEvent(int ParamCnt)
{
}
+void SmsPluginSetting::setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pMailboxList, bool bSuccess)
+{
+ mx.lock();
+
+ bTapiResult = bSuccess;
+
+ memset(&simMailboxList, 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+
+ if (bTapiResult == true)
+ {
+ int i = 0;
+
+ if (pMailboxList && pMailboxList->count > 0) {
+ memcpy(&simMailboxList, pMailboxList, sizeof(SMS_SIM_MAILBOX_LIST_S));
+
+ /* Temp :: Save voicemail number with VOICE1 line number */
+ for (i = 0; i < pMailboxList->count ; i++) {
+ MSG_DEBUG("Mailbox list[%d] type=[%d] address = [%s]", i, pMailboxList->list[i].mb_type, pMailboxList->list[i].num);
+ if (pMailboxList->list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
+ MsgSettingSetString(VOICEMAIL_NUMBER, pMailboxList->list[i].num);
+ break;
+ }
+ }
+ }
+ }
+
+ cv.signal();
+
+ mx.unlock();
+}
+
+bool SmsPluginSetting::getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt)
+{
+ int ret = 0;
+
+ bTapiResult = false;
+
+ mx.lock();
+
+ ret = cv.timedwait(mx.pMutex(), 10);
+
+ mx.unlock();
+
+ if (ret == ETIMEDOUT)
+ {
+ MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
+ return false;
+ }
+
+ memset(pVoiceOpt, 0x00, sizeof(MSG_VOICEMAIL_OPT_S));
+
+ if (bTapiResult == true)
+ {
+ for(int i = 0; i < simMailboxList.count; i++) {
+ if (simMailboxList.list[i].mb_type == MSG_SIM_MAILBOX_VOICE) {
+ snprintf(pVoiceOpt->mailNumber, sizeof(pVoiceOpt->mailNumber), "%s", simMailboxList.list[i].num);
+ break;
+ }
+ }
+ }
+
+ return bTapiResult;
+}
+
+void SmsPluginSetting::setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess)
+{
+ mx.lock();
+
+ bTapiResult = bSuccess;
+
+ memset(&simMwiInfo, 0x00, sizeof(SMS_SIM_MWI_INFO_S));
+
+ if (bTapiResult == true)
+ {
+ int mwi_cnt = 0;
+ int index = 0;
+
+ memcpy(&simMwiInfo, pMwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
+
+ /* Save MW count with VOICE line number */
+ for(int i = 0; i < simMailboxList.count; i++) {
+
+ if (simMailboxList.list[i].mb_type == MSG_SIM_MAILBOX_VOICE) {
+
+ index = simMailboxList.list[i].profile_num - 1;
+ if (index < 0) {
+ MSG_DEBUG("SIM profile number is invalid.");
+ break;
+ }
+
+ MSG_DEBUG("SIM MWI profile number=[%d], index=[%d]", simMailboxList.list[i].profile_num, index);
+
+ if (simMwiInfo.b_cphs == false) { // Normal case
+ mwi_cnt = simMwiInfo.mwi_list.mw_info[index].voice_count;
+ } else { // CPHS case
+ /* For CPHS case, mwi_cnt value is boolean */
+ mwi_cnt = simMwiInfo.cphs_mwi.b_voice1;
+ }
+
+ MsgSettingSetInt(VOICEMAIL_COUNT, mwi_cnt);
+
+ if (mwi_cnt > 0) {
+ MSG_MESSAGE_INFO_S msgInfo = {0,};
+
+ msgInfo.displayTime = time(NULL);
+ snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), \
+ "%s", simMailboxList.list[i].num);
+ memset(msgInfo.addressList[0].displayName, 0x00, sizeof(msgInfo.addressList[0].displayName));
+ msgInfo.msgType.mainType = MSG_SMS_TYPE;
+ msgInfo.msgType.subType = MSG_MWI_VOICE_SMS;
+
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new voice message", mwi_cnt);
+
+ MsgSoundPlayStart();
+ MsgInsertNoti(&msgInfo);
+ }
+ break;
+ }
+ }
+ }
+
+ cv.signal();
+
+ mx.unlock();
+}
+
void SmsPluginSetting::setResultFromSim(bool bResult)
{
mx.lock();
int ret = TAPI_API_SUCCESS;
- ret = tel_set_sms_message_status(pTapiHandle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, NULL, NULL);
+ ret = tel_set_sms_message_status(pTapiHandle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, TapiEventSetMsgStatus, (void *)&SimMsgId);
if (ret == TAPI_API_SUCCESS)
{
if (bResult == true)
{
- MSG_DEBUG("######## Setting Read Status was Successful !!! #######");
+ MSG_DEBUG("######## Setting Read Status was Successful !!!, sim id=[%d] #######", SimId);
}
else
{
void SmsPluginSimMsg::getSimMsgCount(MSG_SIM_COUNT_S *pSimMsgCnt)
{
- int reqId = 0;
-
int ret = TAPI_API_SUCCESS;
ret = tel_get_sms_count(pTapiHandle, TapiEventGetSimMsgCnt, NULL);
bool SmsPluginSimMsg::getSimMsg(msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgInfo)
{
- int reqId = 0;
-
int ret = TAPI_API_SUCCESS;
ret = tel_read_sms_in_sim(pTapiHandle, SimMsgId, TapiEventGetSimMsg, NULL);
/** Add Message */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, '', '', ?, %d, 0, %d, 0, 0);",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, '', '', ?, 0, 0, 0);",
MSGFW_MESSAGE_TABLE_NAME, msgId, convId, pSimMsgInfo->folderId, pSimMsgInfo->storageId,
pSimMsgInfo->msgType.mainType, pSimMsgInfo->msgType.subType, pSimMsgInfo->displayTime, pSimMsgInfo->dataSize,
pSimMsgInfo->networkStatus, pSimMsgInfo->bRead, pSimMsgInfo->bProtected, pSimMsgInfo->priority,
- pSimMsgInfo->direction, 0, pSimMsgInfo->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+ pSimMsgInfo->direction, 0, pSimMsgInfo->bBackup);
MSG_DEBUG("QUERY : %s", sqlQuery);
MSG_DEBUG("Add Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
err = addReplaceTypeMsg(pMsgInfo);
} else if ((pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS) && (pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS)) {
- MSG_DEBUG("Add MWI Message");
- err = addSmsMessage(pMsgInfo);
+ if (pMsgInfo->bStore == true) {
+ MSG_DEBUG("Add MWI Message");
+ err = addSmsMessage(pMsgInfo);
+ }
} else if ((pMsgInfo->msgType.subType == MSG_WAP_SI_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_CO_SMS)) {
MSG_DEBUG("Add WAP Push Message");
switch (pMsgInfo->msgType.subType)
unsigned int rowId = 0;
msg_thread_id_t convId = 0;
- char sqlQuery[MAX_QUERY_LEN+1];
-
dbHandle.beginTrans();
if (pMsgInfo->nAddressCnt > 0) {
/** Update Message */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ADDRESS_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \
DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \
BACKUP = %d, SUBJECT = ?, MSG_DATA = ?, THUMB_PATH = ?, MSG_TEXT = ? WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize,
{
MSG_BEGIN();
- msg_error_t err = MSG_SUCCESS;
-
char sqlQuery[MAX_QUERY_LEN+1];
/** Get SUB_TYPE, STORAGE_ID */
/** Find Replace Type Msg : Same Replace Type, Same Origin Address */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*), MSG_ID FROM %s WHERE SUB_TYPE = %d AND B.CONV_ID = %d;",
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*), MSG_ID FROM %s WHERE SUB_TYPE = %d AND CONV_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, pMsgInfo->msgType.subType, convId);
if (dbHandle.prepareQuery(sqlQuery) != MSG_SUCCESS)
}
/** Update New Replace Type Msg */
- if (retCnt == 1) {
- MSG_DEBUG("Update Replace Type Msg");
- err = updateSmsMessage(pMsgInfo);
- } else if (retCnt == 0) { /** Insert New Replace Type Msg */
+ if (retCnt == 0) { /** Insert New Replace Type Msg */
MSG_DEBUG("Insert Replace Type Msg");
err = addSmsMessage(pMsgInfo);
+ } else {
+ MSG_DEBUG("Update Replace Type Msg");
+ err = updateSmsMessage(pMsgInfo);
}
return err;
if (bProceed == false)
return MSG_ERR_INVALID_MESSAGE;
+#if 0
/** update subject */
int len = strlen(pushMsg.contents);
} else {
strncpy(pMsgInfo->subject, pushMsg.contents, MAX_SUBJECT_LEN);
}
+#endif
/** Update Msg Text - remove */
strncpy(pMsgInfo->msgText, pushMsg.href, MAX_MSG_TEXT_LEN);
+
+ if (pushMsg.contents[0] != '\0') {
+ strncat(pMsgInfo->msgText, " ", MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText));
+ strncat(pMsgInfo->msgText, pushMsg.contents, MAX_MSG_TEXT_LEN - strlen(pMsgInfo->msgText));
+ }
+
pMsgInfo->dataSize = strlen(pMsgInfo->msgText);
pMsgInfo->bTextSms = true;
dbHandle.endTrans(false);
return err;
}
+
+ pMsgInfo->threadId = convId;
}
/** get last row count for Message id */
msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
{
msg_error_t err = MSG_SUCCESS;
- if(index > pushAppInfoList.size() - 1)
+ if((unsigned int)index > pushAppInfoList.size() - 1)
return MSG_ERR_INVALID_PARAMETER;
std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
#include "MsgCppTypes.h"
#include "MsgException.h"
#include "MsgGconfWrapper.h"
+#include "MsgNotificationWrapper.h"
#include "MsgUtilFile.h"
-#include "SmsPluginTextConvert.h"
#include "SmsPluginParamCodec.h"
#include "SmsPluginTpduCodec.h"
#include "SmsPluginEventHandler.h"
else
{
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+
THROW(MsgException::SMS_PLG_ERROR, "######## TelTapiSmsSend Fail !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
}
}
else
{
+ MsgInsertTicker("Sending SMS is failed", NULL);
+
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+
THROW(MsgException::SMS_PLG_ERROR, "######## Msg Sent was Failed !!! req Id : [%d] return : [%d] #######", reqId, retStatus);
}
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, NULL, NULL);
+ tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
}
else
{
- MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
+ MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
}
}
else if (err == MSG_ERR_SIM_STORAGE_FULL)
tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
response = TAPI_NETTEXT_SIM_FULL;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, NULL, NULL);
+ tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
}
else
{
- MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
+ MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
}
}
else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
response = TAPI_NETTEXT_ME_FULL;
- tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, NULL, NULL);
+ tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
{
}
else
{
- MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
+ MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! req Id : [%d] return : [%d] #######", reqId, tapiRet);
}
}
else
msg_encode_type_t encodeType = MSG_ENCODE_GSM7BIT;
- SMS_LANGUAGE_ID_T langId = SMS_LANG_ID_RESERVED;
+ MSG_LANGUAGE_ID_T langId = MSG_LANG_ID_RESERVED;
// User Data
if (pMsgInfo->bTextSms == true)
{
if (*pCharType == SMS_CHARSET_7BIT)
{
- decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &langId);
+ decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &langId);
}
else if (*pCharType == SMS_CHARSET_8BIT)
{
}
else if (*pCharType == SMS_CHARSET_UCS2)
{
- decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize);
+ decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize);
}
else if (*pCharType == SMS_CHARSET_AUTO)
{
- decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &encodeType);
+ decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, pMsgInfo->dataSize, &encodeType);
*pCharType = encodeType;
}
}
if (*pCharType == SMS_CHARSET_7BIT)
{
- decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId);
+ decodeLen = textCvt.convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId);
}
else if (*pCharType == SMS_CHARSET_8BIT)
{
}
else if (*pCharType == SMS_CHARSET_UCS2)
{
- decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
+ decodeLen = textCvt.convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
}
else if (*pCharType == SMS_CHARSET_AUTO)
{
- decodeLen = SmsPluginTextConvert::instance()->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
+ decodeLen = textCvt.convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
*pCharType = encodeType;
}
}
// Set User Data Header for National Language Single Shift
- if (*pCharType == SMS_CHARSET_7BIT && langId != SMS_LANG_ID_RESERVED)
+ if (*pCharType == SMS_CHARSET_7BIT && langId != MSG_LANG_ID_RESERVED)
{
pData->userData[i].header[headerCnt].udhType = SMS_UDH_SINGLE_SHIFT;
pData->userData[i].header[headerCnt].udh.singleShift.langId = langId;
}
-int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, SMS_LANGUAGE_ID_T LangId, int ReplyAddrLen)
+int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, MSG_LANGUAGE_ID_T LangId, int ReplyAddrLen)
{
int headerLen = 1, concat = 5, port = 6, lang = 3, reply = 2;
int headerSize = 0, segSize = 0, maxSize = 0;
headerSize += port;
}
- if (LangId != SMS_LANG_ID_RESERVED)
+ if (LangId != MSG_LANG_ID_RESERVED)
{
MSG_DEBUG("National Language Exists");
headerSize += lang;
if (CodingScheme == SMS_CHARSET_7BIT)
{
- if (((DataLen+headerSize)/maxSize) >= 1)
+ if (((DataLen+headerSize)/maxSize) > 1)
segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
else
segSize = DataLen;
}
else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
{
- if (((DataLen+headerSize)/maxSize) >= 1)
+ if (((DataLen+headerSize)/maxSize) > 1)
segSize = 140 - (headerLen + concat + headerSize);
else
segSize = DataLen;
/** Convert Type values */
msgInfo.msgType.mainType = MSG_MMS_TYPE;
msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS;
-
+ msgInfo.storageId = MSG_STORAGE_PHONE;
msgInfo.dataSize = PushBodyLen;
if (msgInfo.dataSize > MAX_MSG_TEXT_LEN) {
int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
for(int i = 0; i < count ; ++i)
{
- if(integerValue == wspHeaderApplId[i].parameterCode)
+ if((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
{
snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-strlen(temper)-1);
/*==================================================================================================
FUNCTION PROTOTYPES
==================================================================================================*/
-void TapiEventDeviceReady(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void TapiEventDeliveryReportCNF(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventSetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *user_data);
+
+void TapiEventSetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_data);
+
void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *user_data);
-void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
+void TapiEventSatSendSms(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSatMoSmsCtrl(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSimFileInfo(TapiHandle *handle, int result, void *data, void *user_data);
void TapiEventSimReadFile(TapiHandle *handle, int result, void *data, void *user_data);
+void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data);
+
+void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data);
+
/*==================================================================================================
CLASS DEFINITIONS
using namespace std;
+#include "MsgTextConvert.h"
#include "SmsPluginTypes.h"
extern "C"
void getDisplayName(unsigned short MsgId, char *pDisplayName);
vector<CB_PAGE_INFO_S> pageList;
+
+ MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_CBMSG_HANDLER_H
using namespace std;
+#include "MsgTextConvert.h"
#include "SmsPluginTypes.h"
void removeFromConcatList(unsigned short MsgRef);
vector<SMS_CONCAT_INFO_S> concatList;
+
+ MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_CONCAT_HANDLER_H
INCLUDE FILES
==================================================================================================*/
#include "MsgMutex.h"
+#include "MsgTextConvert.h"
#include "MsgPluginInterface.h"
#include "SmsPluginTypes.h"
Mutex mx;
CndVar cv;
+
+ MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_EVENT_HANDLER_H
void setParamCntEvent(int ParamCnt);
void setParamEvent(const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
void setCbConfigEvent(const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
+ void setMailboxInfoEvent(SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess);
+ void setMwiInfo(MSG_SUB_TYPE_T type, int count);
+ void setMwiInfoEvent(SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
void setResultFromSim(bool bResult);
private:
bool setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt);
bool getCbConfig(MSG_CBMSG_OPT_S *pCbOpt);
+ void setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+ bool getVoiceMailInfo(MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+ bool getMwiInfo(void);
+
int getParamCntEvent();
bool getParamEvent(MSG_SMSC_DATA_S *pSmscData);
bool getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt);
+
+ bool getMailboxInfoEvent(MSG_VOICEMAIL_OPT_S *pVoiceOpt);
+
bool getResultFromSim();
SMS_PID_T convertPid(MSG_SMS_PID_T pid);
MSG_SMSC_DATA_S smscData;
MSG_CBMSG_OPT_S cbOpt;
+ /* Message Waiting Indicator */
+ SMS_SIM_MAILBOX_LIST_S simMailboxList;
+ SMS_SIM_MWI_INFO_S simMwiInfo;
+
bool bTapiResult;
int paramCnt;
int selectedParam;
INCLUDE FILES
==================================================================================================*/
#include "MsgMutex.h"
+#include "MsgTextConvert.h"
#include "MsgTransportTypes.h"
#include "MsgSettingTypes.h"
#include "SmsPluginTypes.h"
SmsPluginTransport();
~SmsPluginTransport();
- int getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, SMS_LANGUAGE_ID_T LangId, int ReplyAddrLen);
+ int getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int DataLen, bool bPortNum, MSG_LANGUAGE_ID_T LangId, int ReplyAddrLen);
SMS_PID_T convertPid(MSG_SMS_PID_T pid);
static SmsPluginTransport* pInstance;
Mutex mx;
CndVar cv;
+
+ MsgTextConvert textCvt;
};
#endif //SMS_PLUGIN_TRANSPORT_H
/*==================================================================================================
INCLUDE FILES
==================================================================================================*/
+#include "MsgTextConvert.h"
#include "MsgInternalTypes.h"
#include "MsgStorageTypes.h"
#include "MsgSettingTypes.h"
#define MAX_CBMSG_PAGE_SIZE 93
#define MAX_ETWS_SIZE 56
#define MAX_CBMSG_PAGE_NUM 15
-#define MAX_SIM_SMS_NUM 90
+#define MAX_SIM_SMS_NUM 255
+#define MAX_SIM_XDN_ALPHA_ID_LEN 30
+#define MAX_SIM_MSP_CNT 2
#define SMS_PUSH_XML_HREF_TAG "href"
#define SMS_PUSH_XML_SI_ID_TAG "si-id"
typedef unsigned short SMS_SIM_EFILE_NAME_T;
-typedef unsigned char SMS_LANGUAGE_ID_T;
typedef unsigned char SMS_ETWS_NETWORK_TYPE_T;
+/**
+\brief Represents SIM mailbox type. See enum _SMS_SIM_MAILBOX_TYPE_E
+*/
+typedef unsigned char SMS_SIM_MAILBOX_TYPE_T;
/*==================================================================================================
ENUMS
};
-enum _SMS_LANGUAGE_ID_E
-{
- SMS_LANG_ID_RESERVED = 0,
- SMS_LANG_ID_TURKISH,
- SMS_LANG_ID_SPANISH,
- SMS_LANG_ID_PORTUGUESE,
- SMS_LANG_ID_BENGALI,
- SMS_LANG_ID_GUJARATI,
- SMS_LANG_ID_HINDI,
- SMS_LANG_ID_KANNADA,
- SMS_LANG_ID_MALAYALAM,
- SMS_LANG_ID_ORIYA,
- SMS_LANG_ID_PUNJABI,
- SMS_LANG_ID_TAMIL,
- SMS_LANG_ID_TELUGU,
- SMS_LANG_ID_URDU,
+enum _SMS_SIM_MAILBOX_TYPE_E {
+ MSG_SIM_MAILBOX_VOICE = 0x01,
+ MSG_SIM_MAILBOX_VOICE2 = 0x02,
+ MSG_SIM_MAILBOX_FAX = 0x03,
+ MSG_SIM_MAILBOX_DATA = 0x04,
+ MSG_SIM_MAILBOX_EMAIL = 0x05,
+ MSG_SIM_MAILBOX_OTHER = 0x06,
};
} SMS_SPECIAL_INDICATION_S;
-typedef struct _SMS_SINGLE_SHIFT_S
-{
- SMS_LANGUAGE_ID_T langId;
-} SMS_SINGLE_SHIFT_S;
-
-
-typedef struct _SMS_LOCKING_SHIFT_S
-{
- SMS_LANGUAGE_ID_T langId;
-} SMS_LOCKING_SHIFT_S;
-
-
typedef struct _SMS_UDH_S
{
SMS_UDH_TYPE_T udhType;
SMS_APP_PORT_8BIT_S appPort8bit;
SMS_APP_PORT_16BIT_S appPort16bit;
SMS_SPECIAL_INDICATION_S specialInd;
- SMS_SINGLE_SHIFT_S singleShift;
- SMS_LOCKING_SHIFT_S lockingShift;
+ MSG_SINGLE_SHIFT_S singleShift;
+ MSG_LOCKING_SHIFT_S lockingShift;
SMS_ADDRESS_S alternateAddress;
} udh;
} SMS_UDH_S;
unsigned char warningSecurityInfo[MAX_ETWS_SIZE-6];
}SMS_ETWS_PRIMARY_S;
-typedef struct _SMS_LANG_INFO_S
-{
- bool bSingleShift;
- bool bLockingShift;
-
- SMS_LANGUAGE_ID_T singleLang;
- SMS_LANGUAGE_ID_T lockingLang;
-} SMS_LANG_INFO_S;
-
typedef struct _SMS_WSP_CONTENTS_TYPE_S
{
typedef struct _SMS_WSP_HEADER_PARAMETER_S
{
char* parameterToken;
- unsigned char parameterCode;
+ unsigned int parameterCode;
} SMS_WSP_HEADER_PARAMETER_S;
char msgData[(MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM)+1]; /**< user data */
} SMS_CONCAT_SIM_MSG_S;
+
+/**
+ * @brief Represents Sim Mailbox information
+ */
+typedef struct {
+ int b_cphs;
+ int rec_index; /**< index which stands for the location where record is saved in SIM*/
+ int profile_num; /**< SIM profile index*/
+ SMS_SIM_MAILBOX_TYPE_T mb_type;
+ int alpha_id_max_len; /**< alpha max length in SIM - READ ONLY*/
+ char alpha_id[MAX_SIM_XDN_ALPHA_ID_LEN + 1]; /**< Alpha Identifier */
+ MSG_SMS_TON_T ton; /**< Type Of Number */
+ MSG_SMS_NPI_T npi; /**< Number Plan Identity */
+ char num[MAX_PHONE_NUMBER_LEN + 1]; /**< Dialing Number/SSC String */
+ unsigned char cc_id; /**< Capability/Configuration Identifier */
+ unsigned char ext1_id; /**< Extensiion1 Record Identifier */
+} SMS_SIM_MAILBOX_INFO_S;
+
+
+/**
+ * @brief Represents Sim Mailbox list
+ */
+typedef struct {
+ int count;
+ SMS_SIM_MAILBOX_INFO_S list[MAX_SIM_MSP_CNT*5]; //max is 10
+} SMS_SIM_MAILBOX_LIST_S;
+
+
+/**
+ * @brief Represents Message Waiting Indication
+ */
+typedef struct {
+ int rec_index;
+ unsigned char indicator_status; /**< Indicator Type*/
+ int voice_count; /**< VoiceMail Count*/
+ int fax_count; /**< FAX Count*/
+ int email_count; /**< Email Count*/
+ int other_count; /**< Other Count*/
+ int video_count; /**< VideoMail Count*/
+} SMS_SIM_MWI_NORMAL_INFO_S;
+
+
+/**
+ * @brief Represents Message Waiting Indication list
+ */
+typedef struct {
+ int profile_count;
+ SMS_SIM_MWI_NORMAL_INFO_S mw_info[MAX_SIM_MSP_CNT];
+} SMS_SIM_MWI_LIST_S;
+
+
+/**
+ * @brief Represents Message Waiting Indication for CPHS
+ */
+typedef struct {
+ int b_voice1; /**< VoiceMsgLine1 message waiting flag */
+ int b_voice2; /**< VoiceMsgLine2 message waiting flag */
+ int b_fax; /**< FAX message waiting flag */
+ int b_data; /**< Data message waiting flag */
+} SMS_SIM_MWI_CPHS_INFO_S;
+
+
+/**
+ * @brief Represents Message Waiting Indication Information
+ */
+typedef struct {
+ int b_cphs;
+ SMS_SIM_MWI_LIST_S mwi_list;
+ SMS_SIM_MWI_CPHS_INFO_S cphs_mwi;
+} SMS_SIM_MWI_INFO_S;
+
#endif //SMS_PLUGIN_TYPES_H
void MsgHandle::read(char **ppEvent)
{
- int dataSize = 0;
+ unsigned int dataSize = 0;
dataSize = mClientSock.read(ppEvent, &dataSize);
return ret;
}
+msg_error_t MsgHandle::setFilterActivation(msg_filter_id_t filter_id, bool active)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_filter_id_t) + sizeof(bool);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_SET_FILTER_ACTIVATION;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy(pCmd->cmdData, &filter_id, sizeof(msg_filter_id_t));
+ memcpy(pCmd->cmdData+sizeof(msg_filter_id_t), &active, sizeof(bool));
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_SET_FILTER_ACTIVATION)
+ {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
}
+msg_error_t MsgHandle::deleteMessagesByList(msg_id_list_s *pMsgIdList)
+{
+ // Allocate Memory to Command Data
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + (sizeof(int)*pMsgIdList->nCount);
+
+ char cmdBuf[cmdSize];
+ bzero(cmdBuf, cmdSize);
+ MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf;
+
+ // Set Command Parameters
+ pCmd->cmdType = MSG_CMD_DELETE_MESSAGE_BY_LIST;
+
+ // Copy Cookie
+ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN);
+
+ // Copy Command Data
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &(pMsgIdList->nCount), sizeof(int));
+ for (int i=0; i<pMsgIdList->nCount; i++) {
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+(sizeof(int)*i)), &(pMsgIdList->msgIdList[i]), sizeof(int));
+ }
+
+ // Send Command to Messaging FW
+ char* pEventData = NULL;
+ AutoPtr<char> eventBuf(&pEventData);
+
+
+ write((char*)pCmd, cmdSize, &pEventData);
+
+ // Get Return Data
+ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)pEventData;
+
+ if (pEvent->eventType != MSG_EVENT_DELETE_MESSAGE_BY_LIST) {
+ THROW(MsgException::INVALID_RESULT, "Event Data Error");
+ }
+
+ return pEvent->result;
+}
+
+
msg_error_t MsgHandle::moveMessageToFolder(msg_message_id_t MsgId, msg_folder_id_t DestFolderId)
{
// Allocate Memory to Command Data
return err;
}
+msg_error_t MsgHandle::getConversationViewItem(msg_message_id_t MsgId, MSG_CONVERSATION_VIEW_S *pConv)
+{
+ MSG_BEGIN();
+
+ msg_error_t err = MSG_SUCCESS;
+
+ MsgStoConnectDB();
+ err = MsgStoGetConversationViewItem(MsgId, pConv);
+ MsgStoDisconnectDB();
+
+ return err;
+}
msg_error_t MsgHandle::getConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList)
{
}
-msg_error_t MsgHandle::deleteThreadMessageList(msg_thread_id_t ThreadId)
+msg_error_t MsgHandle::deleteThreadMessageList(msg_thread_id_t ThreadId, bool include_protected_msg)
{
// Allocate Memory to Command Data
- int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_THREAD_LIST_INDEX_S);
+ int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_thread_id_t) + sizeof(bool);
char cmdBuf[cmdSize];
bzero(cmdBuf, cmdSize);
// Copy Command Data
memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &ThreadId, sizeof(msg_thread_id_t));
+ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_thread_id_t)), &include_protected_msg, sizeof(bool));
// Send Command to Messaging FW
char* pEventData = NULL;
return pEvent->result;
}
-
-msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, MSG_REPORT_STATUS_INFO_S *pReport_status)
+msg_error_t MsgHandle::getReportStatus(msg_message_id_t msg_id, msg_struct_list_s *report_list)
{
// Allocate Memory to Command Data
int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_message_id_t);
if(pEvent->result != MSG_SUCCESS) return pEvent->result;
// Decode Return Data
- MsgDecodeReportStatus(pEvent->data, pReport_status);
+ MsgDecodeReportStatus(pEvent->data, report_list);
return MSG_SUCCESS;
}
}
char* buf = NULL;
- int len;
+ unsigned int len;
int n = MsgProxyListener::instance()->readFromSocket(&buf, &len);
}
-int MsgProxyListener::readFromSocket(char** buf, int* len)
+int MsgProxyListener::readFromSocket(char** buf, unsigned int* len)
{
return cliSock.read(buf, len);
}
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
return bUnknownAutoReject;
}
+void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
+{
+ if (vconf_notify_key_changed(pKey, pCb, NULL) < 0) {
+ MSG_DEBUG("Fail to regist vconf CB with [%s]", pKey);
+ } else {
+ MSG_DEBUG("Success to regist vconf CB with [%s]", pKey);
+ }
+}
+
+void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
+{
+ if (vconf_ignore_key_changed(pKey, pCb) < 0) {
+ MSG_DEBUG("Fail to remove vconf CB with [%s]", pKey);
+ } else {
+ MSG_DEBUG("Success to remove vconf CB with [%s]", pKey);
+ }
+}
+
void MsgSettingRegVconfCB()
{
MsgSettingGetBool(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, &bAutoReject);
MsgSettingGetBool(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, &bUnknownAutoReject);
- if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB, NULL) < 0) {
- MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL);
- }
-
- if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB, NULL) < 0) {
- MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL);
- }
+ MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB);
+ MsgSettingRegVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
}
void MsgSettingRemoveVconfCB()
{
- if (vconf_ignore_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB) < 0) {
- MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL);
- }
-
- if (vconf_ignore_key_changed(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB) < 0) {
- MSG_DEBUG("Fail to regist vconf CB with [%s]", VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL);
- }
-}
+ MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_BOOL, MsgVconfCB);
+ MsgSettingRemoveVconfCBCommon(VCONFKEY_CISSAPPL_AUTO_REJECT_UNKNOWN_BOOL, MsgVconfCB);
-void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb)
-{
- if (vconf_notify_key_changed(pKey, pCb, NULL) < 0) {
- MSG_DEBUG("Fail to regist vconf CB with [%s]", pKey);
- } else {
- MSG_DEBUG("Success to regist vconf CB with [%s]", pKey);
- }
}
/* read remote fd for reg func */
char *rfd = NULL;
AutoPtr<char> wrap(&rfd);
- int rlen;
+ unsigned int rlen;
read(&rfd, &rlen);
maxfd = fd;
}
-int MsgIpcClientSocket::writen (const char *buf, int len)
+int MsgIpcClientSocket::writen (const char *buf, unsigned int len)
{
- int nleft, nwrite;
+ unsigned int nleft;
+ int nwrite;
nleft = len;
while (nleft > 0) {
if (nwrite < 0) {
MSG_FATAL("writen: sockfd [%d] error [%s]", sockfd, strerror(errno));
return nwrite;
- }
- else if (nwrite == 0)
+ } else if (nwrite == 0) {
break;
+ }
nleft -= nwrite;
buf += nwrite;
return (len-nleft);
}
-int MsgIpcClientSocket::write(const char* buf, int len)
+int MsgIpcClientSocket::write(const char* buf, unsigned int len)
{
if (sockfd < 0) {
MSG_FATAL("sockfd is not opened [%d]", sockfd);
return CUSTOM_SOCKET_ERROR;
}
- if (!buf || len <= 0) {
+ if (!buf || len == 0) {
MSG_FATAL("buf[%p] and len[%d] MUST NOT NULL", buf, len);
return CUSTOM_SOCKET_ERROR;
}
/* send the data in subsequence */
n = writen(buf, len);
- if (n != len) {
+ if ((unsigned int)n != len) {
MSG_FATAL("WARNING: write data_size[%d] not matched [%d]", n, len);
return CUSTOM_SOCKET_ERROR;
}
return len;
}
-int MsgIpcClientSocket::readn( char *buf, int len )
+int MsgIpcClientSocket::readn( char *buf, unsigned int len )
{
- int nleft, nread;
+ unsigned int nleft;
+ int nread;
nleft = len;
while (nleft > 0) {
if (nread < 0) {
MSG_FATAL("WARNING read value %d: %s", nread, strerror(errno));
return nread;
- }
- else if( nread == 0 )
+ } else if( nread == 0 ) {
break;
+ }
nleft -= nread;
buf += nread;
}
+
return (len-nleft);
}
/* what if the buf is shorter than data? */
-int MsgIpcClientSocket::read(char** buf, int* len)
+int MsgIpcClientSocket::read(char** buf, unsigned int* len)
{
if (sockfd < 0) {
MSG_FATAL("socket is not opened [%d]", sockfd);
if (n == CLOSE_CONNECTION_BY_SIGNAL) { /* if msgfw gets down, it signals to all IPC clients */
MSG_FATAL("sockfd [%d] CLOSE_CONNECTION_BY_SIGNAL", sockfd);
return n;
- }
-
- else if (n != sizeof(int)) {
+ } else if (n != sizeof(int)) {
MSG_FATAL("WARNING: read header_size[%d] not matched [%d]", n, sizeof(int));
return CUSTOM_SOCKET_ERROR;
}
/* read the data in subsequence */
- if ((*len) > 0) {
- unsigned int ulen = (unsigned int)*len;
- *buf = new char[ulen+1];
- bzero(*buf, ulen+1);
- n = readn(*buf, ulen);
+ unsigned int ulen = (unsigned int)*len;
+ *buf = new char[ulen+1];
+ bzero(*buf, ulen+1);
+ n = readn(*buf, ulen);
- if (n != ulen) {
- MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, ulen);
- return CUSTOM_SOCKET_ERROR;
- }
+ if ((unsigned int)n != ulen) {
+ MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, ulen);
+ return CUSTOM_SOCKET_ERROR;
}
return n;
MSG_END();
}
-int MsgIpcServerSocket::readn( int fd, char *buf, int len )
+int MsgIpcServerSocket::readn( int fd, char *buf, unsigned int len )
{
- int nleft, nread;
+ unsigned int nleft, nread;
nleft = len;
while (nleft > 0) {
if (*len == CLOSE_CONNECTION_BY_USER)
return *len;
- if ((*len) > 0) {
- /* read the data in subsequence */
+ /* read the data in subsequence */
+ if (*len > 0) {
unsigned int ulen = (unsigned int)*len;
*buf = new char[ulen+1];
bzero(*buf, ulen+1);
n = readn(fd, *buf, ulen);
- if (n != ulen) {
+ if ((unsigned int)n != ulen) {
MSG_FATAL("WARNING: read data_size [%d] not matched [%d]", n, ulen);
return CUSTOM_SOCKET_ERROR;
}
return n;
}
-int MsgIpcServerSocket::writen(int fd, const char *buf, int len)
+int MsgIpcServerSocket::writen(int fd, const char *buf, unsigned int len)
{
- int nleft, nwrite;
+ unsigned int nleft;
+ int nwrite;
nleft = len;
if (nwrite < 0) {
MSG_FATAL("write: %s", strerror(errno));
return nwrite;
- }
- else if (nwrite == 0) { /* Nothing is send. */
+ } else if (nwrite == 0) { /* Nothing is send. */
break;
- }
- else {
+ } else {
nleft -= nwrite;
buf += nwrite;
}
}
-int MsgIpcServerSocket::write(int fd, const char* buf, int len)
+int MsgIpcServerSocket::write(int fd, const char* buf, unsigned int len)
{
MSG_BEGIN();
MSG_DEBUG("Writing %d bytes", n);
- if (n != len) {
+ if ((unsigned int)n != len) {
MSG_FATAL("Written byte (%d) is not matched to input byte (%d)", n, len);
return CUSTOM_SOCKET_ERROR;
}
char addressVal[MAX_ADDRESS_VAL_LEN+1];
char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
char displayName[MAX_DISPLAY_NAME_LEN+1];
+ char thumbPath[MAX_IMAGE_PATH_LEN+1];
char sqlQuery[MAX_QUERY_LEN+1];
memset(tempId, 0x00, sizeof(tempId));
memset(firstName, 0x00, sizeof(firstName));
memset(lastName, 0x00, sizeof(lastName));
memset(displayName, 0x00, sizeof(displayName));
+ memset(thumbPath, 0x00, sizeof(thumbPath));
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DISPLAY_TIME, A.CONTACT_ID \
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.CONV_ID, A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DISPLAY_TIME, A.CONTACT_ID, A.IMAGE_PATH \
FROM %s A, %s B WHERE B.MSG_ID=%d AND A.CONV_ID=B.CONV_ID;",
MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
msgTime = (time_t)pDbHandle->columnInt(5);
contactId = pDbHandle->columnInt(6);
+
+ strncpy(thumbPath, (char*)pDbHandle->columnText(7), MAX_IMAGE_PATH_LEN);
} else {
pDbHandle->finalizeQuery();
return MSG_ERR_DB_STEP;
memset(&tempId, 0x00, sizeof(tempId));
- snprintf(tempId, 5, "%d", threadId);
- bundle_add(args, "threadId", tempId);
+ bundle_add(args, "type", "msg_id");
+
+ snprintf(tempId, 5, "%d", pMsg->msgId);
+ bundle_add(args, "msgId", tempId);
} else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.classType == MSG_CLASS_0) {
noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
}
- snprintf(tempId, 5, "%d", pMsg->msgId);
- bundle_add(args, "msg_id", tempId);
- } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_MWI_VOICE_SMS) {
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NORMAL_MSG_ICON_PATH);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ }
- noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
+ bundle_add(args, "type", "msg_id");
+
+ snprintf(tempId, 5, "%d", pMsg->msgId);
+ bundle_add(args, "msgId", tempId);
+ } else if (pMsg->msgType.mainType == MSG_SMS_TYPE &&
+ (pMsg->msgType.subType >= MSG_MWI_VOICE_SMS && pMsg->msgType.subType <= MSG_MWI_OTHER_SMS)) {
+
+ noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, NOTIFICATION_PRIV_ID_NONE);
if (noti == NULL) {
MSG_DEBUG("notification_new is failed.");
bundle_free(args);
memset(&tempId, 0x00, sizeof(tempId));
- snprintf(tempId, 5, "%d", threadId);
- bundle_add(args, "threadId", tempId);
+ bundle_add(args, "launch-type", "MO");
+ bundle_add(args, "number", addressVal);
+
} else {
MSG_DEBUG("notification_new pMsg->msgId [%d]", pMsg->msgId);
noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, pMsg->msgId);
memset(&tempId, 0x00, sizeof(tempId));
- snprintf(tempId, 5, "%d", threadId);
- bundle_add(args, "threadId", tempId);
- }
-
- bundle_add(args, "type", "msg_id");
+ bundle_add(args, "type", "msg_id");
- snprintf(tempId, 5, "%d", pMsg->msgId);
- bundle_add(args, "msgId", tempId);
+ snprintf(tempId, 5, "%d", pMsg->msgId);
+ bundle_add(args, "msgId", tempId);
+ }
if (displayName[0] == '\0')
notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
MSG_DEBUG("Fail to notification_set_time : %d", noti_err);
}
+ if (thumbPath[0] != '\0') {
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, thumbPath);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ }
+
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL_FOR_LOCK, thumbPath);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ }
+ }
+
noti_err = notification_insert(noti, NULL);
if (noti_err != NOTIFICATION_ERROR_NONE) {
MSG_DEBUG("Fail to notification_insert");
return MSG_SUCCESS;
}
+msg_error_t MsgInsertNoti(MSG_MESSAGE_INFO_S* pMsg)
+{
+ notification_h noti = NULL;
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+ bundle* args;
+
+ char addressVal[MAX_ADDRESS_VAL_LEN+1];
+ char displayName[MAX_DISPLAY_NAME_LEN+1];
+
+ memset(addressVal, 0x00, sizeof(addressVal));
+ memset(displayName, 0x00, sizeof(displayName));
+
+ snprintf(addressVal, sizeof(addressVal), "%s", pMsg->addressList[0].addressVal);
+ snprintf(displayName, sizeof(displayName), "%s", pMsg->addressList[0].displayName);
+
+ if (pMsg->msgType.mainType == MSG_SMS_TYPE &&
+ (pMsg->msgType.subType >= MSG_MWI_VOICE_SMS && pMsg->msgType.subType <= MSG_MWI_OTHER_SMS)) {
+
+ args = bundle_create();
+
+ noti = notification_new(NOTIFICATION_TYPE_NOTI, 1, NOTIFICATION_PRIV_ID_NONE);
+ if (noti == NULL) {
+ MSG_DEBUG("notification_new is failed.");
+ bundle_free(args);
+ return MSG_ERR_UNKNOWN;
+ }
+
+ noti_err = notification_set_application(noti, "com.samsung.call");
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_application : %d", noti_err);
+ }
+
+ noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, VOICE_MSG_ICON_PATH);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_image : %d", noti_err);
+ }
+
+ //FIXME :: Temp code for voice number, 2012.08.16 sangkoo.kim
+ bundle_add(args, "launch-type", "MO");
+ bundle_add(args, "number", pMsg->addressList[0].addressVal);
+
+ } else {
+ return MSG_ERR_INVALID_PARAMETER;
+ }
+
+ if (displayName[0] == '\0')
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, addressVal, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ else
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, displayName, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, pMsg->msgText, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+
+ if (args != NULL) {
+ noti_err = notification_set_args(noti, args, NULL);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_args : %d", noti_err);
+ }
+ }
+
+ noti_err = notification_set_time(noti, pMsg->displayTime);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_set_time : %d", noti_err);
+ }
+
+ noti_err = notification_insert(noti, NULL);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_insert");
+ }
+
+ noti_err = notification_free(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ MSG_DEBUG("Fail to notification_free");
+ }
+
+ bundle_free(args);
+
+ return MSG_SUCCESS;
+}
msg_error_t MsgInsertSmsReportToNoti(MsgDbHandler *pDbHandle, msg_message_id_t msgId, msg_delivery_report_status_t status)
{
notification_h noti = NULL;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
- msg_delivery_report_status_t deliveryStatus;
- msg_read_report_status_t readStatus;
-
char addressVal[MAX_ADDRESS_VAL_LEN+1];
char firstName[MAX_DISPLAY_NAME_LEN+1], lastName[MAX_DISPLAY_NAME_LEN+1];
char displayName[MAX_DISPLAY_NAME_LEN+1];
memset(contents, 0x00, sizeof(contents));
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.DELIVERY_REPORT_STATUS, B.READ_REPORT_STATUS \
- FROM %s A, %s B WHERE B.MSG_ID=%d AND A.CONV_ID=B.CONV_ID;",
- MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, pMsg->msgId);
+ int report_status_type;
+ int report_status_value;
+
+ if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) {
+ report_status_type = MSG_REPORT_TYPE_DELIVERY;
+ MSG_DEBUG("mms subtype is Delivery Report type");
+ } else if (pMsg->msgType.subType == MSG_READORGIND_MMS) {
+ report_status_type = MSG_REPORT_TYPE_READ;
+ MSG_DEBUG("mms subtype is Read Report type");
+ } else {
+ MSG_DEBUG("No matching subtype. subtype [%d]", pMsg->msgType.subType);
+ return MSG_SUCCESS;
+ }
+
+ MSG_ADDRESS_INFO_S *address_info_s = &pMsg->addressList[0];
+ MSG_DEBUG("address info : %s, type : %d", address_info_s->addressVal, address_info_s->addressType);
+
+ if (address_info_s->addressType == MSG_ADDRESS_TYPE_PLMN) {//FIXME: compare 10 char of address
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.STATUS "
+ "FROM %s A, %s B "
+ "WHERE B.MSG_ID=%d AND B.STATUS_TYPE=%d AND A.ADDRESS_VAL LIKE \'%s\';"
+ , MSGFW_ADDRESS_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, pMsg->msgId, report_status_type, address_info_s->addressVal);
+ } else if (address_info_s->addressType == MSG_ADDRESS_TYPE_EMAIL) {//check full
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.STATUS "
+ "FROM %s A, %s B "
+ "WHERE B.MSG_ID=%d AND B.STATUS_TYPE=%d AND A.ADDRESS_VAL=\'%s\';"
+ , MSGFW_ADDRESS_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, pMsg->msgId, report_status_type, address_info_s->addressVal);
+ } else {
+ snprintf(sqlQuery, sizeof(sqlQuery),
+ "SELECT A.ADDRESS_VAL, A.DISPLAY_NAME, A.FIRST_NAME, A.LAST_NAME, B.STATUS "
+ "FROM %s A, %s B "
+ "WHERE B.MSG_ID=%d B.STATUS_TYPE=%d;"
+ , MSGFW_ADDRESS_TABLE_NAME, MSGFW_REPORT_TABLE_NAME, pMsg->msgId, report_status_type);
+ }
+
+ MSG_DEBUG("sqlQuery = [%s]", sqlQuery);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
if (pDbHandle->stepQuery() == MSG_ERR_DB_ROW) {
- if (pDbHandle->columnText(0) != NULL)
+ if (pDbHandle->columnText(0) != NULL) {
strncpy(addressVal, (char*)pDbHandle->columnText(0), MAX_ADDRESS_VAL_LEN);
-
+ MSG_DEBUG("addressVal is [%s]",addressVal);
+ } else {
+ MSG_DEBUG("address Val is Null");
+ }
char *pTempDisplayName = (char *)pDbHandle->columnText(1);
if (pTempDisplayName != NULL && pTempDisplayName[0] != '\0') {
}
}
- deliveryStatus = (msg_delivery_report_status_t)pDbHandle->columnInt(4);
- readStatus = (msg_read_report_status_t)pDbHandle->columnInt(5);
+ report_status_value = pDbHandle->columnInt(4);
} else {
+ MSG_DEBUG("DB Query Result Fail");
pDbHandle->finalizeQuery();
return MSG_ERR_DB_STEP;
}
if (pMsg->msgType.subType == MSG_DELIVERYIND_MMS) {
- switch(deliveryStatus) {
+ switch(report_status_value) {
case MSG_DELIVERY_REPORT_NONE:
noti_err = notification_free(noti);
if (noti_err != NOTIFICATION_ERROR_NONE) {
} else if (pMsg->msgType.subType == MSG_READORGIND_MMS) {
- switch(readStatus) {
+ switch(report_status_value) {
case MSG_READ_REPORT_NONE:
noti_err = notification_free(noti);
if (noti_err != NOTIFICATION_ERROR_NONE)
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' = FILTER_VALUE \
- UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE,1)||'%%' \
- UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%';",
- MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal,
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE (CASE WHEN LENGTH(FILTER_VALUE)>%d-1 THEN '%%'||SUBSTR(FILTER_VALUE, LENGTH(FILTER_VALUE)-%d-1) ELSE FILTER_VALUE END) AND FILTER_ACTIVE = 1 \
+ UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1 \
+ UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1;",
+ MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal, MAX_PRECONFIG_NUM, MAX_PRECONFIG_NUM,
MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_START, pMsgInfo->addressList[0].addressVal,
MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_INCLUDE, pMsgInfo->addressList[0].addressVal);
err = pDbHandle->getTable(sqlQuery, &rowCnt);
+ if (err == MSG_ERR_DB_GETTABLE) {
+ MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+ }
+
if (rowCnt > 0) {
MSG_DEBUG("Msg is Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal);
-
pDbHandle->freeTable();
-
pMsgInfo->folderId = MSG_SPAMBOX_ID;
-
return true;
} else {
MSG_DEBUG("Msg is NOT Filtered by Address : [%s]", pMsgInfo->addressList[0].addressVal);
-
- MSG_DEBUG("sqlQuery [%s]", sqlQuery);
-
pDbHandle->freeTable();
}
#include <glib.h>
#include "MsgDebug.h"
-#include "SmsPluginTextConvert.h"
+#include "MsgTextConvert.h"
/*==================================================================================================
IMPLEMENTATION OF MsgConvertText - Member Functions
==================================================================================================*/
-SmsPluginTextConvert* SmsPluginTextConvert::pInstance = NULL;
-
-SmsPluginTextConvert* SmsPluginTextConvert::instance()
+MsgTextConvert::MsgTextConvert()
{
- if (!pInstance)
- pInstance = new SmsPluginTextConvert();
+ extCharList.clear();
+ ucs2toGSM7DefList.clear();
+ ucs2toGSM7ExtList.clear();
+ ucs2toTurkishList.clear();
+ ucs2toSpanishList.clear();
+ ucs2toPortuList.clear();
+
+ extCharList[0x000C] = MSG_CHAR_GSM7EXT;
+ extCharList[0x005B] = MSG_CHAR_GSM7EXT;
+ extCharList[0x005C] = MSG_CHAR_GSM7EXT;
+ extCharList[0x005D] = MSG_CHAR_GSM7EXT;
+ extCharList[0x005E] = MSG_CHAR_GSM7EXT;
+ extCharList[0x007B] = MSG_CHAR_GSM7EXT;
+ extCharList[0x007C] = MSG_CHAR_GSM7EXT;
+ extCharList[0x007D] = MSG_CHAR_GSM7EXT;
+ extCharList[0x007E] = MSG_CHAR_GSM7EXT;
+ extCharList[0x20AC] = MSG_CHAR_GSM7EXT; // ��
+
+ extCharList[0x00E7] = MSG_CHAR_TURKISH;
+ extCharList[0x011E] = MSG_CHAR_TURKISH;
+ extCharList[0x011F] = MSG_CHAR_TURKISH;
+ extCharList[0x01E6] = MSG_CHAR_TURKISH;
+ extCharList[0x01E7] = MSG_CHAR_TURKISH;
+ extCharList[0x0130] = MSG_CHAR_TURKISH;
+ extCharList[0x0131] = MSG_CHAR_TURKISH;
+ extCharList[0x015E] = MSG_CHAR_TURKISH;
+ extCharList[0x015F] = MSG_CHAR_TURKISH;
+
+ extCharList[0x00C1] = MSG_CHAR_SPANISH;
+ extCharList[0x00E1] = MSG_CHAR_SPANISH;
+ extCharList[0x00CD] = MSG_CHAR_SPANISH;
+ extCharList[0x00ED] = MSG_CHAR_SPANISH;
+ extCharList[0x00D3] = MSG_CHAR_SPANISH;
+ extCharList[0x00F3] = MSG_CHAR_SPANISH;
+ extCharList[0x00DA] = MSG_CHAR_SPANISH;
+ extCharList[0x00FA] = MSG_CHAR_SPANISH;
+
+ extCharList[0x00D4] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00F4] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00CA] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00EA] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00C0] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00E7] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00C3] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00E3] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00D5] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00F5] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00C2] = MSG_CHAR_PORTUGUESE;
+ extCharList[0x00E2] = MSG_CHAR_PORTUGUESE;
+
+ for (unsigned char i = 0; i < 128; i++)
+ {
+ ucs2toGSM7DefList[g_GSM7BitToUCS2[i]] = i;
+ }
+
+ // GSM 7 bit Extension
+ ucs2toGSM7ExtList[0x005B] = 0x3C; // [
+ ucs2toGSM7ExtList[0x005D] = 0x3E; // ]
+ ucs2toGSM7ExtList[0x007B] = 0x28; // {
+ ucs2toGSM7ExtList[0x007D] = 0x29; // }
+ ucs2toGSM7ExtList[0x000C] = 0x0A; // Page Break
+ ucs2toGSM7ExtList[0x005C] = 0x2F; /* \ */
+ ucs2toGSM7ExtList[0x005E] = 0x14; // ^
+ ucs2toGSM7ExtList[0x007C] = 0x40; // |
+ ucs2toGSM7ExtList[0x007E] = 0x3D; // ~
+ ucs2toGSM7ExtList[0x20AC] = 0x65; // ��
+
+ // Turkish
+ ucs2toTurkishList[0x005B] = 0x3C; // [
+ ucs2toTurkishList[0x005D] = 0x3E; // ]
+ ucs2toTurkishList[0x007B] = 0x28; // {
+ ucs2toTurkishList[0x007D] = 0x29; // }
+ ucs2toTurkishList[0x000C] = 0x0A; // Page Break
+ ucs2toTurkishList[0x005C] = 0x2F; /* \ */
+ ucs2toTurkishList[0x005E] = 0x14; // ^
+ ucs2toTurkishList[0x007C] = 0x40; // |
+ ucs2toTurkishList[0x007E] = 0x3D; // ~
+ ucs2toTurkishList[0x20AC] = 0x65; // ��
+ ucs2toTurkishList[0x00E7] = 0x63; // c LATIN SMALL LETTER S WITH CEDILLA *
+ ucs2toTurkishList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE
+ ucs2toTurkishList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE
+ ucs2toTurkishList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON
+ ucs2toTurkishList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON
+ ucs2toTurkishList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE
+ ucs2toTurkishList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS
+ ucs2toTurkishList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA *
+ ucs2toTurkishList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA *
+
+ // Spanish
+ ucs2toSpanishList[0x005B] = 0x3C; // [
+ ucs2toSpanishList[0x005D] = 0x3E; // ]
+ ucs2toSpanishList[0x007B] = 0x28; // {
+ ucs2toSpanishList[0x007D] = 0x29; // }
+ ucs2toSpanishList[0x000C] = 0x0A; // Page Break
+ ucs2toSpanishList[0x005C] = 0x2F; /* \ */
+ ucs2toSpanishList[0x005E] = 0x14; // ^
+ ucs2toSpanishList[0x007C] = 0x40; // |
+ ucs2toSpanishList[0x007E] = 0x3D; // ~
+ ucs2toSpanishList[0x20AC] = 0x65; // ��
+ ucs2toSpanishList[0x00C1] = 0x41; // A
+ ucs2toSpanishList[0x00E1] = 0x61; // a
+ ucs2toSpanishList[0x00CD] = 0x49; // I
+ ucs2toSpanishList[0x00ED] = 0x69; // i
+ ucs2toSpanishList[0x00D3] = 0x4F; // O
+ ucs2toSpanishList[0x00F3] = 0x6F; // o
+ ucs2toSpanishList[0x00DA] = 0x55; // U
+ ucs2toSpanishList[0x00FA] = 0x75; // u
+
+ // Portuguese
+ ucs2toPortuList[0x005B] = 0x3C; // [
+ ucs2toPortuList[0x005D] = 0x3E; // ]
+ ucs2toPortuList[0x007B] = 0x28; // {
+ ucs2toPortuList[0x007D] = 0x29; // }
+ ucs2toPortuList[0x000C] = 0x0A; // Page Break
+ ucs2toPortuList[0x005C] = 0x2F; /* \ */
+ ucs2toPortuList[0x005E] = 0x14; // ^
+ ucs2toPortuList[0x007C] = 0x40; // |
+ ucs2toPortuList[0x007E] = 0x3D; // ~
+ ucs2toPortuList[0x20AC] = 0x65; // ��
+ ucs2toPortuList[0x00D4] = 0x0B; // O
+ ucs2toPortuList[0x00F4] = 0x0C; // o
+ ucs2toPortuList[0x00C1] = 0x0E; // A
+ ucs2toPortuList[0x00E1] = 0x0F; // a
+ ucs2toPortuList[0x00CA] = 0x1F; // E
+ ucs2toPortuList[0x00EA] = 0x05; // e
+ ucs2toPortuList[0x00C0] = 0x41; // A
+ ucs2toPortuList[0x00E7] = 0x09; // c
+ ucs2toPortuList[0x00CD] = 0x49; // I
+ ucs2toPortuList[0x00ED] = 0x69; // i
+ ucs2toPortuList[0x00D3] = 0x4F; // O
+ ucs2toPortuList[0x00F3] = 0x6F; // o
+ ucs2toPortuList[0x00DA] = 0x55; // U
+ ucs2toPortuList[0x00FA] = 0x75; // u
+ ucs2toPortuList[0x00C3] = 0x61; // A
+ ucs2toPortuList[0x00E3] = 0x7B; // a
+ ucs2toPortuList[0x00D5] = 0x5C; // O
+ ucs2toPortuList[0x00F5] = 0x7C; // o
+ ucs2toPortuList[0x00C2] = 0x61; // A
+ ucs2toPortuList[0x00E2] = 0x7F; // a
+ ucs2toPortuList[0x03A6] = 0x12; // ��
+ ucs2toPortuList[0x0393] = 0x13; // ��
+ ucs2toPortuList[0x03A9] = 0x15; // ��
+ ucs2toPortuList[0x03A0] = 0x16; // ��
+ ucs2toPortuList[0x03A8] = 0x17; // ��
+ ucs2toPortuList[0x03A3] = 0x18; // ��
+ ucs2toPortuList[0x0398] = 0x19; // ��
+}
- return pInstance;
+
+MsgTextConvert::~MsgTextConvert()
+{
+ extCharList.clear();
+ ucs2toGSM7DefList.clear();
+ ucs2toGSM7ExtList.clear();
+ ucs2toTurkishList.clear();
+ ucs2toSpanishList.clear();
+ ucs2toPortuList.clear();
}
-int SmsPluginTextConvert::convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId)
+
+int MsgTextConvert::convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId)
{
int utf8Length = 0;
int gsm7bitLength = 0;
byte length of converted UCS2 characters
-1 : converting error
*/
-int SmsPluginTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
+int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
int i, j;
int textLen;
}
-int SmsPluginTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType)
+int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT msg_encode_type_t *pCharType)
{
int utf8Length = 0;
int gsm7bitLength = 0;
return:
bytelength of UTF8 text
*/
-int SmsPluginTextConvert::convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo)
+int MsgTextConvert::convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo)
{
int utf8Length = 0;
int ucs2Length = 0;
byte length of converted UTF8 characters
-1 : The alpha isn't the gsm 7bit code
*/
-int SmsPluginTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
+int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
int remainedBuffer = maxLength;
int utf8Length;
}
-int SmsPluginTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
+int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
int remainedBuffer = maxLength;
int utf8Length;
bytelength of gsm7bit text
-1 : converting error
*/
-int SmsPluginTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId)
+int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId)
{
// for UNICODE
int outTextLen = 0;
std::map<unsigned short, unsigned char>::iterator itChar;
std::map<unsigned short, unsigned char>::iterator itExt;
- SMS_CHAR_TYPE_T currType = SMS_CHAR_DEFAULT;
- SMS_CHAR_TYPE_T newType = SMS_CHAR_DEFAULT;
+ MSG_CHAR_TYPE_T currType = MSG_CHAR_DEFAULT;
+ MSG_CHAR_TYPE_T newType = MSG_CHAR_DEFAULT;
unsigned short inText;
if (itExt != extCharList.end())
{
- newType = (SMS_CHAR_TYPE_T)itExt->second;
+ newType = (MSG_CHAR_TYPE_T)itExt->second;
if (newType >= currType)
{
}
else
{
- if (currType == SMS_CHAR_GSM7EXT)
+ if (currType == MSG_CHAR_GSM7EXT)
{
itExt = ucs2toGSM7ExtList.find(inText);
pDestText[outTextLen++] = 0x20;
}
}
- else if (currType == SMS_CHAR_TURKISH)
+ else if (currType == MSG_CHAR_TURKISH)
{
- *pLangId = SMS_LANG_ID_TURKISH;
+ *pLangId = MSG_LANG_ID_TURKISH;
itExt = ucs2toTurkishList.find(inText);
pDestText[outTextLen++] = 0x20;
}
}
- else if (currType == SMS_CHAR_SPANISH)
+ else if (currType == MSG_CHAR_SPANISH)
{
- *pLangId = SMS_LANG_ID_SPANISH;
+ *pLangId = MSG_LANG_ID_SPANISH;
itExt = ucs2toSpanishList.find(inText);
pDestText[outTextLen++] = 0x20;
}
}
- else if (currType == SMS_CHAR_PORTUGUESE)
+ else if (currType == MSG_CHAR_PORTUGUESE)
{
- *pLangId = SMS_LANG_ID_PORTUGUESE;
+ *pLangId = MSG_LANG_ID_PORTUGUESE;
itExt = ucs2toPortuList.find(inText);
}
-int SmsPluginTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
+int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
{
// for UNICODE
int outTextLen = 0;
byte length of converted UCS2 characters
-1 : The alpha isn't the gsm 7bit code
*/
-int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo)
+int MsgTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN MSG_LANG_INFO_S *pLangInfo)
{
int outTextLen = 0;
unsigned char lowerByte = 0, upperByte = 0;
{
MSG_DEBUG("Locking Shift [%d]", pLangInfo->lockingLang);
- if (pLangInfo->lockingLang == SMS_LANG_ID_TURKISH)
+ if (pLangInfo->lockingLang == MSG_LANG_ID_TURKISH)
{
// Check Escape
if (g_TurkishLockingToUCS2[pSrcText[i]] == 0x001B)
{
MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
- if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
+ if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH)
{
lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
- else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
+ else if (pLangInfo->singleLang == MSG_LANG_ID_SPANISH)
{
lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
- else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
+ else if (pLangInfo->singleLang == MSG_LANG_ID_PORTUGUESE)
{
lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
upperByte = (g_TurkishLockingToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
}
- else if (pLangInfo->lockingLang == SMS_LANG_ID_PORTUGUESE)
+ else if (pLangInfo->lockingLang == MSG_LANG_ID_PORTUGUESE)
{
// Check Escape
if (g_PortuLockingToUCS2[pSrcText[i]] == 0x001B)
{
MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
- if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
+ if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH)
{
lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
- else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
+ else if (pLangInfo->singleLang == MSG_LANG_ID_SPANISH)
{
lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
- else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
+ else if (pLangInfo->singleLang == MSG_LANG_ID_PORTUGUESE)
{
lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
{
MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
- if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
+ if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH)
{
lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
- else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
+ else if (pLangInfo->singleLang == MSG_LANG_ID_SPANISH)
{
lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
- else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
+ else if (pLangInfo->singleLang == MSG_LANG_ID_PORTUGUESE)
{
lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
}
-void SmsPluginTextConvert::convertDumpTextToHex(const unsigned char *pText, int length)
+void MsgTextConvert::convertDumpTextToHex(const unsigned char *pText, int length)
{
printf("\n=======================================\n");
printf(" Dump Text To Hex - Length :%d\n", length);
printf("\n=======================================\n\n");
}
-
-
-SmsPluginTextConvert::SmsPluginTextConvert()
-{
- extCharList.clear();
- ucs2toGSM7DefList.clear();
- ucs2toGSM7ExtList.clear();
- ucs2toTurkishList.clear();
- ucs2toSpanishList.clear();
- ucs2toPortuList.clear();
-
- extCharList[0x000C] = SMS_CHAR_GSM7EXT;
- extCharList[0x005B] = SMS_CHAR_GSM7EXT;
- extCharList[0x005C] = SMS_CHAR_GSM7EXT;
- extCharList[0x005D] = SMS_CHAR_GSM7EXT;
- extCharList[0x005E] = SMS_CHAR_GSM7EXT;
- extCharList[0x007B] = SMS_CHAR_GSM7EXT;
- extCharList[0x007C] = SMS_CHAR_GSM7EXT;
- extCharList[0x007D] = SMS_CHAR_GSM7EXT;
- extCharList[0x007E] = SMS_CHAR_GSM7EXT;
- extCharList[0x20AC] = SMS_CHAR_GSM7EXT; // ¢æ
-
- extCharList[0x00E7] = SMS_CHAR_TURKISH;
- extCharList[0x011E] = SMS_CHAR_TURKISH;
- extCharList[0x011F] = SMS_CHAR_TURKISH;
- extCharList[0x01E6] = SMS_CHAR_TURKISH;
- extCharList[0x01E7] = SMS_CHAR_TURKISH;
- extCharList[0x0130] = SMS_CHAR_TURKISH;
- extCharList[0x0131] = SMS_CHAR_TURKISH;
- extCharList[0x015E] = SMS_CHAR_TURKISH;
- extCharList[0x015F] = SMS_CHAR_TURKISH;
-
- extCharList[0x00C1] = SMS_CHAR_SPANISH;
- extCharList[0x00E1] = SMS_CHAR_SPANISH;
- extCharList[0x00CD] = SMS_CHAR_SPANISH;
- extCharList[0x00ED] = SMS_CHAR_SPANISH;
- extCharList[0x00D3] = SMS_CHAR_SPANISH;
- extCharList[0x00F3] = SMS_CHAR_SPANISH;
- extCharList[0x00DA] = SMS_CHAR_SPANISH;
- extCharList[0x00FA] = SMS_CHAR_SPANISH;
-
- extCharList[0x00D4] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00F4] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00CA] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00EA] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00C0] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00E7] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00C3] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00E3] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00D5] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00F5] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00C2] = SMS_CHAR_PORTUGUESE;
- extCharList[0x00E2] = SMS_CHAR_PORTUGUESE;
-
- for (unsigned char i = 0; i < 128; i++)
- {
- ucs2toGSM7DefList[g_GSM7BitToUCS2[i]] = i;
- }
-
- // GSM 7 bit Extension
- ucs2toGSM7ExtList[0x005B] = 0x3C; // [
- ucs2toGSM7ExtList[0x005D] = 0x3E; // ]
- ucs2toGSM7ExtList[0x007B] = 0x28; // {
- ucs2toGSM7ExtList[0x007D] = 0x29; // }
- ucs2toGSM7ExtList[0x000C] = 0x0A; // Page Break
- ucs2toGSM7ExtList[0x005C] = 0x2F; /* \ */
- ucs2toGSM7ExtList[0x005E] = 0x14; // ^
- ucs2toGSM7ExtList[0x007C] = 0x40; // |
- ucs2toGSM7ExtList[0x007E] = 0x3D; // ~
- ucs2toGSM7ExtList[0x20AC] = 0x65; // ¢æ
-
- // Turkish
- ucs2toTurkishList[0x005B] = 0x3C; // [
- ucs2toTurkishList[0x005D] = 0x3E; // ]
- ucs2toTurkishList[0x007B] = 0x28; // {
- ucs2toTurkishList[0x007D] = 0x29; // }
- ucs2toTurkishList[0x000C] = 0x0A; // Page Break
- ucs2toTurkishList[0x005C] = 0x2F; /* \ */
- ucs2toTurkishList[0x005E] = 0x14; // ^
- ucs2toTurkishList[0x007C] = 0x40; // |
- ucs2toTurkishList[0x007E] = 0x3D; // ~
- ucs2toTurkishList[0x20AC] = 0x65; // ¢æ
- ucs2toTurkishList[0x00E7] = 0x63; // c LATIN SMALL LETTER S WITH CEDILLA *
- ucs2toTurkishList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE
- ucs2toTurkishList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE
- ucs2toTurkishList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON
- ucs2toTurkishList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON
- ucs2toTurkishList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE
- ucs2toTurkishList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS
- ucs2toTurkishList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA *
- ucs2toTurkishList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA *
-
- // Spanish
- ucs2toSpanishList[0x005B] = 0x3C; // [
- ucs2toSpanishList[0x005D] = 0x3E; // ]
- ucs2toSpanishList[0x007B] = 0x28; // {
- ucs2toSpanishList[0x007D] = 0x29; // }
- ucs2toSpanishList[0x000C] = 0x0A; // Page Break
- ucs2toSpanishList[0x005C] = 0x2F; /* \ */
- ucs2toSpanishList[0x005E] = 0x14; // ^
- ucs2toSpanishList[0x007C] = 0x40; // |
- ucs2toSpanishList[0x007E] = 0x3D; // ~
- ucs2toSpanishList[0x20AC] = 0x65; // ¢æ
- ucs2toSpanishList[0x00C1] = 0x41; // A
- ucs2toSpanishList[0x00E1] = 0x61; // a
- ucs2toSpanishList[0x00CD] = 0x49; // I
- ucs2toSpanishList[0x00ED] = 0x69; // i
- ucs2toSpanishList[0x00D3] = 0x4F; // O
- ucs2toSpanishList[0x00F3] = 0x6F; // o
- ucs2toSpanishList[0x00DA] = 0x55; // U
- ucs2toSpanishList[0x00FA] = 0x75; // u
-
- // Portuguese
- ucs2toPortuList[0x005B] = 0x3C; // [
- ucs2toPortuList[0x005D] = 0x3E; // ]
- ucs2toPortuList[0x007B] = 0x28; // {
- ucs2toPortuList[0x007D] = 0x29; // }
- ucs2toPortuList[0x000C] = 0x0A; // Page Break
- ucs2toPortuList[0x005C] = 0x2F; /* \ */
- ucs2toPortuList[0x005E] = 0x14; // ^
- ucs2toPortuList[0x007C] = 0x40; // |
- ucs2toPortuList[0x007E] = 0x3D; // ~
- ucs2toPortuList[0x20AC] = 0x65; // ¢æ
- ucs2toPortuList[0x00D4] = 0x0B; // O
- ucs2toPortuList[0x00F4] = 0x0C; // o
- ucs2toPortuList[0x00C1] = 0x0E; // A
- ucs2toPortuList[0x00E1] = 0x0F; // a
- ucs2toPortuList[0x00CA] = 0x1F; // E
- ucs2toPortuList[0x00EA] = 0x05; // e
- ucs2toPortuList[0x00C0] = 0x41; // A
- ucs2toPortuList[0x00E7] = 0x09; // c
- ucs2toPortuList[0x00CD] = 0x49; // I
- ucs2toPortuList[0x00ED] = 0x69; // i
- ucs2toPortuList[0x00D3] = 0x4F; // O
- ucs2toPortuList[0x00F3] = 0x6F; // o
- ucs2toPortuList[0x00DA] = 0x55; // U
- ucs2toPortuList[0x00FA] = 0x75; // u
- ucs2toPortuList[0x00C3] = 0x61; // A
- ucs2toPortuList[0x00E3] = 0x7B; // a
- ucs2toPortuList[0x00D5] = 0x5C; // O
- ucs2toPortuList[0x00F5] = 0x7C; // o
- ucs2toPortuList[0x00C2] = 0x61; // A
- ucs2toPortuList[0x00E2] = 0x7F; // a
- ucs2toPortuList[0x03A6] = 0x12; // ¥Õ
- ucs2toPortuList[0x0393] = 0x13; // ¥Ã
- ucs2toPortuList[0x03A9] = 0x15; // ¥Ø
- ucs2toPortuList[0x03A0] = 0x16; // ¥Ð
- ucs2toPortuList[0x03A8] = 0x17; // ¥×
- ucs2toPortuList[0x03A3] = 0x18; // ¥Ò
- ucs2toPortuList[0x0398] = 0x19; // ¥È
-}
-
-
-SmsPluginTextConvert::~SmsPluginTextConvert()
-{
- extCharList.clear();
- ucs2toGSM7DefList.clear();
- ucs2toGSM7ExtList.clear();
- ucs2toTurkishList.clear();
- ucs2toSpanishList.clear();
- ucs2toPortuList.clear();
-
- if (pInstance)
- {
- delete pInstance;
- pInstance = NULL;
- }
-}
-
return;
}
- // Remove temporal Mms folder (/opt/data/msg-service/msgdata/*.dir)
+ // Remove temporal Mms folder (/opt/usr/data/msg-service/msgdata/*.dir)
while ((d = readdir(dir)) != NULL) {
if (d->d_type == DT_DIR) {
if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0))
}
-int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, char **ppDest)
+int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest)
{
int dataSize = 0;
- dataSize = (sizeof(MSG_REPORT_STATUS_INFO_S));
+ dataSize = (sizeof(MSG_REPORT_STATUS_INFO_S)*count + sizeof(int));
*ppDest = (char*)new char[dataSize];
void* p = (void*)*ppDest;
- memcpy(p, pReportStatus, dataSize);
+ memcpy(p, &count, sizeof(int));
+
+ p = (void*)((int)p + sizeof(int));
+
+ memcpy(p, pReportStatus, sizeof(MSG_REPORT_STATUS_INFO_S)*count);
return dataSize;
}
}
-void MsgDecodeReportStatus(char *pSrc, MSG_REPORT_STATUS_INFO_S *pReportStatus)
+void MsgDecodeReportStatus(char *pSrc, msg_struct_list_s *report_list)
{
int count = 0;
if(pSrc == NULL)
return;
- memcpy(&count, pSrc, sizeof(msg_delivery_report_status_t));
- pSrc = pSrc + sizeof(msg_delivery_report_status_t);
- pReportStatus->deliveryStatus = count;
+ memcpy(&count, pSrc, sizeof(int));
+ pSrc = pSrc + sizeof(int);
+ report_list->nCount = count;
- memcpy(&count, pSrc, sizeof(time_t));
- pSrc = pSrc + sizeof(time_t);
- pReportStatus->deliveryStatusTime = count;
+ msg_struct_t *report_status = (msg_struct_t *)new char[sizeof(msg_struct_t)*count];
+ for (int i = 0; i < count; i++) {
+ msg_struct_s *report_status_item = new msg_struct_s;
+ report_status_item->type = MSG_STRUCT_REPORT_STATUS_INFO;
+ report_status_item->data = new MSG_REPORT_STATUS_INFO_S;
+ memset(report_status_item->data, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S));
- memcpy(&count, pSrc, sizeof(msg_read_report_status_t));
- pSrc = pSrc + sizeof(msg_read_report_status_t);
- pReportStatus->readStatus = count;
+ MSG_REPORT_STATUS_INFO_S *report_status_info = (MSG_REPORT_STATUS_INFO_S *)report_status_item->data;
+ memcpy(report_status_info, pSrc, sizeof(MSG_REPORT_STATUS_INFO_S));
+ pSrc = pSrc + sizeof(MSG_REPORT_STATUS_INFO_S);
- memcpy(&count, pSrc, sizeof(time_t));
- pSrc = pSrc + sizeof(time_t);
- pReportStatus->readStatusTime = count;
+ report_status[i] = (msg_struct_t)report_status_item;
+ MSG_DEBUG("Report_type = %d, status addr = %s, status = %d, time = %d",
+ report_status_info->type, report_status_info->addressVal,
+ report_status_info->status, report_status_info->statusTime);
+ }
+ report_list->msg_struct_info = report_status;
return;
}
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, %d, 0, %d, 0, 0);",
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, ?, ?, ?, 0, 0, 0);",
MSGFW_MESSAGE_TABLE_NAME, msgId, pMsgInfo->threadId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType,
pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize, pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected,
- pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup, MSG_DELIVERY_REPORT_NONE, MSG_READ_REPORT_NONE);
+ pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup);
MSG_DEBUG("QUERY : %s", sqlQuery);
char lastName[MAX_DISPLAY_NAME_LEN+1];
pAddress->nCount = 0;
- pAddress->nCount = NULL;
+ pAddress->msg_struct_info = NULL;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.ADDRESS_TYPE, A.RECIPIENT_TYPE, \
char msgText[MAX_THREAD_DATA_LEN+1];
char sqlQuery[MAX_QUERY_LEN+1];
+ memset(msgText, 0x00, sizeof(msgText));
+
// Get Unread Count
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d AND READ_STATUS = 0;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND FOLDER_ID = %d AND STORAGE_ID = %d AND READ_STATUS = 0;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_INBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
// Get SMS Count
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND MAIN_TYPE = %d AND FOLDER_ID > 0 AND FOLDER_ID < %d;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SMS_TYPE, MSG_SPAMBOX_ID);
+ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE CONV_ID = %d AND MAIN_TYPE = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SMS_TYPE, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s \
- WHERE CONV_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) AND FOLDER_ID > 0 AND FOLDER_ID < %d;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, MSG_SPAMBOX_ID);
+ WHERE CONV_ID = %d AND MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d) AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS,
+ MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, MSG_DIRECTION, DISPLAY_TIME, SUBJECT, MSG_TEXT FROM %s \
- WHERE CONV_ID = %d AND FOLDER_ID > 0 AND FOLDER_ID < %d ORDER BY DISPLAY_TIME DESC;",
- MSGFW_MESSAGE_TABLE_NAME, convId, MSG_SPAMBOX_ID);
+ WHERE CONV_ID = %d AND FOLDER_ID > %d AND FOLDER_ID < %d AND STORAGE_ID = %d ORDER BY DISPLAY_TIME DESC;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE);
if (pDbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_PREPARE;
return err;
}
+msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status)
+{
+ msg_error_t err = MSG_SUCCESS;
+
+ char sqlQuery[MAX_QUERY_LEN+1];
+
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d WHERE MSG_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, status, pMsgInfo->msgId);
+
+ if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+ err = MSG_ERR_DB_EXEC;
+
+ return err;
+}
char *MsgStoReplaceString(const char *origStr, const char *oldStr, const char *newStr)
{